vb.net怎么绘制带坐标轴的的一次函数?最好附上源码 。1、利用公式求出Y值第一列设置表头为x,下面依次填入取值,比如x1234......第二例表头设置为y,在下面表格中填入计算公式如=2*x 1然后选中点右下角的十字型标记,拖下去,和前面x数量一致 。2、然后选中数据源(即选中要进行操作的数据区域,这里指XY值所在区域 。)3、执行菜单命令插入——图表——XY散点图执行命令,打开图表向导对话框选XY散点图--选平滑线散点图--完成最后使用图表向导在横坐标填入x值,纵坐标填入y值,生成图即可将一次函数的Y列用公式编辑出来,分别填写出当取不同的X值时得到不的函数值 , 选择函数值所在列,插入——图表按提示操作 。执行菜单命令执行菜单命令
怎样在vb.net的picturebox里画出坐标?。?/h2>自己用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.X28, po.Y5, po.X30, po.Y5)
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.Y5)
g.DrawLine(p, po.X, po.Y2, po.X, po.Y)
po.X= (PictureBox1.Width - 100) / 8
Next
PictureBox1.Image = b
vb.net怎么绘制平面直角坐标系创建Graphics对象,可以调用CreateGraphics()直接做图也可以创建Bitmap对象然后调用Graphics.FromBitmap(b)得到Graphics G
G.Clear(Colors.Black)
G.DrawLine(Pens.White, 画线的坐标
如何用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 / 2Label1.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 \ 21 To DPCound
Set oControlx1 = Controls.Add("VB.Line", "lineW"i, Me)
Set oControlx2 = Controls.Add("VB.Line", "lineW"DPCound \ 2 - (i - (DPCound \ 21)), Me)
Set oControly1 = Controls.Add("VB.Line", "lineH"i, Me)
Set oControly2 = Controls.Add("VB.Line", "lineH"DPCound \ 2 - (i - (DPCound \ 21)), 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 / 260
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 / 260
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 / 260
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 / 260
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 = PixID1
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 / 2CInt(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 PixID0 Then
If MsgBox("确实要清空所有标注点吗?", vbOKCancelvbInformationvbDefaultButton2vbMsgBoxSetForegroundvbSystemModal, "信息!") = 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.net在picture.box里面画坐标图的TranslateTransform方法是用来平移对象的 。如果你学过计算机图形学,有个偏移矩阵 , 就是它了 。
你只要知道TranslateTranform(0,240)表示把图形移动到当前位置 (0,240)的地方就行了 。
ScaleTransform用于缩放对象,1,1的话表示大小不变 。
【vb.net繪座標圖 vb中坐标怎么写】vb.net繪座標圖的介绍就聊到这里吧 , 感谢你花时间阅读本站内容,更多关于vb中坐标怎么写、vb.net繪座標圖的信息别忘了在本站进行查找喔 。
推荐阅读
- u盘中文件怎么排顺序,u盘中文件怎么排顺序的
- 武威sap软件运维,sap运维培训
- 兰花直播设备,兰花直播怎么介绍好
- java设计字体的代码 java中怎么设置字体大小代码
- linux命令批量执行,linux可执行文件批量执行
- 怎么用excel建立账薄,excel如何建账
- b站完成直播任务怎么完成,b站直播任务在哪里
- python的引用函数 python引用函数库的保留字
- 手机怎么控制路由器的开关,手机怎么控制路由器的开关机