扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.FillRectangle(new SolidBrush(backColor),0,0,this.Width,this.Height);
e.Graphics.SmoothingMode=SmoothingMode.HighQuality;
e.Graphics.TextRenderingHint=TextRenderingHint.AntiAliasGridFit;
Rectangle rect=new Rectangle(0,0,this.Width,this.Height);
GraphicsPath ClientPath=GetGraphicsPath(rect);
e.Graphics.FillPath(new SolidBrush(backColor),ClientPath);
this.Region=new System.Drawing.Region(ClientPath);
DrawYinYing(e.Graphics,XiaCen);
DrawGaoLiang(e.Graphics,XiaCen);
DrawText(e.Graphics,XiaCen);
if(this.Focused)
{
e.Graphics.DrawPath(new Pen(Color.FromArgb(0x22,0xff,0xff,0xff), 3), ClientPath);
}
}
private void UserControl1_BackColorChanged(object sender, System.EventArgs e)
{
int r=BackColor.R;
int g=BackColor.G;
int b=BackColor.B;
r=r+0x22;
g=g+0x22;
b=b+0x22;
if(r>255) r=255;
if(g>255) g=255;
if(b>255) b=255;
backColor=Color.FromArgb(r,g,b);
}
private void UserControl1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(XiaCen==false && e.KeyCode==Keys.Space)
{
XiaCen=true;
this.Refresh();
}
}
private void UserControl1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(XiaCen==true && e.KeyCode==Keys.Space)
{
XiaCen=false;
this.Refresh();
}
}
private void UserControl1_MouseEnter(object sender, System.EventArgs e)
{
if(mouseMove==false)
{
mouseMove=true;
this.Refresh();
}
}
private void UserControl1_MouseLeave(object sender, System.EventArgs e)
{
if(mouseMove==true)
{
mouseMove=false;
this.Refresh();
}
}
}
}
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者