包含vb.net绘画实例的词条-成都快上网建站

包含vb.net绘画实例的词条

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怎么重绘?

新建一个Winform,在和Form1平行的位置粘贴如下代码

Public Class MyLabel

Inherits Label

Protected Overrides Sub OnPaint(e As PaintEventArgs)

e.Graphics.DrawEllipse(New Pen(Color.Red), New Rectangle(2, 2, 10, 10))

MyBase.OnPaint(e)

End Sub

End Class

运行,停掉,在工具箱找到MyLabel,拖动就可以看到效果。这只是最基本的重写,要模仿QQ还需要其他技术以及美工。

VB.net 如何画窗体??

绘制和数据分离,就是说,Paint 事件永远是用来绘制的,具体绘制什么东西(也就是绘制的数据,如半径为4的圆),有数据决定,MouseClick 可以更改一些参数,然后由Paint 绘制:

MouseClick 事件里,重绘窗体,即:

int r = 0, x = 0, y = 0;

private void Form1_MouseClick(object sender, MouseEventArgs e)

{

r = 10;

x = e.X;

y = e.Y;

this.Invalidate();

}

private void Form1_Paint(object sender, PaintEventArgs e)

{

// 绘制一个r半径圆

e.Graphics.DrawEllipse(new Pen(Color.Red), x, y, r, r);

}

补充:

在 MouseClick 事件中去调用Form 的 Paint 事件,那么参数要如何传递?

参数是个全局变量,类似上面的r、x、y等,不是由e传过去的,

上述代码是c#的,vb.net和c#一样,都是用的fcl类库,你改一下就可以了,

怎么利用VB.NET实现三维绘图

数学上不是有斜二测画法,算好坐标即可画出

或者用AnyCAD的.Net图形控件

也可以调用matlab 实现

求大神指点 vb.net 怎么绘制一张有文字的图呢?并用 PictureBox1 显示出来

picture本身不是文本控件,文本是“画”上去的,换行需要用代码测量每个字在指定字体下的宽度,判断在当前picture的宽度之下,一行能容纳多少文字,剩下的文字就在下一行绘制。

VB.net中如何画图?

VB.net与VB不同。

VB.net已经有专门绘图的类。

可以定义笔刷然后用Drawing类中的方法绘制。

Private Sub DrawEllipse()

Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)

Dim formGraphics as System.Drawing.Graphics

formGraphics = Me.CreateGraphics()

formGraphics.DrawEllipse(myPen, New Rectangle(0,0,200,300))

myPen.Dispose()

formGraphics.Dispose()

End Sub

Private Sub DrawRectangle()

Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)

Dim formGraphics as System.Drawing.Graphics

formGraphics = Me.CreateGraphics()

formGraphics.DrawRectangle(myPen, New Rectangle(0,0,200,300))

myPen.Dispose()

formGraphics.Dispose()

End Sub


分享文章:包含vb.net绘画实例的词条
URL链接:http://kswjz.com/article/dsspdoi.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流