Skip to content

IP 地址控件(IPAddress) ​

封装 SysIPAddress32 系统控件,用于输入和显示 IPv4 地址。

枚举 ​

IPATextConstants ​

常量值说明
IPAEmpty0空地址
IPAInvalid-1无效地址

IPAFocusConstants ​

常量值说明
IPAFocusField10第 1 字段
IPAFocusField21第 2 字段
IPAFocusField32第 3 字段
IPAFocusField43第 4 字段

CCAppearanceConstants ​

参见通用枚举。

CCBorderStyleConstants ​

参见通用枚举。

CCMousePointerConstants ​

参见通用枚举。

CCIMEModeConstants ​

参见通用枚举。

CCRightToLeftModeConstants ​

参见通用枚举。

OLEDropModeConstants ​

参见通用枚举。

属性 ​

Text ​

vb
Property Get Text() As IPATextConstants
Property Let Text(ByVal Value As IPATextConstants)

IP 地址的数值表示。IPAEmpty(0)表示空地址,IPAInvalid(-1)表示无效地址。

Field1 ​

vb
Property Get Field1() As Byte
Property Let Field1(ByVal Value As Byte)

第 1 字段值(0-255)。

Field2 ​

vb
Property Get Field2() As Byte
Property Let Field2(ByVal Value As Byte)

第 2 字段值(0-255)。

Field3 ​

vb
Property Get Field3() As Byte
Property Let Field3(ByVal Value As Byte)

第 3 字段值(0-255)。

Field4 ​

vb
Property Get Field4() As Byte
Property Let Field4(ByVal Value As Byte)

第 4 字段值(0-255)。

Field1RangeMin ​

vb
Property Get Field1RangeMin() As Byte
Property Let Field1RangeMin(ByVal Value As Byte)

第 1 字段最小值。默认 0。

Field1RangeMax ​

vb
Property Get Field1RangeMax() As Byte
Property Let Field1RangeMax(ByVal Value As Byte)

第 1 字段最大值。默认 255。

Field2RangeMin ​

vb
Property Get Field2RangeMin() As Byte
Property Let Field2RangeMin(ByVal Value As Byte)

第 2 字段最小值。默认 0。

Field2RangeMax ​

vb
Property Get Field2RangeMax() As Byte
Property Let Field2RangeMax(ByVal Value As Byte)

第 2 字段最大值。默认 255。

Field3RangeMin ​

vb
Property Get Field3RangeMin() As Byte
Property Let Field3RangeMin(ByVal Value As Byte)

第 3 字段最小值。默认 0。

Field3RangeMax ​

vb
Property Get Field3RangeMax() As Byte
Property Let Field3RangeMax(ByVal Value As Byte)

第 3 字段最大值。默认 255。

Field4RangeMin ​

vb
Property Get Field4RangeMin() As Byte
Property Let Field4RangeMin(ByVal Value As Byte)

第 4 字段最小值。默认 0。

Field4RangeMax ​

vb
Property Get Field4RangeMax() As Byte
Property Let Field4RangeMax(ByVal Value As Byte)

第 4 字段最大值。默认 255。

FocusField ​

vb
Property Get FocusField() As IPAFocusConstants
Property Let FocusField(ByVal Value As IPAFocusConstants)

当前焦点字段。

BorderStyle ​

vb
Property Get BorderStyle() As CCBorderStyleConstants
Property Let BorderStyle(ByVal Value As CCBorderStyleConstants)

边框样式。参见通用枚举。

Font ​

vb
Property Get Font() As StdFont
Property Let Font(ByVal NewFont As StdFont)
Property Set Font(ByVal NewFont As StdFont)

字体。

Enabled ​

vb
Property Get Enabled() As Boolean
Property Let Enabled(ByVal Value As Boolean)

是否可用。

BackColor ​

vb
Property Get BackColor() As OLE_COLOR
Property Let BackColor(ByVal Value As OLE_COLOR)

背景颜色。

ForeColor ​

vb
Property Get ForeColor() As OLE_COLOR
Property Let ForeColor(ByVal Value As OLE_COLOR)

前景颜色。

MousePointer ​

vb
Property Get MousePointer() As CCMousePointerConstants
Property Let MousePointer(ByVal Value As CCMousePointerConstants)

鼠标指针样式。参见通用枚举。

MouseIcon ​

vb
Property Get MouseIcon() As IPictureDisp
Property Let MouseIcon(ByVal Value As IPictureDisp)
Property Set MouseIcon(ByVal Value As IPictureDisp)

自定义鼠标图标。

MouseTrack ​

vb
Property Get MouseTrack() As Boolean
Property Let MouseTrack(ByVal Value As Boolean)

是否启用鼠标进入/离开跟踪。

RightToLeft ​

vb
Property Get RightToLeft() As Boolean
Property Let RightToLeft(ByVal Value As Boolean)

从右到左显示方向。

RightToLeftLayout ​

vb
Property Get RightToLeftLayout() As Boolean
Property Let RightToLeftLayout(ByVal Value As Boolean)

从右到左镜像布局。

RightToLeftMode ​

