重绘 提示 DockedBarControl Dev控件

 

 

 

 

重绘 提示 DockedBarControl  Dev控件

 

void dockedBarControl_Paint(object sender, PaintEventArgs e)
{
if (_unreadAmount > 0)
{
Graphics g = e.Graphics;
g.CompositingMode = CompositingMode.SourceOver;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.SmoothingMode = SmoothingMode.AntiAlias;
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);//画刷
g.FillEllipse(myBrush, new Rectangle(barDockControlBottom.Controls[0].Right - 25, 0, 20, 20));
Font font = new Font("华为宋体", 8);
SizeF sim = g.MeasureString(_unreadAmount + "", font);
PointF point = new PointF(barDockControlBottom.Controls[0].Right - ((29 + sim.Width) / 2), 4);
if (_unreadAmount >= 100)
{
g.DrawString("99+", font, Brushes.White, point);
}
else
{
g.DrawString(_unreadAmount + "", font, Brushes.White, point);
}
}
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

public void BarBtnInfoRefresh()
{
try
{
lock (asyncLockBtnInfoRefresh)
{
_unreadAmount = _mMessageService.GetUnreadMessageAmount(Variables.LoginUser.UserID);
DockedBarControl dockedBarControl = barDockControlBottom.Controls[0] as DockedBarControl;
if (dockedBarControl != null)
{
dockedBarControl.Invalidate();
}
}
}
catch (Exception ex)
{
WriteExceptionLog(ex);
}
}

上一篇:C# 生成海报,文本区域指定和换行,图片合成


下一篇:CF573C Bear and Drawing 构造+树论