如题,写的是一个判断光标位置的函数
问题在于他的backgroundimageChange事件会触发,
确认图片有效,且没有逻辑错误,
但是显示出的效果始终没有变化
以下为代码
public void icon_bgset(int Mouse_X,int Mouse_Y)
{
//取坐标
int FrmX = locationX + deskTop.DeskTopLocation.X + 8;
int FrmY = locationY + deskTop.DeskTopLocation.Y + 30;
int FrmWidth = this.Width;
int FrmHeight = this.Height;
//判断鼠标位置
if ((Mouse_X >= FrmX && Mouse_X <= FrmX + FrmWidth) && (Mouse_Y >= FrmY && Mouse_Y <= FrmY + FrmHeight))
{
deskTop.plans = 1;//光标在icon界面时候
}
else
{
deskTop.plans = 0;//离开icon的时候
}
switch (deskTop.plans)
{
case 1:
if (this.BackgroundImage == null)
{
//Image winBackimg = Image.FromFile(Application.StartupPath + "\\img0.jpg");
Bitmap spp = new Bitmap(Application.StartupPath + "\\BKGD.png");
this.BackgroundImage = spp;
DeskIcon.Icon_ISIN = true;
}
break;
case 0:
if (this.BackgroundImage != null)
{
this.BackgroundImage = null;
DeskIcon.Icon_ISIN = false;
}
break;
}
}