用vb.net画坐标轴 vb坐标系统-成都快上网建站

用vb.net画坐标轴 vb坐标系统

vb.net怎么绘制平面直角坐标系

创建Graphics对象,可以调用CreateGraphics()直接做图也可以创建Bitmap对象然后调用Graphics.FromBitmap(b)得到Graphics G

发展壮大离不开广大客户长期以来的信赖与支持,我们将始终秉承“诚信为本、服务至上”的服务理念,坚持“二合一”的优良服务模式,真诚服务每家企业,认真做好每个细节,不断完善自我,成就企业,实现共赢。行业涉及混凝土泵车等,在成都网站建设营销型网站、WAP手机网站、VI设计、软件开发等项目上具有丰富的设计经验。

G.Clear(Colors.Black)

G.DrawLine(Pens.White, 画线的坐标

怎样在vb.net的picturebox里画出坐标啊?

自己用GDI+画的 无论什么什么尺寸的picturebox都行

不过别太小了o(∩_∩)o

代码放在哪里自己决定啊

最好是放在 picturebox的resize时间里

每次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实现坐标图

太好玩啦~~~~~哈哈 终于完工啦

窗体上放一个textbox 两条line 一个label 代码粘贴 运行 即见效果

'*************************************************************************

'**工程名称:平面座标

'**说 明:小鸟工作室 版权所有2007 - 2008(C)1

'**创 建 人:秋色烽火

'**日 期:2007-12-18 14:08:15

'**版 本:V1.0.0

'*************************************************************************

Const DPITCH = 300 '点距

Dim WithEvents oControlx1 As Line

Dim WithEvents oControlx2 As Line

Dim WithEvents oControly1 As Line

Dim WithEvents oControly2 As Line

Dim WithEvents oControlShape As Shape

Dim WithEvents oControlPixinfo As Label

Dim DPCound%, PixID%, PixBackColor, dotx%, doty%

Private Sub Form_Load()

Me.Caption = "平面座标 - by 秋色烽火[小鸟工作室]"

Me.Height = 9300

Me.Width = 9300

Line1.X1 = 150

Line1.X2 = Me.Width - 150

Line1.Y1 = Me.Height / 2

Line1.Y2 = Line1.Y1

Line2.Y1 = 150

Line2.Y2 = Me.Height - 150

Line2.X1 = Me.Width / 2

Line2.X2 = Line2.X1

Label1.Width = 255

Label1.Height = 255

Label1.AutoSize = ture

Label1.BackStyle = 0

Label1.FontItalic = True

Label1.FontBold = True

Label1.FontSize = 10

Label1.ForeColor = HFF

Label1.Caption = "O"

Label1.Left = Me.Width / 2 + Label1.Width - 100

Label1.Top = Me.Height / 2 - Label1.Height

Text1.Text = ""

Call AddLine

Text1.ToolTipText = "请输入整数座标(x,y) 中间用英文逗号分隔~~~,双击文本框或回车开始标注" vbCrLf " 右击显示帮助信息 " vbCrLf "输入座标请介乎于" DPCound \ 2 "至" -1 * DPCound \ 2 "之间~~"

PixID = 0

End Sub

Sub AddLine()

DPCound = (Me.Width - 300) / DPITCH - 2

For i = DPCound \ 2 + 1 To DPCound

Set oControlx1 = Controls.Add("VB.Line", "lineW" i, Me)

Set oControlx2 = Controls.Add("VB.Line", "lineW" DPCound \ 2 - (i - (DPCound \ 2 + 1)), Me)

Set oControly1 = Controls.Add("VB.Line", "lineH" i, Me)

Set oControly2 = Controls.Add("VB.Line", "lineH" DPCound \ 2 - (i - (DPCound \ 2 + 1)), Me)

With oControlx1

.Visible = True '显示

.X1 = Me.Width / 2 + (i - DPCound \ 2) * DPITCH

.X2 = Me.Width / 2 + (i - DPCound \ 2) * DPITCH

.Y1 = Me.Height / 2 - 60

.Y2 = Me.Height / 2 + 60

End With

With oControlx2

.Visible = True '显示

.X1 = Me.Width / 2 - (i - DPCound \ 2) * DPITCH

.X2 = Me.Width / 2 - (i - DPCound \ 2) * DPITCH

.Y1 = Me.Height / 2 - 60

.Y2 = Me.Height / 2 + 60

End With

With oControly1

.Visible = True '显示

.Y1 = Me.Height / 2 + (i - DPCound \ 2) * DPITCH

.Y2 = Me.Height / 2 + (i - DPCound \ 2) * DPITCH

.X1 = Me.Width / 2 - 60

.X2 = Me.Width / 2 + 60

End With

With oControly2

.Visible = True '显示

.Y1 = Me.Height / 2 - (i - DPCound \ 2) * DPITCH

.Y2 = Me.Height / 2 - (i - DPCound \ 2) * DPITCH

.X1 = Me.Width / 2 - 60

.X2 = Me.Width / 2 + 60

End With

Next

End Sub

Sub AddPix()

If InStr(Text1.Text, ",") 0 Then

If IsNumeric(Mid$(Text1.Text, 1, InStr(Text1.Text, ",") - 1)) And IsNumeric(Mid$(Text1.Text, InStr(Text1.Text, ",") + 1, Len(Text1.Text))) Then

If CInt(Mid$(Text1.Text, 1, InStr(Text1.Text, ",") - 1)) = DPCound \ 2 And CInt(Mid$(Text1.Text, 1, InStr(Text1.Text, ",") - 1)) = -1 * DPCound \ 2 Then

PixID = PixID + 1

Set oControlShape = Controls.Add("VB.Shape", "Pix" PixID, Me)

Set oControlPixinfo = Controls.Add("VB.Label", "Pixinfo" PixID, Me)

With oControlShape

.Visible = True '显示

.Shape = 3

'.BorderColor = HFF

.BackColor = HFF 'RGB(Int(Rnd * 255), Int(Rnd * 255), Int(Rnd * 255)) 'HFF

.BackStyle = 1

.BorderStyle = 0

.Width = 75

.Height = 75

.Left = Me.Width / 2 + CInt(Mid$(Text1.Text, 1, InStr(Text1.Text, ",") - 1)) * DPITCH

.Top = Me.Height / 2 - CInt(Mid$(Text1.Text, InStr(Text1.Text, ",") + 1, Len(Text1.Text))) * DPITCH

dotx = .Left

doty = .Top

PixBackColor = .BackColor

End With

With oControlPixinfo

.Visible = True '显示

.BackStyle = 0

' .FontItalic = True

'.FontBold = True

.FontSize = 9

.ForeColor = HFF 'PixBackColor 'HFF

.Caption = "[" PixID "]" CStr(CInt(Mid$(Text1.Text, 1, InStr(Text1.Text, ",") - 1))) "," CInt(Mid$(Text1.Text, InStr(Text1.Text, ",") + 1, Len(Text1.Text)))

.Width = 1000

.Height = 255

.Left = dotx

.Top = doty - .Height

.AutoSize = ture

End With

Text1.Text = ""

Else

MsgBox "输入座标请介乎于" DPCound \ 2 "至" -1 * DPCound \ 2 "之间~~", , "错误"

Text1.Text = ""

End If

Else

MsgBox "座标请使用数字输入", , "错误"

Text1.Text = ""

End If

Else

MsgBox "输入的座标请使用英文逗号 , 进行分隔", , "错误"

Text1.Text = ""

End If

End Sub

Sub init()

If PixID 0 Then

If MsgBox("确实要清空所有标注点吗?", vbOKCancel + vbInformation + vbDefaultButton2 + vbMsgBoxSetForeground + vbSystemModal, "信息!") = vbOK Then

For i = 1 To PixID

Controls.Remove "Pix" i

Controls.Remove "Pixinfo" i

Next

PixID = 0

End If

End If

End Sub

Private Sub Text1_DblClick()

Call AddPix

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then

Call AddPix

End If

End Sub

Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 2 Then

MsgBox "请输入整数座标(x,y) 中间用英文逗号分隔~~~,双击文本框或回车开始标注" vbCrLf "输入座标请介乎于" DPCound \ 2 "至" -1 * DPCound \ 2 "之间~~" vbCrLf "中键清空所有创建的座标", , "帮助"

End If

If Button = 4 Then

Call init

End If

End Sub

'好玩的东东

'****************************

'如果加上下面的就好罗

'定时设为500

'Dim a, b As Integer

'a = 14

'b = 14

'Private Sub Timer1_Timer()

'Text1.Text = a "," b

'a = a - 1

'b = b - 1

'Call Text1_KeyDown(13, 1)

'End Sub

'***************************

vb如何画常规坐标系?

使用Picturebox。

使用Picturebox来比较合适,picture1.scale (x1,y1)-(x2,y2)。

(x1,y1):定义的左上角坐标值

(x2,y2):定义的右下角坐标值

Frame只能当容起诉来用,picture控件比较适合。不过习惯了计算机绘画作图的人都是喜欢从屏幕左上角开始第四象限坐标系的.,单位也喜欢用像素。

可以考虑使用图表控件,比如MSCHART或者TEECHART控件,可以减少一定的工作量,MSCHART是VB6自带的控件,在组件项里找一下加上去就可以了,TEECHART是TEEMA公司出品的控件,网上有破解版,如果图形不复杂使用5.0版即可。

如何用vb画坐标系?

坐标原点默认是左上角,可以改变的,FORM1.SCALE

(X1,Y1)-(X2,Y2)横坐标范围是从X1到X2,纵坐标是从Y1到Y2,若坐标设在窗体中间,则FORM1.SCALE

(-ME.WIDTH/2,-ME.HEIGTH/2)-(ME.WIDTH/2,ME.HEIGTH/2),画横坐标ME.LINE

(-ME.WIDTH/2,0)-(ME.WIDTH/2,0)

画纵坐标FORM1.LINE

(0,-ME.HEIGTH/2,0,ME.HEIGTH/2)

vb.net怎么自定义坐标系

scale(x1,y1)-(x2,y2)

你只要记住,这里的x1,y1是左上角的坐标,x2,y2是右下角的坐标,通过这两个点的坐标设定,就可以决定坐标原点的位置以及坐标轴的方向了,比如

Scale (-300,200)-(300,-200)

以上是把坐标原点设在窗体中心,x轴长600,方向从左到右,y轴长400,方向从下向上。

Scale (800,0)-(0,600)

以上是把坐标原点设在窗体右上角,x轴长800,方向从右到左,y轴长600,方向从上向下。

下面说坐标轴和原点的标示法:

假定自定义坐标设为:

Scale (-300, 200)-(300, -200)

Line (-300, 0)-(300, 0) '画x轴

Line (0, 200)-(0, -200) '画y轴

CurrentX = 290

CurrentY = -5

Print "x" '标示x轴

CurrentX = 5

CurrentY = 200

Print "y" '标示y轴

CurrentX = 5

CurrentY = -5

Print "0" '标示原点


文章题目:用vb.net画坐标轴 vb坐标系统
浏览地址:http://kswjz.com/article/docisip.html
扫二维码与项目经理沟通

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

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