WPF - 标签位置不变

时间:2015-10-30 15:52:26

标签: wpf wpf-controls

在表单中托管WPF Custom Control (Label) 更改Label的位置,但始终显示在同一位置。请告诉我如何设置Label的位置。

this.aLb.Margin = new System.Windows.Thickness(0, 0,30, 180);
this.aLb.Height = 30;
this.aLb.Width = 150;
this.aLb.LabelText = "First WPF application";


System.Windows.Forms.Integration.ElementHost host = new System.Windows.Forms.Integration.ElementHost();
host.Dock = System.Windows.Forms.DockStyle.Fill;
host.Child = aLb;
this.panel1.Controls.Add(host);

this.panel1.Location = new System.Drawing.Point(13, 13);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(259,216);        

我的例外是标签显示在面板的顶部。 但标签显示在面板的底部。

0 个答案:

没有答案