c#上的PictureBox跟着鼠标移动,结果有时动有时不动
代码如下,是从网上看到的:boolleftFlag;privatevoidpbRbing1_MouseDown(objectsender,MouseEventArgse)...
代码如下,是从网上看到的:
bool leftFlag;
private void pbRbing1_MouseDown(object sender, MouseEventArgs e)
{
leftFlag = true;
}
private void pbRbing1_MouseMove(object sender, MouseEventArgs e)
{
if (leftFlag==true)
{
pbRju1.Location = new Point(MousePosition.X,MousePosition.Y);
}
}
private void pbRbing1_MouseUp(object sender, MouseEventArgs e)
{
if (leftFlag == true)
{
leftFlag = false;
}
} 展开
bool leftFlag;
private void pbRbing1_MouseDown(object sender, MouseEventArgs e)
{
leftFlag = true;
}
private void pbRbing1_MouseMove(object sender, MouseEventArgs e)
{
if (leftFlag==true)
{
pbRju1.Location = new Point(MousePosition.X,MousePosition.Y);
}
}
private void pbRbing1_MouseUp(object sender, MouseEventArgs e)
{
if (leftFlag == true)
{
leftFlag = false;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询