在vb.net中定義staticextern函數(shù):用static聲明的局部變量。static是C++中常用的修飾符,它被用來控制變量的存貯方式和可見性。extern,C是使C++能夠調用C寫作的庫文件的一個手段。
創(chuàng)新互聯(lián)建站是專業(yè)的海興網(wǎng)站建設公司,海興接單;提供成都網(wǎng)站設計、成都網(wǎng)站建設,網(wǎng)頁設計,網(wǎng)站設計,建網(wǎng)站,PHP網(wǎng)站建設等專業(yè)做網(wǎng)站服務;采用PHP框架,可快速的進行海興網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!
'把“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:開始執(zhí)行(不調試);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+空格:參數(shù)信息; Ctrl+K,Ctrl+I:快速信息;Alt+右箭頭鍵:完成單詞