乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      IP地址輸入框

       小陳 2007-04-05

      在很多Windows應(yīng)用程序上我們都會(huì)用到類似Windows自帶的IP地址輸入框,如下圖所示:

      在.NET中,有很多開發(fā)人員的做法是通過用普通的文本框加正則表達(dá)式的方式來實(shí)現(xiàn)這一功能或者干脆就使用文本框,但是其在方便性和實(shí)用性上很難跟MS系統(tǒng)自己的IP地址框相比。本文章實(shí)現(xiàn)的就是一個(gè)從Windows中“借”來個(gè)一個(gè)文本輸入框,代碼如下:

       

      Imports System.Runtime.InteropServices

      Namespace Forms
          
      Public Class IPTextBox
              
      Inherits System.Windows.Forms.Control

      組件設(shè)計(jì)器生成的代碼

              
      Protected Overrides Sub OnPaint(ByVal pe As System.Windows.Forms.PaintEventArgs)
                  
      MyBase.OnPaint(pe)

                  
      在此添加自定義繪畫代碼
              End Sub


              
      Private Sub IPTextBox_SizeChanged(ByVal sender As ObjectByVal e As System.EventArgs) Handles MyBase.SizeChanged
                  
      If CtlHwnd.Equals(IntPtr.Zero) = False Then User32.SetWindowPos(CtlHwnd, 000Me.Width, Me.Height, &H22)
              
      End Sub


              
      Private CtlHwnd As IntPtr

      Propertys

      Functions

          
      End Class


          
      Public Class User32

              
      <DllImport("user32", EntryPoint:="CreateWindowExA", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
              
      Public Shared Function CreateWindowEx(ByVal dwExStyle As Integer<MarshalAs(UnmanagedType.VBByRefStr)> ByRef lpClassName As String<MarshalAs(UnmanagedType.VBByRefStr)> ByRef lpWindowName As StringByVal dwStyle As IntegerByVal x As IntegerByVal y As IntegerByVal nWidth As IntegerByVal nHeight As IntegerByVal hWndParent As IntPtr, ByVal hMenu As IntPtr, ByVal hInstance As IntPtr, ByVal lpParam As IntPtr) As IntPtr
              
      End Function


              
      <DllImport("user32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
              
      Public Shared Function DestroyWindow(ByVal hwnd As IntPtr) As Integer
              
      End Function


              
      <DllImport("user32", EntryPoint:="SendMessageA", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
              
      Public Shared Function SendMessage(ByVal hwnd As IntegerByVal wMsg As IntegerByVal wParam As IntegerByVal lParam As IntegerAs Integer
              
      End Function

              
      <DllImport("user32", EntryPoint:="SendMessageA", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
              
      Public Shared Function SendMessage(ByVal hwnd As IntPtr, ByVal wMsg As IntegerByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
              
      End Function


              
      <DllImport("user32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
              
      Public Shared Function SetWindowPos(ByVal hwnd As IntPtr, ByVal hWndInsertAfter As IntegerByVal x As IntegerByVal y As IntegerByVal cx As IntegerByVal cy As IntegerByVal wFlags As IntegerAs Integer
              
      End Function


              
      <DllImport("comctl32.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
              
      Public Shared Function InitCommonControlsEx(ByRef TLPINITCOMMONCONTROLSEX As Structures.InitCommonControls) As Integer
              
      End Function


              
       Fields
              Public Const MENU_CLASS As String = "#32768"

              
       Nested Types
              Public Enum Constants
                  ICC_INTERNET_CLASSES 
      = 2048
                  IPM_CLEARADDRESS 
      = 1124
                  IPM_GETADDRESS 
      = 1126
                  IPM_SETADDRESS 
      = 1125
                  WS_CHILD 
      = 1073741824
                  WS_TABSTOP 
      = 65536
                  WS_VISIBLE 
      = 268435456
              
      End Enum


              
      Public Class Structures

                  
      <StructLayout(LayoutKind.Sequential)> _
                  
      Public Structure InitCommonControls
                      
       Fields
                      Public dwICC As Integer
                      
      Public dwSize As Integer
                  
      End Structure


                  
      <StructLayout(LayoutKind.Sequential)> _
                  
      Public Structure WINDOWPOS
                      
       Fields
                      Public cx As Integer
                      
      Public cy As Integer
                      
      Public flags As Integer
                      
      Public hWnd As IntPtr
                      
      Public hWndInsertAfter As IntPtr
                      
      Public x As Integer
                      
      Public y As Integer
                  
      End Structure

              
      End Class


              
      Public Enum WindowsMessages
                  WM_SETFONT 
      = 48
              
      End Enum


          
      End Class


      End Namespace



        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多