扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
我打开vb2005,给你编了一个,运行通过了,按回车重复执行,按其他键退出,代码如下:
创新互联专注于顺河企业网站建设,响应式网站开发,电子商务商城网站建设。顺河网站建设公司,为顺河等地区提供建站服务。全流程按需策划,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Sub Main()
Randomize()
Do
Dim i As Integer = 10
Dim a(i - 1) As Integer
For j As Integer = 0 To i - 1
a(j) = CRND(300, 400)
Console.WriteLine(a(j).ToString)
Next
Dim mina As Integer = ProcMin(a)
Console.WriteLine(String.Format("最小值:{0}", mina))
Loop While Console.ReadKey.KeyChar = Chr(13)
End Sub
'产生随机数
Private Function CRND(ByVal min As Int32, ByVal max As Int32) As Int32
If max min Then Return min
Return CInt(Int((max - min + 1) * Rnd() + min))
End Function
'获取数组里的最小值
Private Function ProcMin(ByVal a() As Int32) As Int32
Dim tmp As Integer = Int32.MaxValue
For i As Integer = 0 To a.Length - 1
If tmp a(i) Then tmp = a(i)
Next
Return tmp
End Function
假如指定的lisp程序存入"e:\abcd.lsp",其中有函数gczd4-1带有三个参数即(gczd4-1 X1 X2 X3)和命令cc,则VB.NET调用程序如下:
Dim AcadApp As Object
Dim AcadDoc As Object
AcadApp = GetObject(, "AutoCAD.Application")
AcadDoc = AcadApp.ActiveDocument
AcadDoc.SendCommand("(load " Chr(34) "e:\\abcd.lsp" Chr(34) ") ")
AcadDoc.SendCommand("(gczd4-1 " Chr(34) X1 Chr(34) Chr(34) X2 Chr(34) Chr(34) X3 Chr(34) ") ")
AcadDoc.SendCommand("(c:cc) ")
AcadDoc = Nothing
AcadApp = Nothing
新建窗口,添加picture控件
利用line()方法画线
line(开始x坐标,开始y坐标)-(结束x坐标,结束y坐标),线的颜色,画线的方式(默认为线,B为矩形无填充,BF为填充的矩形)
For i = 1 To 16
Picture1.Line (0, Picture1.Height / 2)-(i * (Picture1.Width / 16), 0), RGB(255, 0, 0)
Picture1.Line (0, Picture1.Height / 2)-(i * (Picture1.Width / 16), Picture1.Height), RGB(255, 0, 0)
Picture1.Line (Picture1.Width, Picture1.Height / 2)-(i * (Picture1.Width / 16), 0), RGB(0, 255, 0)
Picture1.Line (Picture1.Width, Picture1.Height / 2)-(i * (Picture1.Width / 16), Picture1.Height), RGB(0, 255, 0)
Next i
如果要在窗口上画也可以调用窗口的line方法即form.line()
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流