我在主表单中设置了背景图片,然后在子表单中调用了它,它不起作用
我在主表单的属性中设置背景图像。如果我将其他任何工具(如按钮面板)放在子窗体上,就可以使用
主表格
if([Billing Doc. currency_WAERK] = 'USD',
sum({<[Billing Type_FKART] -={'ZG2','ZL2'}>}[Billing Sales Amount_NETWR])*139.2,
sum({<[Billing Type_FKART] -={'ZG2','ZL2'}>}[Billing Sales Amount_NETWR]))
子表格
在这里我这样称呼
Total Sales Variable =
CALCULATE (
SUMX (
VALUES ( test_billing_doc_header[Billing Doc. currency_WAERK] ),
IF (
test_billing_doc_header[Billing Doc. currency_WAERK] = "USD",
139.2,
1
) * SUM ( test_biilingg_doc_item[Billing Sales Amount_NETWR] )
),
test_billing_doc_header[Billing Type_FKART] <> "ZG2" && test_billing_doc_header[Billing Type_FKART] <> "ZL2"
)
答案 0 :(得分:3)
BaseMasterForm .cs
public class BaseMasterForm : Form
{
// You can override this Show Background. If you want or not to show background.
public virtual bool ShowBackground { get { return true; } }
public BaseMasterForm()
{
this.Load += (s, e) =>
{
// your image
this.BackgroundImage = (ShowBackground) ? Properties.Resources.LeeQc : null;
// you can custom
this.BackgroundImageLayout = (ShowBackground) ? ImageLayout.Stretch : ImageLayout.None;
};
}
}
ChildForm.cs
public partial class ChildForm : BaseMasterForm
{
// set true or false. to show MasterForm background.
public override bool ShowBackground { get { return true; } }
public ChildForm()
{
InitializeComponent();
}
}
答案 1 :(得分:0)
我认为它不起作用,因为每个页面都有它自己的属性。您必须在MasterForm中设置图片。
public partial class MasterForm: Form
{
public MasterForm()
{
InitializeComponent();
this.BackgroundImage = Properties.Resources.Image;
}
}
参见此处:Set the same background in all windows forms with a single setting