所以我做了这个函数,绘制一个带有图片框和图片的“按钮”作为参数。该按钮应该是活跃的时候是蓝色和灰色不活动时,但不知何故机能的研究吸引到按钮上蓝线时,它被认为是不活跃c#绘制函数错误
如何删除蓝线?
void DrawButton(PictureBox PIC, Image IMG)
{
using (Font myFont = new Font("Century Gothic", 11))
{
Bitmap bitmap = new Bitmap(IMG, PIC.Width, PIC.Height);
bitmap.MakeTransparent();
Graphics graph = Graphics.FromImage(bitmap);
// PIC.Tag is "Next"
graph.DrawString(PIC.Tag.ToString(), myFont, Brushes.White, new Point(42, 0));
PIC.Image = bitmap;
graph.Dispose();
}
}
而且我的函数的调用:
private void picNext_MouseLeave(object sender, EventArgs e)
{
if (_CURRENT_PAGE * 12 < DB.GetOnlinePlayers())
DrawButton(picNext, Properties.Resources.play_no_hover);
else DrawButton(picNext, Properties.Resources.play_no_active);
}
private void picNext_MouseUp(object sender, MouseEventArgs e)
{
if (_CURRENT_PAGE * 12 < DB.GetOnlinePlayers())
DrawButton(picNext, Properties.Resources.play_hover);
else DrawButton(picNext, Properties.Resources.play_no_active);
}
private void picNext_MouseDown(object sender, MouseEventArgs e)
{
if (_CURRENT_PAGE * 12 < DB.GetOnlinePlayers())
DrawButton(picNext, Properties.Resources.play_take);
else DrawButton(picNext, Properties.Resources.play_no_active);
}
private void picNext_MouseEnter(object sender, EventArgs e)
{
if (_CURRENT_PAGE * 12 < DB.GetOnlinePlayers())
DrawButton(picNext, Properties.Resources.play_hover);
else DrawButton(picNext, Properties.Resources.play_no_active);
}
这是所有有代码?如果是,你的'Properties.Resources.play_ *'资源是怎么样的? –
你在做什么:Winforms,WPF,ASP ..? __Always__正确标记您的问题! – TaW
@DirkVollmar我添加了一张图片。 – jeaks