在vb中实现真正锁定的带自定义菜单的文本控件(2)
2008-04-10 03:07:12来源:互联网 阅读 ()
Call PropBag.WriteProperty("Read", ReadOnly, False)
Call PropBag.WriteProperty("Enabled", Enabled, True)
''''Call PropBag.WriteProperty("MultiLine", MultiLine, False)
''''Call PropBag.WriteProperty("ScrollBars", ScrollBars, 0)
End Sub
Private Sub uTextBox_Click()
RaiseEvent Click
End Sub
Private Sub uTextBox_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 And m_Read = True Then
OldWindowProc = GetWindowLong(uTextBox.hWnd, GWL_WNDPROC)
'''' 取得窗口函数的地址
Call SetWindowLong(uTextBox.hWnd, GWL_WNDPROC, AddressOf SubClass_WndMessage)
'''' 用SubClass_WndMessage代替窗口函数处理消息
End If
End Sub
Private Sub uTextBox_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 And m_Read = True Then
Call SetWindowLong(uTextBox.hWnd, GWL_WNDPROC, OldWindowProc)
'''' 恢复窗口的默认函数
'''' 弹出自定义菜单
If Not m_Menu Is Nothing Then
If TypeOf m_Menu Is Menu Then
PopupMenu m_Menu
End If
End If
End If
End Sub
Private Sub UserControl_Resize()
With UserControl
uTextBox.Move .ScaleLeft, .ScaleTop, .ScaleWidth, .ScaleHeight
End With
End Sub
Public Property Let BackColor(ByVal vNewValue As OLE_COLOR)
Let m_BackColor = vNewValue
Let uTextBox.BackColor = vNewValue
Let UserControl.BackColor = vNewValue
End Property
Public Property Get BackColor() As OLE_COLOR
Let BackColor = m_BackColor
End Property
Public Property Let Text(ByVal vNewValue As String)
Let uTextBox.Text = vNewValue
End Property
Public Property Get Text() As String
Let Text = uTextBox.Text
End Property
Public Property Let Alignment(ByVal vNewValue As VBRUN.AlignmentConstants)
Let m_TextAlig = vNewValue
Let uTextBox.Alignment = vNewValue
End Property
Public Property Get Alignment() As VBRUN.AlignmentConstants
Let Alignment = m_TextAlig
End Property
Public Property Let ReadOnly(ByVal vNewValue As Boolean)
Let m_Read = vNewValue
Let uTextBox.Locked = vNewValue
End Property
Public Property Get ReadOnly() As Boolean
Let ReadOnly = m_Read
End Property
Private Sub uTextBox_Change()
RaiseEvent Change
End Sub
Public Property Set Menu(ByRef vNewValue As Menu)
Set m_Menu = vNewValue
End Property
Public Property Get Menu() As Menu
Set Menu = m_Menu
End Property
Public Property Let MaxLength(ByVal vNewValue As Integer)
Let m_MaxLength = vNewValue
Let uTextBox.MaxLength = vNewValue
End Property
Public Property Get MaxLength() As Integer
Let MaxLength = m_MaxLength
End Property
Public Property Let SelLength(ByVal vNewValue As Integer)
''''Let m_SelLength = vNewValue
Let uTextBox.SelLength = vNewValue
End Property
Public Property Get SelLength() As Integer
Let SelLength = uTextBox.SelLength
End Property
Public Property Let SelStart(ByVal vNewValue As Integer)
Let uTextBox.SelStart = vNewValue
End Property
Public Property Get SelStart() As Integer
Let SelStart = uTextBox.SelStart
End Property
Public Property Let SelText(ByVal vNewValue As String)
Let uTextBox.SelText = vNewValue
End Property
Public Property Get SelText() As String
Let SelText = uTextBox.SelText
End Property
''''Public Property Let MulitLine(ByVal vNewValue As Boolean)
'''' Let uTextBox.MultiLine = vNewValue
''''End Property
''''Public Property Get MultiLine() As Boolean
'''' Let MulitLine = uTextBox.MulitLine
''''End Property
''''Public Property Let ScrollBars(ByVal vNewValue As VBRUN.ScrollBarConstants)
'''' Let uTextBox.ScrollBars = vNewValue
''''End Property
''''Public Property Get ScrollBars() As VBRUN.ScrollBarConstants
'''' Let ScrollBars = uTextBox.ScrollBars
''''End Property
Public Property Let Enabled(ByVal vNewValue As Boolean)
Let m_Enabled = vNewValue
Let uTextBox.Enabled = vNewValue
Let UserControl.Enabled = vNewValue
End Property
Public Property Get Enabled() As Boolean
Let Enabled = m_Enabled
End Property
''''将前面模块中的代码保留
''''新建一个窗体,看现在这个自定义的真正锁定的文本控件如何?
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
