home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD59485202000.psc / pkTextLine.ctl next >
Encoding:
Text File  |  2000-02-18  |  14.6 KB  |  435 lines

  1. VERSION 5.00
  2. Begin VB.UserControl XMText 
  3.    ClientHeight    =   390
  4.    ClientLeft      =   0
  5.    ClientTop       =   0
  6.    ClientWidth     =   1770
  7.    LockControls    =   -1  'True
  8.    ScaleHeight     =   390
  9.    ScaleWidth      =   1770
  10.    ToolboxBitmap   =   "pkTextLine.ctx":0000
  11.    Begin VB.TextBox txtParent 
  12.       BackColor       =   &H00FFF5E8&
  13.       BorderStyle     =   0  'None
  14.       Height          =   330
  15.       IMEMode         =   3  'DISABLE
  16.       Left            =   105
  17.       TabIndex        =   0
  18.       Top             =   105
  19.       Width           =   1065
  20.    End
  21.    Begin VB.Line Line5 
  22.       BorderColor     =   &H80000005&
  23.       X1              =   120
  24.       X2              =   1080
  25.       Y1              =   120
  26.       Y2              =   120
  27.    End
  28.    Begin VB.Line Line1 
  29.       BorderColor     =   &H80000010&
  30.       X1              =   0
  31.       X2              =   0
  32.       Y1              =   0
  33.       Y2              =   495
  34.    End
  35.    Begin VB.Line Line4 
  36.       BorderColor     =   &H80000014&
  37.       X1              =   15
  38.       X2              =   1200
  39.       Y1              =   480
  40.       Y2              =   480
  41.    End
  42.    Begin VB.Line Line3 
  43.       BorderColor     =   &H80000014&
  44.       X1              =   1200
  45.       X2              =   1200
  46.       Y1              =   495
  47.       Y2              =   0
  48.    End
  49.    Begin VB.Line Line2 
  50.       BorderColor     =   &H80000010&
  51.       X1              =   0
  52.       X2              =   1200
  53.       Y1              =   0
  54.       Y2              =   0
  55.    End
  56. End
  57. Attribute VB_Name = "XMText"
  58. Attribute VB_GlobalNameSpace = False
  59. Attribute VB_Creatable = True
  60. Attribute VB_PredeclaredId = False
  61. Attribute VB_Exposed = True
  62. Attribute VB_Ext_KEY = "PropPageWizardRun" ,"Yes"
  63. Option Explicit
  64. 'API Declarations
  65. Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
  66. Private Declare Function ReleaseCapture Lib "user32" () As Long
  67. 'Default Property Values:
  68. Dim PixelX
  69. Dim PixelY
  70. Dim m_PasswordChr As Variant
  71. Dim m_Font As Font
  72. Dim KG As Integer
  73. Dim FocusState As Boolean
  74. Dim m_ChangeColor As Boolean
  75. Dim m_FillColor As OLE_COLOR
  76. Dim m_FocusColor As OLE_COLOR
  77. 'Property Values
  78. Const m_def_FillColor = &HFFE3B5
  79. Const m_def_ChangeColor = True
  80. Const m_def_PasswordChar = 0
  81. Const m_def_FocusColor = vbWhite
  82. 'Event Declarations():
  83. Event Click()
  84. Event DblClick()
  85. Event KeyDown(KeyCode As Integer, Shift As Integer)
  86. Event KeyPress(KeyAscii As Integer)
  87. Event KeyUp(KeyCode As Integer, Shift As Integer)
  88. Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  89. Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  90. Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  91. Event Change()
  92. Public Enum PasswordChar
  93. No_Char = 0
  94. Stars = 1
  95. End Enum
  96.  
  97. Private Sub txtParent_GotFocus()
  98. FocusState = True
  99. If FocusState = True And ChangeColor = True Then
  100. txtParent.BackColor = FocusColor
  101. End If
  102. End Sub
  103.  
  104. Private Sub txtParent_LostFocus()
  105. FocusState = False
  106. If FocusState = False And ChangeColor = True Then
  107. txtParent.BackColor = FillColor
  108. End If
  109. End Sub
  110.  
  111. Private Sub UserControl_Initialize()
  112.  PixelX = Screen.TwipsPerPixelX
  113.  PixelY = Screen.TwipsPerPixelY
  114.  Line5.BorderColor = txtParent.BackColor
  115.  Line3.Y2 = -PixelY
  116.  UserControl_Resize
  117. End Sub
  118.  
  119. Private Sub Font_Change()
  120.  txtParent.Height = txtParent.Height + PixelX
  121.  UserControl.Height = txtParent.Height + 4 * PixelY
  122.  UserControl.Width = txtParent.Width + 4 * PixelX
  123.  UserControl_Resize
  124. End Sub
  125.  
  126. Private Sub UserControl_Resize()
  127.  If UserControl.Width < 10 * PixelY Then
  128.   UserControl.Width = 10 * PixelY
  129.  End If
  130.  
  131.  
  132.  If UserControl.Height <= 17 * PixelY Then
  133.   UserControl.Height = 17 * PixelY
  134.   KG = 0
  135.   Line5.Visible = False
  136.  ElseIf UserControl.Height < 19 * PixelY Then
  137.   UserControl.Height = 19 * PixelY
  138.   KG = 1
  139.   Line5.Visible = True
  140.  Else
  141.   KG = 1
  142.   Line5.Visible = True
  143.  End If
  144.  
  145.  txtParent.Height = UserControl.Height - PixelX * (4 + KG)
  146.  txtParent.Width = UserControl.Width - PixelY * 4
  147.  txtParent.Top = PixelX * (2 + KG)
  148.  txtParent.Left = PixelY
  149.  txtParent.Left = PixelX * 2
  150.  
  151.  Line1.Y2 = UserControl.Height
  152.  Line2.X2 = UserControl.Width - PixelX
  153.  Line3.X1 = UserControl.Width - PixelX
  154.  Line3.X2 = UserControl.Width - PixelX
  155.  Line3.Y1 = UserControl.Height
  156.  Line4.X2 = UserControl.Width - PixelX
  157.  Line4.Y1 = UserControl.Height - PixelY
  158.  Line4.Y2 = UserControl.Height - PixelY
  159.  Line5.Y1 = txtParent.Top - PixelY
  160.  Line5.Y2 = txtParent.Top - PixelY
  161.  Line5.X1 = txtParent.Left
  162.  Line5.X2 = txtParent.Left + txtParent.Width
  163.  Line5.BorderColor = txtParent.BackColor
  164. End Sub
  165.  
  166. Public Property Get ForeColor() As OLE_COLOR
  167.  ForeColor = txtParent.ForeColor
  168. End Property
  169.  
  170. Public Property Let ForeColor(ByVal vNewValue As OLE_COLOR)
  171.  txtParent.ForeColor = vNewValue
  172.  PropertyChanged "ForeColor"
  173. End Property
  174.  
  175. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  176.     Call PropBag.WriteProperty("ForeColor", txtParent.ForeColor, &H80000008)
  177.     Call PropBag.WriteProperty("Text", txtParent.Text, "")
  178.     Call PropBag.WriteProperty("Enabled", txtParent.Enabled, True)
  179.     Call PropBag.WriteProperty("Font", Font, Ambient.Font)
  180.     Call PropBag.WriteProperty("MousePointer", UserControl.MousePointer, 0)
  181.     Call PropBag.WriteProperty("Enabled", txtParent.Enabled, True)
  182.     Call PropBag.WriteProperty("MouseIcon", MouseIcon, Nothing)
  183.     Call PropBag.WriteProperty("Text", txtParent.Text, "")
  184.     Call PropBag.WriteProperty("MaxLength", txtParent.MaxLength, 0)
  185.     Call PropBag.WriteProperty("ToolTipText", txtParent.ToolTipText, "")
  186.     Call PropBag.WriteProperty("Font", m_Font, Ambient.Font)
  187.     Call PropBag.WriteProperty("ColorHighLight", Line3.BorderColor, -2147483628)
  188.     Call PropBag.WriteProperty("ColorDarkShadow", Line1.BorderColor, -2147483632)
  189.     Call PropBag.WriteProperty("FrameColor", UserControl.BackColor, &H8000000F)
  190.     Call PropBag.WriteProperty("FocusColor", m_FocusColor, m_def_FocusColor)
  191.     Call PropBag.WriteProperty("FillColor", m_FillColor, m_def_FillColor)
  192.     Call PropBag.WriteProperty("ChangeColor", m_ChangeColor, m_def_ChangeColor)
  193.     Call PropBag.WriteProperty("PasswordChr", m_PasswordChr, m_def_PasswordChar)
  194.     Call PropBag.WriteProperty("SelLength", txtParent.SelLength, 0)
  195.     Call PropBag.WriteProperty("SelStart", txtParent.SelStart, 0)
  196.     Call PropBag.WriteProperty("SelText", txtParent.SelText, "")
  197. End Sub
  198.  
  199.  
  200. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  201.     txtParent.SelLength = PropBag.ReadProperty("SelLength", 0)
  202.     txtParent.SelStart = PropBag.ReadProperty("SelStart", 0)
  203.     txtParent.SelText = PropBag.ReadProperty("SelText", "")
  204.     Set MouseIcon = PropBag.ReadProperty("MouseIcon", Nothing)
  205.     Set txtParent.Font = PropBag.ReadProperty("Font", Ambient.Font)
  206.     txtParent.Text = PropBag.ReadProperty("Text", "")
  207.     Line5.BorderColor = PropBag.ReadProperty("BackColor", &H80000005)
  208.     txtParent.ForeColor = PropBag.ReadProperty("ForeColor", &H80000008)
  209.     txtParent.Enabled = PropBag.ReadProperty("Enabled", True)
  210.     txtParent.Enabled = PropBag.ReadProperty("Enabled", True)
  211.     Set MouseIcon = PropBag.ReadProperty("MouseIcon", Nothing)
  212.     txtParent.Text = PropBag.ReadProperty("Text", "")
  213.     txtParent.MaxLength = PropBag.ReadProperty("MaxLength", 0)
  214.     txtParent.ToolTipText = PropBag.ReadProperty("ToolTipText", "")
  215.     Set m_Font = PropBag.ReadProperty("Font", Ambient.Font)
  216.     Line3.BorderColor = PropBag.ReadProperty("ColorHighLight", -2147483628)
  217.     UserControl.BackColor = PropBag.ReadProperty("ColorLightShadow", &H8000000F)
  218.     Line1.BorderColor = PropBag.ReadProperty("ColorDarkShadow", -2147483632)
  219.     UserControl.BackColor = PropBag.ReadProperty("FrameColor", &H8000000F)
  220.     m_FocusColor = PropBag.ReadProperty("FocusColor", m_def_FocusColor)
  221.     m_FillColor = PropBag.ReadProperty("FillColor", m_def_FillColor)
  222.     m_ChangeColor = PropBag.ReadProperty("ChangeColor", m_def_ChangeColor)
  223.     m_PasswordChr = PropBag.ReadProperty("PasswordChr", m_def_PasswordChar)
  224.     PswdChar
  225.     txtParent.BackColor = FillColor
  226. End Sub
  227.  
  228. 'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VER─NDERN!
  229. 'MappingInfo=UserControl,UserControl,-1,hWnd
  230. Public Property Get hWnd() As Long
  231.     hWnd = UserControl.hWnd
  232. End Property
  233.  
  234. 'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VER─NDERN!
  235. 'MappingInfo=txtParent,txtParent,-1,Enabled
  236. Public Property Get Enabled() As Boolean
  237.     Enabled = txtParent.Enabled
  238. End Property
  239.  
  240. Public Property Let Enabled(ByVal New_Enabled As Boolean)
  241.     txtParent.Enabled() = New_Enabled
  242.     PropertyChanged "Enabled"
  243. End Property
  244.  
  245. 'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VER─NDERN!
  246. 'MappingInfo=UserControl,UserControl,-1,hDC
  247. Public Property Get hDC() As Long
  248.     hDC = UserControl.hDC
  249. End Property
  250.  
  251. 'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VER─NDERN!
  252. 'MappingInfo=UserControl,UserControl,-1,MouseIcon
  253. Public Property Get MouseIcon() As Picture
  254.     Set MouseIcon = UserControl.MouseIcon
  255. End Property
  256.  
  257. Public Property Set MouseIcon(ByVal New_MouseIcon As Picture)
  258.     Set UserControl.MouseIcon = New_MouseIcon
  259.     PropertyChanged "MouseIcon"
  260. End Property
  261.  
  262. 'MappingInfo=txtParent,txtParent,-1,Text
  263. Public Property Get Text() As String
  264.     Text = txtParent.Text
  265. End Property
  266.  
  267. Public Property Let Text(ByVal New_Text As String)
  268.     txtParent.Text() = New_Text
  269.     PropertyChanged "Text"
  270. End Property
  271.  
  272. Private Sub txtParent_Change()
  273.     RaiseEvent Change
  274. End Sub
  275.  
  276. Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  277.     RaiseEvent MouseDown(Button, Shift, X, Y)
  278. End Sub
  279.  
  280. 'MappingInfo=txtParent,txtParent,-1,MaxLength
  281. Public Property Get MaxLength() As Long
  282.     MaxLength = txtParent.MaxLength
  283. End Property
  284.  
  285. Public Property Let MaxLength(ByVal New_MaxLength As Long)
  286.     txtParent.MaxLength() = New_MaxLength
  287.     PropertyChanged "MaxLength"
  288. End Property
  289.  
  290. Private Sub txtParent_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  291. RaiseEvent MouseMove(Button, Shift, X, Y)
  292.     If FocusState = False And ChangeColor = True Then
  293.         With txtParent
  294.             If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
  295.                 ReleaseCapture
  296.                 txtParent.BackColor = FillColor
  297.                 Else
  298.                 SetCapture .hWnd
  299.                 txtParent.BackColor = FocusColor
  300.           End If
  301.         End With
  302.     End If
  303. End Sub
  304.  
  305. Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  306.     RaiseEvent MouseUp(Button, Shift, X, Y)
  307. End Sub
  308.  
  309. 'MappingInfo=txtParent,txtParent,-1,ToolTipText
  310. Public Property Get ToolTipText() As String
  311.     ToolTipText = txtParent.ToolTipText
  312. End Property
  313.  
  314. Public Property Let ToolTipText(ByVal New_ToolTipText As String)
  315.     txtParent.ToolTipText() = New_ToolTipText
  316.     PropertyChanged "ToolTipText"
  317. End Property
  318.  
  319. Private Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer)
  320.     RaiseEvent KeyDown(KeyCode, Shift)
  321. End Sub
  322.  
  323. Private Sub UserControl_KeyPress(KeyAscii As Integer)
  324.     RaiseEvent KeyPress(KeyAscii)
  325. End Sub
  326.  
  327. Private Sub UserControl_KeyUp(KeyCode As Integer, Shift As Integer)
  328.     RaiseEvent KeyUp(KeyCode, Shift)
  329. End Sub
  330.  
  331. Public Property Get Font() As Font
  332.     Set Font = m_Font
  333. End Property
  334.  
  335. Public Property Set Font(ByVal New_Font As Font)
  336.     Set m_Font = New_Font
  337.     PropertyChanged "Font"
  338. End Property
  339.  
  340. Private Sub UserControl_InitProperties()
  341.     Set m_Font = Ambient.Font
  342.     txtParent.Text = Extender.Name
  343.     m_ChangeColor = m_def_ChangeColor
  344.     m_FocusColor = m_def_FocusColor
  345.     m_FillColor = m_def_FillColor
  346. End Sub
  347.  
  348. Public Property Get ChangeColor() As Boolean
  349.     ChangeColor = m_ChangeColor
  350. End Property
  351.  
  352. Public Property Let ChangeColor(ByVal New_ChangeColor As Boolean)
  353.     m_ChangeColor = New_ChangeColor
  354.     PropertyChanged "ChangeColor"
  355. End Property
  356.  
  357. 'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VER─NDERN!
  358. 'MappingInfo=UserControl,UserControl,-1,BackColor
  359. Public Property Get FrameColor() As OLE_COLOR
  360.     FrameColor = UserControl.BackColor
  361. End Property
  362.  
  363. Public Property Let FrameColor(ByVal New_FrameColor As OLE_COLOR)
  364.     UserControl.BackColor() = New_FrameColor
  365.     PropertyChanged "FrameColor"
  366. End Property
  367.  
  368. Public Property Get FillColor() As OLE_COLOR
  369.     FillColor = m_FillColor
  370.     txtParent.BackColor = FillColor
  371. End Property
  372. Public Property Let FillColor(ByVal New_FillColor As OLE_COLOR)
  373.     m_FillColor = New_FillColor
  374.     PropertyChanged "FillColor"
  375.     txtParent.BackColor = FillColor
  376. End Property
  377.  
  378. Public Property Get FocusColor() As OLE_COLOR
  379.     FocusColor = m_FocusColor
  380. End Property
  381. Public Property Let FocusColor(ByVal New_FocusColor As OLE_COLOR)
  382.     m_FocusColor = New_FocusColor
  383.     PropertyChanged "FocusColor"
  384. End Property
  385.  
  386. Public Property Get PasswordChr() As PasswordChar
  387.     PasswordChr = m_PasswordChr
  388.     PswdChar
  389. End Property
  390.  
  391. Public Property Let PasswordChr(ByVal New_PasswordChr As PasswordChar)
  392.     m_PasswordChr = New_PasswordChr
  393.     PswdChar
  394.     PropertyChanged "PasswordChr"
  395. End Property
  396.  
  397. Private Sub PswdChar()
  398. Select Case m_PasswordChr
  399.     Case 0
  400.     txtParent.PasswordChar = ""
  401.     Case 1
  402.     txtParent.PasswordChar = "*"
  403.     Case Else
  404.     Exit Sub
  405. End Select
  406. End Sub
  407. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  408. 'MappingInfo=txtParent,txtParent,-1,SelLength
  409. Public Property Get SelLength() As Long
  410. Attribute SelLength.VB_Description = "Returns/sets the number nnumber nnumber nhr = m_PasswordChr
  411. aLe0
  412.     C!
  413. 'MappingInfo=txtParent,txtParent,-1Shift As Integer)
  414. Tion = "Returnth.VsReturnLength.VB_Description = "Returns/sets t
  415.     Exit Sub
  416. End Se As FonCip(KeyCode ty Get SelLengthChar = "*"e  txtParent.Backolor() As OLE_COLOR
  417.   r() As OLE_COLOR
  418.   r() As Oent.Backolor() AsOR
  419.   r() As Oent.BackolortasswordChr
  420.     Case 0.BackolortasswordChr
  421.     Cas() As ckolortasswordChr
  422.     Cas() A) As OEt nnumber nhr = m_PasW(l OLE_COLOR.BackolortasBackolor() AsOR
  423.   r() As Oent.Backolortasswordi.BackolBackolortasBackolor() AsOR
  424.   2 New_ToolTipText As String)
  425.     txtParent.ToolTipText() = NeckolortasswordChr
  426. opeeger)E
  427.     txtParent.BackColor = FillColor121S=KXwordChr
  428. opn
  429.     hWnd = UesBackolor() AsOR
  430.   r() As O S=K0GtrtasswordChr
  431. opeeger)E
  432. 2 NewH() As O SackoloBl) AsOR
  433.   r() As Oent.Backolortasswor
  434.   r  txtParent.ForeColor = PropBag.ReadProperty("ForeColor", &H80000008)
  435.     txtParent.Enabled = Prop 3_def_ChangeColor
  436.     m_FocusColorn AsOR
  437.   r()n5E
  438. tmy   HTUNG! DIE lf_ChadOent.r
  439.   TColor", &H80000008)
  440.     txtParent.EnableLEwse ci txtParenlParenlParenlParenlPa