在 C# 中使用画笔

发表于:2007-05-25来源:作者:点击数: 标签:画笔publicRectangleclass使用
public class Rectangle : Shape { protected Point m_Start; protected Point m_End; public Rectangle(Point start, Point end, Color fgColor) { m_Start = start; m_End = end; m_Color = fgColor; } public override void Draw(Form canvas) { if (canv
public class Rectangle : Shape
{
protected Point m_Start;
protected Point m_End;
public Rectangle(Point start, Point end, Color fgColor)
{
m_Start = start;
m_End = end;
m_Color = fgColor;
}
public override void Draw(Form canvas)
{
if (canvas == null)
{
return;
}
InitializeGraphics(canvas);
Point startPoint = canvas.PointToScreen(m_Start);
Point endPoint = canvas.PointToScreen(m_End);
MainForm mainForm = (MainForm)canvas;
Color bgColor = GetBackgroundColor(m_Color);
Size rectSize = new Size(m_End.X - m_Start.X, m_End.Y - m_Start.Y);
System.Drawing.Rectangle rectToDraw = new System.Drawing.Rectangle(startPoint, rectSize);
ControlPaint.DrawReversibleFrame(rectToDraw, bgColor, FrameStyle.Thick);
}
}

作者:jspfuns(原创)

原文转自:http://www.ltesting.net

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)