xuyily 发表于 2024-3-3 20:19:54

MobileUserControl的BackgroundImage无法动态改变

如题!我的用户控件是用作listview的模板

如果是设计时设置了背景图片,那么运行时会显示背景图片


如果是在listview的row_bind事件里动态修改模板的背景图片,那么运行时时不会显示更改的图片的。如下代码所示无法显示图片
private void listViewPayment_RowBind(object sender, ListViewTemplateBindEventArgs e)
      {
            rowFormat(e.Row.Control, e.Data);
            this.Form.Client.RenderFlush();
      }


public void rowFormat(MobileUserControl tpl, object obj)
      {
            CollectionRecord collectionRecord = (CollectionRecord)obj;
            PaymentTpl paymentTpl = (PaymentTpl)tpl;
            if(collectionRecord.DataStatus == -1)
            {
                paymentTpl.BackColor = Color.FromArgb(70,255,153,153);
                //paymentTpl.lblID.LineThrough = true;
                paymentTpl.BackgroundImage = "voided128"; //此处改变背景不会生效

                FindLabel(paymentTpl);
            }


      }

Lula.Jin 发表于 2024-3-4 10:28:57

我们会测试这个问题的
页: [1]
查看完整版本: MobileUserControl的BackgroundImage无法动态改变