home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Flat_Contr69641472002.psc / FlatCombo.ctl (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2002-04-07  |  8.2 KB  |  244 lines

  1. VERSION 5.00
  2. Begin VB.UserControl FlatCombo 
  3.    BackColor       =   &H8000000B&
  4.    ClientHeight    =   780
  5.    ClientLeft      =   0
  6.    ClientTop       =   0
  7.    ClientWidth     =   2055
  8.    BeginProperty Font 
  9.       Name            =   "Small Fonts"
  10.       Size            =   6.75
  11.       Charset         =   0
  12.       Weight          =   400
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    ScaleHeight     =   780
  18.    ScaleWidth      =   2055
  19.    ToolboxBitmap   =   "FlatCombo.ctx":0000
  20.    Begin VB.PictureBox Picture2 
  21.       Appearance      =   0  'Flat
  22.       AutoRedraw      =   -1  'True
  23.       BackColor       =   &H80000005&
  24.       BeginProperty Font 
  25.          Name            =   "MS Sans Serif"
  26.          Size            =   8.25
  27.          Charset         =   0
  28.          Weight          =   400
  29.          Underline       =   0   'False
  30.          Italic          =   0   'False
  31.          Strikethrough   =   0   'False
  32.       EndProperty
  33.       ForeColor       =   &H80000008&
  34.       Height          =   285
  35.       Left            =   1440
  36.       Picture         =   "FlatCombo.ctx":0312
  37.       ScaleHeight     =   255
  38.       ScaleMode       =   0  'User
  39.       ScaleWidth      =   195
  40.       TabIndex        =   2
  41.       Top             =   0
  42.       Width           =   255
  43.    End
  44.    Begin VB.PictureBox Picture1 
  45.       Appearance      =   0  'Flat
  46.       BackColor       =   &H80000005&
  47.       BeginProperty Font 
  48.          Name            =   "MS Sans Serif"
  49.          Size            =   8.25
  50.          Charset         =   0
  51.          Weight          =   400
  52.          Underline       =   0   'False
  53.          Italic          =   0   'False
  54.          Strikethrough   =   0   'False
  55.       EndProperty
  56.       ForeColor       =   &H80000008&
  57.       Height          =   285
  58.       Left            =   0
  59.       ScaleHeight     =   255
  60.       ScaleWidth      =   1425
  61.       TabIndex        =   0
  62.       Top             =   0
  63.       Width           =   1455
  64.       Begin VB.ComboBox Combo1 
  65.          Appearance      =   0  'Flat
  66.          BeginProperty DataFormat 
  67.             Type            =   2
  68.             Format          =   ""
  69.             HaveTrueFalseNull=   0
  70.             FirstDayOfWeek  =   0
  71.             FirstWeekOfYear =   0
  72.             LCID            =   1033
  73.             SubFormatType   =   9
  74.          EndProperty
  75.          Height          =   285
  76.          Left            =   0
  77.          TabIndex        =   1
  78.          Top             =   0
  79.          Width           =   1365
  80.       End
  81.    End
  82. Attribute VB_Name = "FlatCombo"
  83. Attribute VB_GlobalNameSpace = False
  84. Attribute VB_Creatable = True
  85. Attribute VB_PredeclaredId = False
  86. Attribute VB_Exposed = True
  87. 'i got all this code from another post on PSC
  88. 'from some guy named kobi vazanna with from his KDCFlatCombo submission
  89. 'it helped me alot and i wanna thank him and give him the credit for this flat combo
  90. Option Explicit
  91. Private MyText As String
  92. Private Myfont As Font
  93. Private MyForeColor As OLE_COLOR
  94. Private MyBackColor As OLE_COLOR
  95. Private NewButtonIcon As Picture
  96.     Private MyLocked As Boolean
  97.     Private MyEnabled As Boolean
  98.     Private MyHasFocus As Boolean
  99.     Private MyLeftFocus As Boolean
  100.     Private MyRightToLeft As Boolean
  101.     Private MySorted As Boolean
  102. Private Const DefText = "Flat Combo"
  103. Private Const MyDefEnabled = True
  104. Private Const DefForeColor = vbWhite
  105. Private Const DefRightToLeft = False
  106. Private Const DefBackColor = vbBlack
  107. Private Const DefLocked = False
  108. Private Const DefSorted = False
  109.         Public Event Click()
  110.         Public Event KeyDown(KeyCode As Integer, Shift As Integer)
  111.         Public Event KeyPress(KeyAscii As Integer)
  112.         Public Event KeyUp(KeyCode As Integer, Shift As Integer)
  113.         Public Event Resize()
  114. Private Sub Picture2_Click()
  115.     Combo1.SetFocus
  116.     SendKeys "%{Down}"
  117. End Sub
  118. Private Sub UserControl_Initialize()
  119.     Call UserControl_Resize
  120. End Sub
  121. Private Sub UserControl_InitProperties()
  122. Text = DefText
  123.     ForeColor = DefForeColor
  124.         BackColor = DefBackColor
  125.             Set Font = Ambient.Font
  126.                 Enabled = MyDefEnabled
  127.             RightToLeft = DefRightToLeft
  128.         Locked = DefLocked
  129. End Sub
  130. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  131. Text = PropBag.ReadProperty("Text", DefText)
  132. ForeColor = PropBag.ReadProperty("ForeColor", DefForeColor)
  133. Set Font = PropBag.ReadProperty("Font", Ambient.Font)
  134. Set ButtonIcon = PropBag.ReadProperty("ButtonIcon", Nothing)
  135.     Enabled = PropBag.ReadProperty("Enabled", MyDefEnabled)
  136.     RightToLeft = PropBag.ReadProperty("RightToLeft", DefRightToLeft)
  137.     BackColor = PropBag.ReadProperty("BackColor", DefBackColor)
  138.     Locked = PropBag.ReadProperty("Locked", DefLocked)
  139. End Sub
  140. Private Sub UserControl_Resize()
  141. Picture1.Width = UserControl.Width
  142.     Combo1.Width = Picture1.Width + 22
  143.     UserControl.Height = Picture1.Height
  144.     Picture2.Width = 250
  145.     Picture2.Height = 285
  146.     If Combo1.RightToLeft = True Then
  147.         Picture2.Left = 0
  148.     Else
  149.         Picture2.Left = UserControl.Width - 250
  150.     End If
  151. End Sub
  152. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  153.     Call PropBag.WriteProperty("Text", MyText, DefText)
  154.     Call PropBag.WriteProperty("ForeColor", MyForeColor, DefForeColor)
  155.     Call PropBag.WriteProperty("Font", Myfont, Ambient.Font)
  156.     Call PropBag.WriteProperty("ButtonIcon", Me.ButtonIcon, Nothing)
  157.     Call PropBag.WriteProperty("Enabled", MyEnabled, MyDefEnabled)
  158.     Call PropBag.WriteProperty("RightToLeft", MyRightToLeft, DefRightToLeft)
  159.     Call PropBag.WriteProperty("BackColor", MyBackColor, DefBackColor)
  160.     Call PropBag.WriteProperty("Locked", MyLocked, DefLocked)
  161. End Sub
  162. Public Property Get ButtonIcon() As Picture
  163.     Set ButtonIcon = Picture2.Picture
  164. End Property
  165. Public Property Set ButtonIcon(ByVal NewButtonIcon As Picture)
  166.     Set Picture2.Picture = ButtonIcon
  167.     Set Picture2.Picture = ButtonIcon
  168.     Call UserControl_Resize
  169.     PropertyChanged "ButtonIcon"
  170. End Property
  171. Public Property Get Enabled() As Boolean
  172.     Enabled = MyEnabled
  173. End Property
  174. Public Property Let Enabled(ByVal vData As Boolean)
  175.     MyEnabled = vData
  176.         UserControl.Enabled = MyEnabled
  177.             Call UserControl_Resize
  178.             PropertyChanged "Enabled"
  179. End Property
  180. Public Property Get Locked() As Boolean
  181.     Locked = MyLocked
  182. End Property
  183. Public Property Let Locked(ByVal vData As Boolean)
  184.     MyLocked = vData
  185.         Combo1.Locked = MyLocked
  186.             Call UserControl_Resize
  187.             PropertyChanged "Locked"
  188. End Property
  189. Public Property Get Font() As Font
  190.     Set Font = Myfont
  191. End Property
  192. Public Property Set Font(ByVal vData As Font)
  193.     Set Myfont = vData
  194.         Set Combo1.Font = Myfont
  195.             Call UserControl_Resize
  196.             PropertyChanged "Font"
  197. End Property
  198. Public Property Get ForeColor() As OLE_COLOR
  199.     ForeColor = MyForeColor
  200. End Property
  201. Public Property Let ForeColor(ByVal vData As OLE_COLOR)
  202.     MyForeColor = vData
  203.         Combo1.ForeColor = MyForeColor
  204.         PropertyChanged "ForeColor"
  205. End Property
  206. Public Property Get Text() As String
  207.     Text = MyText
  208. End Property
  209. Public Property Let Text(ByVal vData As String)
  210.     MyText = vData
  211.         Combo1.Text = MyText
  212.         PropertyChanged "Text"
  213. End Property
  214. Public Property Get RightToLeft() As Boolean
  215.     RightToLeft = MyRightToLeft
  216. End Property
  217. Public Property Let RightToLeft(ByVal vData As Boolean)
  218.     MyRightToLeft = vData
  219.         Combo1.RightToLeft = MyRightToLeft
  220.         Call UserControl_Resize
  221.         PropertyChanged "RightToLeft"
  222. End Property
  223. Public Property Get BackColor() As OLE_COLOR
  224.     BackColor = MyBackColor
  225. End Property
  226. Public Property Let BackColor(ByVal vData As OLE_COLOR)
  227.     MyBackColor = vData
  228.         Combo1.BackColor = vData
  229.         Call UserControl_Resize
  230.         PropertyChanged "BackColor"
  231. End Property
  232. Public Sub AddItem(Item As Variant)
  233.     Combo1.AddItem CStr(Item)
  234. End Sub
  235. Public Sub Clear()
  236.     Combo1.Clear
  237. End Sub
  238. Public Sub Refresh()
  239.     Combo1.Refresh
  240. End Sub
  241. Public Sub RemoveItem(Index As Integer)
  242.     Combo1.RemoveItem Index
  243. End Sub
  244.