C#中在窗体设计中如何实现画一条直线???
C#中在窗体设计中如何实现画一条直线??? c# 窗体设计 直线 --------------------编程问答-------------------- 除 --------------------编程问答-------------------- Graphics g = this.Drawing.CreateGraphics();if (isDrawing)
{
switch (drawTool)
{
case drawTools.Line:
using (Pen p = new Pen(foreColor, 1))
{
graphics.DrawLine(p, startPoint, endPoint);
}
break;
}
} --------------------编程问答-------------------- http://hi.baidu.com/netcoder/item/ea3a73c7499cda7cced4f814 --------------------编程问答-------------------- graphics.DrawLine(p, startPoint, endPoint); --------------------编程问答-------------------- Pen pen=new Pen(Color.Red,1);
PictrueBox picturebox;
Graphics g=Graphics.FromHwnd(picturebox.Handle);
g.DrawLine(p,startPoint,endPoint);
最后要重绘 --------------------编程问答-------------------- 是g.DrawLine(pen,startPoint,endPoint);
少打字了,呵呵
--------------------编程问答-------------------- groupbox不要标题,宽度为一就行 --------------------编程问答-------------------- 在窗体的onPaint事件中 --------------------编程问答-------------------- 在窗体的onPaint事件中
Pen pen=new Pen(Color.Red,1);
PictrueBox picturebox;
Graphics g=Graphics.FromHwnd(picturebox.Handle);
g.DrawLine(p,startPoint,endPoint); --------------------编程问答-------------------- 用panel或者label。设置边框只要一边。边框的宽度设定下。就是一条直线了。 --------------------编程问答-------------------- graphics.DrawLine(new pen(), startPoint, endPoint);
补充:.NET技术 , C#