GDI

Jdragon 2011-05-26 12:56:29
要怎么改才能自由画笔~高手指点下,


class FreeDraw : ShapeBase
{


public FreeDraw()
{
this.shapeBase = this;
}

public override void Draw(Graphics painter)
{
GraphicsPath Path = new GraphicsPath();

Point leftTop = this.startPoint;

leftTop = new Point(this.startPoint.X,this.startPoint.Y);


Path.AddLine(leftTop,leftTop);


painter.DrawPath(this.pen,Path);
}

}
...全文
63 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
子夜__ 2011-05-30
  • 打赏
  • 举报
回复
private void picBxSketch_Paint(object sender, PaintEventArgs e)
{
int distance = 40;

Pen linePen = new Pen(Color.Red);
for (int i = 1; i <= 4; i++) {
//初始的四条横线,横线建的间距大一些
e.Graphics.DrawLine(linePen, new Point(85, (distance + 10) * i + 30), new Point(240, (distance + 10) * i + 30));//横线
e.Graphics.DrawLine(linePen, new Point(distance * i + 65, 60), new Point(distance * i + 65, 250));//竖线
}}

xuexiaodong2009 2011-05-26
  • 打赏
  • 举报
回复
那就要在pictureBox1的OnPaint(PaintEventArgs e)中调用
Jdragon 2011-05-26
  • 打赏
  • 举报
回复
我是画在pictureBox1中的
am 2011-05-26
  • 打赏
  • 举报
回复
同意楼上的,关键是在 OnPaint(PaintEventArgs e)中调用
ycproc 2011-05-26
  • 打赏
  • 举报
回复
class   drawPoints:Form 
{
private Point m_Start;
private List <Point> m_ListPoint;
public drawPoints()
{
this.DoubleBuffered = true;
m_ListPoint = new List <Point> ();
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
this.m_Start = e.Location;
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (e.Button == MouseButtons.Left)
{
this.m_ListPoint.Add(e.Location);
this.m_Start = e.Location;
this.Invalidate();
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
for (int i = 0; i < this.m_ListPoint.Count-1; i++)
{
e.Graphics.DrawLine(SystemPens.ControlText, this.m_ListPoint[i], this.m_ListPoint[i + 1]);
}
}
}

17,741

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