【发布时间】:2015-10-28 20:33:12
【问题描述】:
我正在使用 WinForms。在我的表单中,我有一个按钮和一个面板。当我单击该按钮时,我想将面板向右滑动。我的代码有问题。目前我在下面收到红色错误线
= panel2.Location.X + 1;
Error Message: Cannot implicitly convert type int to System.Drawing.Point
我尝试使用与扩展面板类似的方法来移动面板。我在我的代码中提供了这一点。如何移动面板?
private void btn_Right_Click(object sender, EventArgs e)
{
// Make Panel Grow
//while (panel1.Width < 690)
//{
// panel1.Width = panel1.Width + 1;
//}
while (panel2.Location.X < 690)
{
panel2.Location = panel2.Location.X + 1;
}
}
【问题讨论】:
-
那么红色的错误是什么意思..?我们不是这里的读者..
-
您正在尝试将 int 分配给 Point
-
抱歉,错误:无法将 int 类型隐式转换为 System.Drawing.Point @MethodMan
-
为什么不做如下
panel2.Location = new Point(x,y);
标签: c# .net winforms panel move