在vb.net中定义staticextern函数:用static声明的局部变量。static是C++中常用的修饰符,它被用来控制变量的存贮方式和可见性。extern,C是使C++能够调用C写作的库文件的一个手段。
创新互联建站是专业的海兴网站建设公司,海兴接单;提供成都网站设计、成都网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行海兴网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
'把“Dim graph As Graphics = Me.CreateGraphics”挪到“Button1_Click”事件内,调试过成功!
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim graph As Graphics = Me.CreateGraphics
Dim pen2 As Pen = New Pen(Color.Green, 3)
graph.DrawLine(pen2, 400, 400, 500, 200)
End Sub
End Class
你是用输入法的吧,这个是.Net Framework的Bug吧,用输入法的步骤如下:
1、首先保证文本框有焦点
2、按下2次Ctrl+空格
3、切换到自己要用的输入法
这样一般都可以了
用 vb.net socket通信
Dim th As Threading.Thread
2 Dim tcpl As System.Net.Sockets.TcpListener
3
4 Private Sub Form1_Load()Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
5 th = New System.Threading.Thread(New System.Threading.ThreadStart(AddressOf MyListen))
6 th.Start()
7 End Sub
8
9 Public Sub SendMessage()Sub SendMessage(ByVal IP As String, ByVal SendMsg As String)
10 Try
11 If IP "" Then
12 Dim tcpc As New System.Net.Sockets.TcpClient(IP, 5656)
13 Dim tcpStream As Net.Sockets.NetworkStream = tcpc.GetStream
14 Dim reqStream As New IO.StreamWriter(tcpStream)
15 reqStream.Write(SendMsg)
16 reqStream.Flush()
17 tcpStream.Close()
18 tcpc.Close()
19 End If
20 Catch ex As Exception
21 MsgBox(ex.Message.ToString)
22 End Try
23 End Sub
24 Private Sub MyListen()Sub MyListen()
25 Try
26 Dim ipAddress As System.Net.IPAddress = System.Net.Dns.Resolve(System.Net.Dns.GetHostName).AddressList(0)
27 tcpl = New System.Net.Sockets.TcpListener(ipAddress, 5656)
28 tcpl.Start()
29 While True
30 Dim s As System.Net.Sockets.Socket = tcpl.AcceptSocket()
31 Dim MyBuffer(1024) As Byte
32 Dim i As Integer
33 i = s.Receive(MyBuffer)
34 If i 0 Then
35 Dim lstrRec As String
36 Dim j As Integer
37 For j = 0 To i - 1
38 TextBox1.Text += Chr(MyBuffer(j)) ","
39 Next
40 End If
41 End While
42 Catch ex As Exception
43 MsgBox(ex.Message.ToString)
44 End Try
45 End Sub
46
47 Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
48 SendMessage("192.168.0.61", TextBox2.Text)
49 End Sub
在PictureBox1上画红色的实心圆:
Private Sub DrawCircle(ByVal cp As Point, ByVal radius As Integer, ByVal color As Brush)
Dim gr As Graphics
gr = PictureBox1.CreateGraphics
Dim rect As Rectangle = New Rectangle(cp.X - radius, cp.Y - radius, 2 * radius, 2 * radius)
gr.DrawEllipse(Pens.Black, rect)
gr.FillEllipse(color, rect)
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
DrawCircle(New Point(120, 100), 80, Brushes.Red)
End Sub
1. F12:转到定义;Shift+F12:转到引用
2. F5:启动;Ctrl+F5:开始执行(不调试);Shift+F5:停止调试
3. F7:查看代码;Shift+F7:查看视图设计器
4. Ctrl+Alt+L:解决方案资源管理器
5. Ctrl+Alt+J:对象浏览器
6. F4:显示属性窗口
7. Ctrl+Alt+X:工具箱
8. Ctrl+Alt+C类视图
9. Alt+Enter:查看属性
10.F10:逐过程调试
11.F11:逐语句调试
12.Ctrl+B:新断点
13.Ctrl+Shift+F9:清除所有断点
14.Ctrl+Shift+B生成解决方案
15.Shift+Alt+Enter:全屏
16.大纲显示:Ctrl+M, Ctrl+M:切换大纲显示展开;Ctrl+M, Ctrl+L:切换所有大纲显示;Ctrl+M,Crtl+P停止大纲显示;Ctrl+M, Ctrl+O:折叠到定义
17.智能感知:Ctrl+J:列出成员;Ctrl+Shift+空格:参数信息; Ctrl+K,Ctrl+I:快速信息;Alt+右箭头键:完成单词