Imports System
Imports System.Reflection
Imports System.Reflection.Module
Imports System.Drawing
Imports System.Windows.Forms
Imports Basics
Imports MidRange
Imports IMidRange
Imports GraphicsObjects
<Obsolete("Reemplazado por el ColorComboBox que hereda de ComboBox")> _
Public Class BVComboBox
Inherits System.Windows.Forms.UserControl
Implements IisComunicable
Public Sub New()
MyBase.New()
'El Dise�ador de Windows Forms requiere esta llamada.
InitializeComponent()
'Agregar cualquier inicializaci�n despu�s de la llamada a InitializeComponent()
Initialize()
End Sub
#Region " C�digo generado por el Dise�ador de Windows Forms "
'UserControl reemplaza a Dispose para limpiar la lista de componentes.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requerido por el Dise�ador de Windows Forms
Private components As System.ComponentModel.IContainer
'NOTA: el Dise�ador de Windows Forms requiere el siguiente procedimiento
'Puede modificarse utilizando el Dise�ador de Windows Forms.
'No lo modifique con el editor de c�digo.
Friend WithEvents BvBtnExpand As BVCtl.BVButton
Friend WithEvents TxtBx1 As System.Windows.Forms.TextBox
Friend WithEvents VScrollBar1 As System.Windows.Forms.VScrollBar
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.BvBtnExpand = New BVCtl.BVButton
Me.TxtBx1 = New System.Windows.Forms.TextBox
Me.VScrollBar1 = New System.Windows.Forms.VScrollBar
Me.SuspendLayout()
'
'BvBtnExpand
'
Me.BvBtnExpand.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.BvBtnExpand.BtnState = System.Windows.Forms.ButtonState.Flat
Me.BvBtnExpand.Icon = Nothing
Me.BvBtnExpand.Location = New System.Drawing.Point(104, 0)
Me.BvBtnExpand.Name = "BvBtnExpand"
Me.BvBtnExpand.Size = New System.Drawing.Size(24, 24)
Me.BvBtnExpand.Style = BVCtl.BVButton.BtnStyle.TriangleDown
Me.BvBtnExpand.TabIndex = 0
Me.BvBtnExpand.ToolTipTex = Nothing
'
'TxtBx1
'
Me.TxtBx1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.TxtBx1.Location = New System.Drawing.Point(0, 2)
Me.TxtBx1.Name = "TxtBx1"
Me.TxtBx1.Size = New System.Drawing.Size(104, 20)
Me.TxtBx1.TabIndex = 1
Me.TxtBx1.Text = ""
Me.TxtBx1.Visible = False
'
'VScrollBar1
'
Me.VScrollBar1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.VScrollBar1.Location = New System.Drawing.Point(104, 24)
Me.VScrollBar1.Name = "VScrollBar1"
Me.VScrollBar1.Size = New System.Drawing.Size(24, 0)
Me.VScrollBar1.TabIndex = 2
Me.VScrollBar1.Visible = False
'
'BVComboBox
'
Me.Controls.Add(Me.VScrollBar1)
Me.Controls.Add(Me.TxtBx1)
Me.Controls.Add(Me.BvBtnExpand)
Me.Name = "BVComboBox"
Me.Size = New System.Drawing.Size(128, 24)
Me.ResumeLayout(False)
End Sub
#End Region
'Private intSelectedObj As Object
Protected intBrush As SolidBrush
Protected intBrushCell As SolidBrush
Protected intBrushText As SolidBrush
Protected intPen As Pen
Protected intFont As Font
Protected hTbl As BVHashTable
Protected AList As BVArrayList
Protected intIsExpanded As Boolean
Protected intIsValueType As Boolean
'Protected intSelectedItm As Integer '-1 para ninguno
'Protected LastUsedControl As TextBox
Protected ExpandedAreaHeight As Integer
Protected intSelectedItem As ComboBoxItem
Public Event SendMessage(ByVal sender As Object, ByVal S As Basics.MessageEventArgs) Implements Basics.IisComunicable.SendMessage
Protected Overridable Sub Initialize()
hTbl = New BVHashTable
AList = New BVArrayList
intBrushCell = New System.Drawing.SolidBrush(Color.White)
intIsExpanded = False
ExpandedAreaHeight = 100
Me.VScrollBar1.Visible = False
Me.Height = Me.BvBtnExpand.Height
AddHandler MyBase.Paint, AddressOf Redraw
End Sub
#Region "Properties"
Public ReadOnly Property SelectedItem() As ComboBoxItem
Get
Return intSelectedItem
End Get
End Property
Public ReadOnly Property MainArea() As Size
Get
Return New Size(Me.Width, Me.BvBtnExpand.Height)
End Get
End Property
Public ReadOnly Property ExpandedArea() As Size
Get
Return New Size(Me.Width, ExpandedAreaHeight)
End Get
End Property
#End Region
Public Sub Add(ByVal Itm As ComboBoxItem)
'hTbl.Add(
AList.Add(Itm)
End Sub
Protected Overridable Sub Redraw(ByVal sender As Object, ByVal P As PaintEventArgs)
P.Graphics.FillRectangle(Me.intBrushCell, New Rectangle(0, 0, Me.Width - Me.BvBtnExpand.Width, Me.Height))
ControlPaint.DrawBorder3D(P.Graphics, 0, 0, Me.Width - Me.BvBtnExpand.Width, Me.Height, Border3DStyle.Flat)
If Not intSelectedItem Is Nothing Then
intSelectedItem.Redraw(sender, P)
End If
If intIsExpanded Then
Dim i As Integer
Dim itm As ComboBoxItem
For i = 0 To AList.Count - 1
CType(AList(i), ComboBoxItem).Redraw(sender, P)
Next
End If
End Sub
Protected Overridable Sub BvBtnExpand_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BvBtnExpand.Click
intIsExpanded = True
Me.Height = Me.BvBtnExpand.Height + ExpandedAreaHeight
End Sub
Protected Overridable Sub Me_Click(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Click
If intIsExpanded Then
intIsExpanded = False
Me.Height = Me.BvBtnExpand.Height
Me.VScrollBar1.Visible = False
'Else
' If intIsValueType Then
' End If
End If
End Sub
Protected Sub On_Resize(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Resize
If Me.intIsExpanded = False Then
Me.BvBtnExpand.Height = Me.Height
Me.BvBtnExpand.Width = Me.BvBtnExpand.Height
End If
End Sub
Protected Sub RaiseSendMessage(ByVal sender As Object, ByVal e As MessageEventArgs)
RaiseEvent SendMessage(sender, e)
End Sub
End Class