有几行代码,有几个小错误。。。请高手帮看下如何修改啊?
本帖最后由 smrt_tony 于 2013-02-01 04:59:44 编辑
一共应该有三个错误,谁能帮指一下如何改啊。。。谢谢。
private void label3_MouseDown(object sender,System.Windows.Forms.MouseEventArgs e)
{
Label aLabel = sender as Label;
Color aColor = aLabel.BackColor;
lblDone.Text = "";
DragDropEffects result =
aLabel.DoDragDrop(aColor, DragDropEffects.None);
if (result != DragDropEffects.All)
{
HowManyDrags--;
lblDragCount.Text = "drag count = " + HowManyDrags.ToString();
}
}
------解决方案--------------------这是我能理解的位置。
我看暂时没什么错。提示一下, HowManyDrags要设置成静态的。
Label aLabel = sender as Label;
if (aLabel != null)
{
Color aColor = aLabel.BackColor;
lblDone.Text = "";
DragDropEffects result =
aLabel.DoDragDrop(aColor, DragDropEffects.None);
if (result != null)
{
if (result != DragDropEffects.All)
{
HowManyDrags--;
lblDragCount.Text = "drag count = " + HowManyDrags.ToString();
}
}
}