3 回答

TA貢獻1866條經(jīng)驗 獲得超5個贊
嘗試Resize您的用戶控件的事件:
public UserControl1()
{
InitializeComponent();
this.Resize += UserControl1_Resize;
}
private void UserControl1_Resize(object sender, EventArgs e)
{
if (this.Width > 600)
...
}

TA貢獻1871條經(jīng)驗 獲得超13個贊
當寬度改變時,我設(shè)法改變了 AnchorStyle?,F(xiàn)在我不想在重新調(diào)整大小時將 Anchor Style 放回去。但我無法獲得正確的后退大小代碼。這是我的完整代碼。
static string Xpos = 348;
private void UControl_Resize(object sender, EventArgs e)
{
Main OP = (Main)ParentForm;
if (this.Width > 699)
{
this.Anchor = AnchorStyles.None;
this.Anchor = (AnchorStyles.Bottom | AnchorStyles.Top);
}
else if (OP.ucControl.Location = Xpos) //This bit doesn't work
{
this.Anchor = (AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left);
}
}

TA貢獻1794條經(jīng)驗 獲得超7個贊
為什么當我這樣做時,我所有的錨點都停止工作了?我知道我正在指定新的寬度,因為我需要它。有什么建議么?
if (this.WindowState == FormWindowState.Normal)
{
ucChat.FlowChat.Size = new Size(323, 276);
ucChat.FlowChat.Left = (ucChat.ClientSize.Width - ucChat.FlowChat.Width) / 2;
ucChat.FlowChat.Anchor = (AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left);
}
- 3 回答
- 0 關(guān)注
- 143 瀏覽
添加回答
舉報