熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

在 C# 中使用畫筆

2022-06-13   來源: .NET編程 

  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 = canvasPointToScreen(m_Start);
  Point endPoint = canvasPointToScreen(m_End);
  MainForm mainForm = (MainForm)canvas;
  Color bgColor = GetBackgroundColor(m_Color);
  Size rectSize = new Size(m_EndX m_StartX m_EndY m_StartY);
  SystemDrawingRectangle rectToDraw = new SystemDrawingRectangle(startPoint rectSize);
  ControlPaintDrawReversibleFrame(rectToDraw bgColor FrameStyleThick);
  }
  }
From:http://tw.wingwit.com/Article/program/net/201311/13468.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.