vb
Property Get RightToLeftMode() As CCRightToLeftModeConstants
Property Let RightToLeftMode(ByVal Value As CCRightToLeftModeConstants)

从右到左模式。参见通用枚举。

IMEMode ​

vb
Property Get IMEMode() As CCIMEModeConstants
Property Let IMEMode(ByVal Value As CCIMEModeConstants)

输入法编辑器模式。参见通用枚举。

OLEDropMode ​

vb
Property Get OLEDropMode() As OLEDropModeConstants
Property Let OLEDropMode(ByVal Value As OLEDropModeConstants)

OLE 拖放模式。参见通用枚举。

Appearance ​

vb
Property Get Appearance() As CCAppearanceConstants
Property Let Appearance(ByVal Value As CCAppearanceConstants)

外观样式。参见通用枚举。

hWnd ​

vb
Property Get hWnd() As LongPtr

IP 地址控件的窗口句柄。只读。

ToolTipText ​

vb
Property Get ToolTipText() As String
Property Let ToolTipText(ByVal Value As String)

工具提示文本。

hWndUserControl ​

vb
Property Get hWndUserControl() As LongPtr

用户控件的窗口句柄。只读。

Name ​

vb
Property Get Name() As String

控件名称。只读。

Tag ​

vb
Property Get Tag() As Variant
Property Let Tag(ByVal Value As Variant)
Property Set Tag(ByVal Value As Variant)

自定义数据。

Parent ​

vb
Property Get Parent() As Object

父对象。只读。

Container ​

vb
Property Get Container() As Object
Property Set Container(ByVal Value As Object)

容器对象。

Left ​

vb
Property Get Left() As Single
Property Let Left(ByVal Value As Single)

左边距。

Top ​

vb
Property Get Top() As Single
Property Let Top(ByVal Value As Single)

顶边距。

Width ​

vb
Property Get Width() As Single
Property Let Width(ByVal Value As Single)

宽度(设计时使用)。

Height ​

vb
Property Get Height() As Single
Property Let Height(ByVal Value As Single)

高度(设计时使用)。

Visible ​

vb
Property Get Visible() As Boolean
Property Let Visible(ByVal Value As Boolean)

可见性。

方法 ​

Refresh ​

vb
Sub Refresh()

强制重绘。

Clear ​

vb
Sub Clear()

清除 IP 地址,将所有字段设为空。

SetFocusField ​

vb
Sub SetFocusField(ByVal FocusField As IPAFocusConstants)

设置焦点到指定字段。

AboutBox ​

vb
Sub AboutBox()

显示关于对话框。

事件 ​

Change ​

vb
Event Change()

IP 地址改变时触发。

FieldChange ​

vb
Event FieldChange(ByVal Field As Integer)

指定字段改变时触发。

KeyDown ​

vb
Event KeyDown(KeyCode As Integer, Shift As Integer)

按键按下时触发。

KeyUp ​

vb
Event KeyUp(KeyCode As Integer, Shift As Integer)

按键释放时触发。

KeyPress ​

vb
Event KeyPress(KeyChar As Integer)

按键输入时触发。

Click ​

vb
Event Click()

单击时触发。

DblClick ​

vb
Event DblClick()

双击时触发。

MouseDown ​

vb
Event MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

鼠标按下时触发。

MouseUp ​

vb
Event MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

鼠标释放时触发。

MouseMove ​

vb
Event MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

鼠标移动时触发。

MouseEnter ​

vb
Event MouseEnter()

鼠标进入控件时触发。

MouseLeave ​

vb
Event MouseLeave()

鼠标离开控件时触发。

OLEStartDrag ​

vb
Event OLEStartDrag(Data As DataObject, AllowedEffects As Long)

OLE 拖拽开始时触发。

OLEGiveFeedback ​

vb
Event OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)

OLE 拖拽反馈。

OLESetData ​

vb
Event OLESetData(Data As DataObject, DataFormat As Integer)

OLE 设置数据。

OLECompleteDrag ​

vb
Event OLECompleteDrag(Effect As Long)

OLE 拖拽完成。

OLEDragOver ​

vb
Event OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)

OLE 拖拽经过时触发。

OLEDragDrop ​

vb
Event OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)

OLE 拖放时触发。

代码示例 ​

vb
' 设置 IP 地址(数值形式)
IPAddress1.Text = &H0100007F  ' 127.0.0.1

' 逐字段设置
IPAddress1.Field1 = 192
IPAddress1.Field2 = 168
IPAddress1.Field3 = 1
IPAddress1.Field4 = 100

' 读取 IP 地址
If IPAddress1.Text <> IPAEmpty Then
    MsgBox "IP: " & IPAddress1.Field1 & "." & IPAddress1.Field2 & "." & _
           IPAddress1.Field3 & "." & IPAddress1.Field4
End If

' 设置字段范围限制
IPAddress1.Field1RangeMin = 10
IPAddress1.Field1RangeMax = 192

' 监听变化
Private Sub IPAddress1_FieldChange(ByVal Field As Integer)
    Debug.Print "字段 " & Field & " 已更改"
End Sub

twinBASIC及其LOGO版权为作者"韦恩"所有