新聞中心
VB.NET坐標(biāo)變換
Dim g As Graphics = PictureBox1.CreateGraphics
創(chuàng)新互聯(lián)專注于企業(yè)成都全網(wǎng)營銷推廣、網(wǎng)站重做改版、代縣網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、HTML5、商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)營銷網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為代縣等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
g.TranslateTransform(2, 2) ‘定義原點(diǎn)坐標(biāo)
g.ScaleTransform(1, -1) ’X軸不變,反轉(zhuǎn)Y軸
以PictureBox1中(2,2)點(diǎn)為新的原點(diǎn)(0,0)
向右為X軸正方向 向上為Y軸正方向
vb.net怎么自定義坐標(biāo)系
scale(x1,y1)-(x2,y2)
你只要記住,這里的x1,y1是左上角的坐標(biāo),x2,y2是右下角的坐標(biāo),通過這兩個(gè)點(diǎn)的坐標(biāo)設(shè)定,就可以決定坐標(biāo)原點(diǎn)的位置以及坐標(biāo)軸的方向了,比如
Scale (-300,200)-(300,-200)
以上是把坐標(biāo)原點(diǎn)設(shè)在窗體中心,x軸長600,方向從左到右,y軸長400,方向從下向上。
Scale (800,0)-(0,600)
以上是把坐標(biāo)原點(diǎn)設(shè)在窗體右上角,x軸長800,方向從右到左,y軸長600,方向從上向下。
下面說坐標(biāo)軸和原點(diǎn)的標(biāo)示法:
假定自定義坐標(biāo)設(shè)為:
Scale (-300, 200)-(300, -200)
則
Line (-300, 0)-(300, 0) '畫x軸
Line (0, 200)-(0, -200) '畫y軸
CurrentX = 290
CurrentY = -5
Print "x" '標(biāo)示x軸
CurrentX = 5
CurrentY = 200
Print "y" '標(biāo)示y軸
CurrentX = 5
CurrentY = -5
Print "0" '標(biāo)示原點(diǎn)
怎樣在vb.net的picturebox里畫出坐標(biāo)啊?
自己用GDI+畫的 無論什么什么尺寸的picturebox都行
不過別太小了o(∩_∩)o
代碼放在哪里自己決定啊
最好是放在 picturebox的resize時(shí)間里
每次picturebox大小改變都重畫一次坐標(biāo)
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畫坐標(biāo)系?
坐標(biāo)原點(diǎn)默認(rèn)是左上角,可以改變的,F(xiàn)ORM1.SCALE
(X1,Y1)-(X2,Y2)橫坐標(biāo)范圍是從X1到X2,縱坐標(biāo)是從Y1到Y(jié)2,若坐標(biāo)設(shè)在窗體中間,則FORM1.SCALE
(-ME.WIDTH/2,-ME.HEIGTH/2)-(ME.WIDTH/2,ME.HEIGTH/2),畫橫坐標(biāo)ME.LINE
(-ME.WIDTH/2,0)-(ME.WIDTH/2,0)
畫縱坐標(biāo)FORM1.LINE
(0,-ME.HEIGTH/2,0,ME.HEIGTH/2)
vb.net作業(yè),畫坐標(biāo)軸及標(biāo)尺,畫y=sin(x)曲線
Private Sub mainfrm_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim pt(200) As PointF
Dim a As Integer
For a = 0 To 200
pt(a).X = 50 * a
pt(a).Y = 200 - 50 * Math.Sin(a - 1)
Next
Me.CreateGraphics.DrawLine(Pens.Blue, 0, 200, 800, 200)
Me.CreateGraphics.DrawLine(Pens.Blue, 50, 0, 50, 600)
Me.CreateGraphics.DrawCurve(Pens.Blue, pt)
End Sub
新聞名稱:vb.net畫坐標(biāo)軸 vb怎么建立坐標(biāo)系
本文URL:http://www.ef60e0e.cn/article/doddipo.html