日期:2014-05-17 浏览次数:21163 次
// 绘制背景 用来总体控制背景的绘制
private void DrawBackImg()
{
Bitmap bit = new Bitmap(this.Width, this.Height);
Graphics gp = Graphics.FromImage(bit);
gp.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
#region 在这里可以扩展需要绘制的背景项目
//外框
drawFrame(gp);
// 画刻度
DrawRuling(gp);
//画点
drawPoint(gp);
//绘制单位
DrawUnitStr(gp);
#endregion
//当绘制完成后,直接直接设置为背景
this.BackgroundImage = bit;
}
//绘制单位
private void DrawUnitStr(Graphics gp)
{
int cer = _diameter / 2;
gp.DrawString(_unitStr, new Font("宋体", 10), new SolidBrush(_frameColor), new PointF(cer, (float)(cer - cer * 0.3)), strFormat);
}
/// <summary>
/// 画外框
/// </summary>
/// <param name="gp"></param>
private void drawFrame(Graphics gp)
{
Pen pen