vb.net画线条 vb中用line方法画直线

在vbnet中,我在picturebox里面画线,用滚动条拉动picturebox显示最新画出的图vb.net没有自动重画功能,要在Paint事件中写代码对图形重画 。
另外一种情况,如果在Image属性设置了一幅图像,图像能够保持完整性的 。所以你可以把图形绘在位图上,把位图绑定到Image属性上 。
先绑定一幅位图:
Dim bm as New BitMap(800,600)
PictureBox1.Image=bm
作图时不是对图片框,而是在位图上作图 。
dim gr As Grapthics=Graphics.FromImage(bm) '建立位图的绘图设备
接下来就可用gr 的绘图方法作图
作完图,PictureBox1.Refresh 刷新一下 。
如何通过vb.net WinForm窗体上画线条或弧线,让用户可以用鼠标捕捉(选中)已画的线条 。代码写起来可能比较麻烦vb.net画线条,给vb.net画线条你个思路 , 就是用GraphicsPath来绘制,然后通过绘制目标vb.net画线条的鼠标移动事件来获取当前鼠标在绘制目标中的实际位置,再通过GraphicsPath的IsVisible()方法来确认鼠标是否包含在GraphicsPath中 。
【vb.net画线条 vb中用line方法画直线】DrawLine直线比较容易处理,只要得到Line的坐标点,然后比较当前鼠标坐标就好 。
VB.net中如何在picturebox画线,有什么函数?Dim b As New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim g As Graphics = Graphics.FromImage(b)
g.Clear(Color.White)
Dim p As New Pen(Color.Black)
p.EndCap = Drawing2D.LineCap.ArrowAnchor
g.DrawLine(p, 30, PictureBox1.Height - 30, 30, 30)
g.DrawLine(p, 30, PictureBox1.Height - 30, PictureBox1.Width - 30, PictureBox1.Height - 30)
Dim i As Integer
Dim bs As New SolidBrush(Color.Green)
Dim po As New Point
po.X = 0
po.Y = PictureBox1.Height - 35
For i = 700 To 1000 Step 50
g.DrawString(i, Me.Font, bs, po.X, po.Y)
g.DrawLine(p, po.X + 28, po.Y + 5, po.X + 30, po.Y + 5)
po.Y -= (PictureBox1.Height - 100) / 6
Next
po.X = 30
po.Y = PictureBox1.Height - 30
For i = 0 To 40 Step 5
g.DrawString(i, Me.Font, bs, po.X, po.Y + 5)
g.DrawLine(p, po.X, po.Y + 2, po.X, po.Y)
po.X += (PictureBox1.Width - 100) / 8
Next
PictureBox1.Image = b
怎么用VB 。net 画直线dim bmp as new bitmap(width,height)dim g as graphics=graphics.fromimage(bmp)g.drawlines(pen.blue,20,20,100,20)backgroundimage=bmp
VB.NET 画直线 问题 怎样让直线置顶(就是不被其它控件覆盖) 100分(希望详细些)如较麻烦,会追加分数这个必须用控件的方法解决,VB6有个Line控件很容易解决这个问题,但是VB.NET没有了 , 幸好微软也想到了这个缺陷 , 提供免费的Visual Basic PowerPacks控件箱,其中有Line控件 。
Visual Basic PowerPacks下载地址:
使用 LineShape 控件绘制直线:
vb.net绘制曲线图 。net其实还是很好绘制图形的
你可以看下 Graphics类
Dim d As New Bitmap(Me.Width, Me.Height)‘一个图片吧
Dim g As Graphics = Graphics.FromImage(d)’绘制准备在这个图片是进行
然后就是你绘制的东西了
线 就是g.DrawLine()
圆 弧度就用g.DrawArc(Pens.Black, New Rectangle(0, 0, 400, 200), 0, 360)
复杂的就是g.DrawBezier()
等如果你用的是 VS的编译上面都有详细的参数说明
Dim d As New Bitmap(Me.Width, Me.Height)
Dim g As Graphics = Graphics.FromImage(d)
g.DrawArc(Pens.Black, New Rectangle(0, 0, 200, 200), 0, 360)
g.DrawLine(Pens.Red, New Point(0, 0), New Point(200, 200))
g.DrawLines(Pens.Green, New Point() {New Point(0, 0), New Point(50, 40), New Point(50, 80), New Point(90, 70), New Point(100, 400)})
g.DrawBezier(Pens.Yellow, New Point(0, 100), New Point(0, 0), New Point(200, 0), New Point(200, 200))
g.Dispose()
Me.BackgroundImage = d

推荐阅读