请问怎样在一个picturebox 上画一条直线?

tuery 2003-07-30 07:13:12
例如以下是VB.NET的:
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox

怎样在PictureBox1上画一条直线呢?
...全文
49 3 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
tuery 2003-07-31
  • 打赏
  • 举报
回复
up
howtofind 2003-07-30
  • 打赏
  • 举报
回复
snof(雪狼):
那怎样把Graphics g里的内容贴到picturebox上?
雪狼1234567 2003-07-30
  • 打赏
  • 举报
回复
改一下就好:
Graphics g;
//Create a pen 20 pixels wide that is and purple and partially transparent.
Pen penExample = new Pen(Color.FromArgb(150, Color.Purple), 20);
//Make it a dashed pen.
Pen penExample.DashStyle = DashStyle.Dash;
//Make the ends round.
Pen penExample.StartCap = LineCap.Round;
Pen penExample.EndCap = LineCap.Round;

//Now draw a curve using the pen.
g.DrawCurve(penExample, new Point[] {
new Point(200, 140),
new Point(700, 240),
new Point(500, 340),
new Point(140, 140),
new Point(40, 340),
});


Dim g As Graphics
' Create a pen 20 pixels wide that is and purple and partially transparent.
Dim penExample As New Pen(Color.FromArgb(150, Color.Purple), 20)
' Make it a dashed pen.
Dim penExample.DashStyle As Pen = DashStyle.Dash
' Make the ends round.
Dim penExample.StartCap As Pen = LineCap.Round
Dim penExample.EndCap As Pen= LineCap.Round

' Now draw a curve using the pen
g.DrawCurve(penExample, New Point() { _
New Point(200, 140), _
New Point(700, 240), _
New Point(500, 340), _
New Point(140, 140), _
New Point(40, 340), _
})

发帖
C#

10.9w+

社区成员

.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
帖子事件
创建了帖子
2003-07-30 07:13
社区公告

让您成为最强悍的C#开发者