listbox or combobox with pictures ? 
Author Message
 listbox or combobox with pictures ?

Hello,

Does anybody know how to create a listbox or combobox with a icoc/bitmap on
the first position ? I know that they are in the new common controls like
the coolbar/rebar. If anybody has a control or codeexample how to create
this i would be very interested. I appreaciate any suggestions and/or
examples.

Thanks in advance !

Greetings,

Emile



Wed, 03 Nov 1999 03:00:00 GMT  
 listbox or combobox with pictures ?

This is a multi-part message in MIME format.

------=_NextPart_000_01BC628C.65CCDF00
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

VBPJ had a great article awhile back about using an owner-draw listbox =
to put pictures in it. I can send you the source code to the listbox =
control if you want (requires VB5).
--
-- Ben
SiteBuilder Network Level 2
Ben's VB5 Page -- This site has been Activated!
http://www.{*filter*}highway.com/~psy/
Requires IE3.01 or higher...

 Emile Besseling wrote in article =

Does anybody know how to create a listbox or combobox with a icoc/bitmap =
on
the first position ? I know that they are in the new common controls =
like
the coolbar/rebar. If anybody has a control or codeexample how to create
this i would be very interested. I appreaciate any suggestions and/or
examples.

------=_NextPart_000_01BC628C.65CCDF00
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"Trident 4.71.0544.0"' name=3DGENERATOR>

</HEAD>
<BODY>
<P><FONT face=3DArial size=3D2>VBPJ had a great article awhile back =
about using an=20
owner-draw listbox to put pictures in it. I can send you the source code =
to the=20
listbox control if you want (requires VB5).<BR>
--<BR>
<HTML><BODY><FONT size=3D2>-- Ben<BR>
SiteBuilder Network Level 2<BR>
Ben's VB5 Page -- This site has been Activated!<BR>
<A=20
href=3D"http://www.{*filter*}highway.com/~psy/">http://www.{*filter*}highway.com/~p=
sy/</A><BR>
Requires IE3.01 or higher...<BR>
</FONT></FONT>

<P><FONT face=3DArial size=3D2> <EM><FONT color=3D#808080>Emile=20


<HTML><BODY>Does anybody know how to create a listbox or combobox with a =

icoc/bitmap on<BR>
the first position ? I know that they are in the new common controls =
like<BR>
the coolbar/rebar. If anybody has a control or codeexample how to =
create<BR>
this i would be very interested. I appreaciate any suggestions =
and/or<BR>
examples.<BR>
</FONT></EM></FONT></P>

</BODY></HTML>

------=_NextPart_000_01BC628C.65CCDF00--



Wed, 03 Nov 1999 03:00:00 GMT  
 listbox or combobox with pictures ?

This may sound hellishly long winded and complicated but I use VB3 so I'm
used to it:

If all else fails draw up a picture box inside of a picture box (thus
allowing it to scroll) then bitblt text and pictures onto the box from
wherever you're getting you're data. It isn't particularly fast but it's
extremely configurable, so you might like to try it. I have (somewhere) and
example I wrote ages ago which I'll post if anyone asks me to.



VBPJ had a great article awhile back about using an owner-draw listbox to
put pictures in it. I can send you the source code to the listbox control
if you want (requires VB5).
--
-- Ben
SiteBuilder Network Level 2
Ben's VB5 Page -- This site has been Activated!
http://www.{*filter*}highway.com/~psy/
Requires IE3.01 or higher...

 Emile Besseling wrote in article

Does anybody know how to create a listbox or combobox with a icoc/bitmap on
the first position ? I know that they are in the new common controls like
the coolbar/rebar. If anybody has a control or codeexample how to create
this i would be very interested. I appreaciate any suggestions and/or
examples.

----------



Sun, 07 Nov 1999 03:00:00 GMT  
 listbox or combobox with pictures ?

You could do worse than to use the ListView control (part of the Windows
common controls OCX).



Quote:
> Hello,

> Does anybody know how to create a listbox or combobox with a icoc/bitmap
on
> the first position ? I know that they are in the new common controls like
> the coolbar/rebar. If anybody has a control or codeexample how to create
> this i would be very interested. I appreaciate any suggestions and/or
> examples.

> Thanks in advance !

> Greetings,

> Emile




Sun, 14 Nov 1999 03:00:00 GMT  
 listbox or combobox with pictures ?

This is a multi-part message in MIME format.

--------------1F1E7F44612C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Quote:

> You could do worse than to use the ListView control (part of the Windows
> common controls OCX).



> > Hello,

> > Does anybody know how to create a listbox or combobox with a icoc/bitmap
> on
> > the first position ? I know that they are in the new common controls like
> > the coolbar/rebar. If anybody has a control or codeexample how to create
> > this i would be very interested. I appreaciate any suggestions and/or
> > examples.

> > Thanks in advance !

> > Greetings,

> > Emile


I made the following control myself, and it's not quite finished yet.
But it works. Hope you can figure out how it works

--------------1F1E7F44612C
Content-Type: text/plain; charset=us-ascii; name="Droplist.ctl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Droplist.ctl"

VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "comctl32.ocx"
Begin VB.UserControl CCDropList
   ClientHeight    =   4725
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   8295
   LockControls    =   -1  'True
   ScaleHeight     =   4725
   ScaleWidth      =   8295
   Begin ComctlLib.ListView lvwCombo
      Height          =   2445
      Left            =   0
      TabIndex        =   2
      Top             =   350
      Width           =   3645
      _ExtentX        =   6429
      _ExtentY        =   4313
      View            =   3
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   0   'False
      HideColumnHeaders=   -1  'True
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      MouseIcon       =   "Droplist.ctx":0000
      NumItems        =   1
      BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
         Key             =   "X"
         Object.Tag             =   ""
         Text            =   ""
         Object.Width           =   2540
      EndProperty
   End
   Begin VB.PictureBox picCombo
      BackColor       =   &H80000005&
      Height          =   330
      Left            =   0
      ScaleHeight     =   270
      ScaleWidth      =   3765
      TabIndex        =   0
      Top             =   0
      Width           =   3825
      Begin VB.Image imgDropButton
         Height          =   270
         Left            =   3510
         Picture         =   "Droplist.ctx":001C
         Top             =   0
         Width           =   240
      End
      Begin VB.Image imgItem
         Height          =   240
         Left            =   15
         Stretch         =   -1  'True
         Top             =   15
         Width           =   270
      End
      Begin VB.Label labItemText
         BackStyle       =   0  'Transparent
         Height          =   225
         Left            =   360
         TabIndex        =   1
         Top             =   30
         Width           =   2715
      End
   End
End
Attribute VB_Name = "CCDropList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private Dropped As Boolean

'Events
Event ItemClick(Item As ListItem)
Event MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseDown
Event MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseMove
Event MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseUp

Public Sub Add(Optional Key As Variant, Optional Text As Variant, Optional IconKey As Variant)
    Dim ItmX As ListItem

    Set ItmX = lvwCombo.ListItems.Add(, Key, Text, IconKey, IconKey)
End Sub

Public Property Let Icons(ged As Object)
    Set lvwCombo.Icons = ged
    Set lvwCombo.SmallIcons = ged
End Property

Public Sub SelectItem(ByVal Key As String)
    Set lvwCombo.SelectedItem = lvwCombo.ListItems(Key)
End Sub

Public Property Get SelectedItem() As ListItem
    Set SelectedItem = lvwCombo.SelectedItem
End Property

Public Property Let Sorted(ByVal S As Boolean)
    lvwCombo.Sorted = S
End Property

Private Sub imgDropButton_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dropped = Dropped Xor True
    Call UserControl_Resize
    RaiseEvent MouseDown(Button, Shift, x, y)
End Sub

Private Sub imgDropButton_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    RaiseEvent MouseMove(Button, Shift, x, y)
End Sub

Private Sub imgDropButton_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    RaiseEvent MouseUp(Button, Shift, x, y)
End Sub

Private Sub imgItem_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    RaiseEvent MouseDown(Button, Shift, x, y)
End Sub

Private Sub imgItem_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    RaiseEvent MouseMove(Button, Shift, x, y)
End Sub

Private Sub imgItem_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    RaiseEvent MouseUp(Button, Shift, x, y)
End Sub

Private Sub labItemText_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dropped = Dropped Xor True
    Call UserControl_Resize
    RaiseEvent MouseDown(Button, Shift, x, y)
End Sub

Private Sub labItemText_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    RaiseEvent MouseMove(Button, Shift, x, y)
End Sub

Private Sub labItemText_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    RaiseEvent MouseUp(Button, Shift, x, y)
End Sub

Private Sub lvwCombo_ItemClick(ByVal Item As ComctlLib.ListItem)
    labItemText.Caption = Item.Text
    If Item.Icon <> "" Then
        imgItem.Picture = lvwCombo.Icons.ListImages(Item.Icon).Picture
        labItemText.Left = 360
    Else
        imgItem.Picture = Nothing
        labItemText.Left = imgItem.Left
    End If

    Dropped = False
    Call UserControl_Resize

    RaiseEvent ItemClick(lvwCombo.SelectedItem)
End Sub

Private Sub lvwCombo_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    RaiseEvent MouseDown(Button, Shift, x, y)
End Sub

Private Sub lvwCombo_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    RaiseEvent MouseMove(Button, Shift, x, y)
End Sub

Private Sub lvwCombo_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    RaiseEvent MouseUp(Button, Shift, x, y)
End Sub

Private Sub UserControl_ExitFocus()
    Dropped = False
    Call UserControl_Resize
End Sub

Private Sub UserControl_LostFocus()
    Dropped = False
    Call UserControl_Resize
End Sub

Private Sub UserControl_Resize()
    If Width < 700 Then Width = 700

    If Dropped = False Then
        Height = picCombo.Height
    Else
        Height = lvwCombo.Top + lvwCombo.Height
    End If

    picCombo.Width = Width
    lvwCombo.Width = Width
    lvwCombo.ColumnHeaders("X").Width = Width * 0.8

    imgDropButton.Left = Abs(picCombo.ScaleWidth - imgDropButton.Width)
    labItemText.Width = Abs(imgDropButton.Left - labItemText.Left)
End Sub

--------------1F1E7F44612C
Content-Type: application/octet-stream; name="Droplist.ctx"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Droplist.ctx"

<encoded_portion_removed>
BwA=
--------------1F1E7F44612C
Content-Type: text/plain; charset=us-ascii; name="Droptree.ctl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Droptree.ctl"

VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "comctl32.ocx"
Begin VB.UserControl CCDropTree
   ClientHeight    =   4725
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   8295
   LockControls    =   -1  'True
   ScaleHeight     =   4725
   ScaleWidth      =   8295
   Begin ComctlLib.TreeView tvwCombo
      Height          =   2535
      Left            =   0
      TabIndex        =   2
      Top             =   345
      Width           =   2895
      _ExtentX        =   5106
      _ExtentY        =   4471
      Indentation     =   265
      LabelEdit       =   1
      Style           =   5
      BorderStyle     =   1
      Appearance      =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.PictureBox picCombo
      BackColor       =   &H80000005&
      Height          =   330
      Left            =   0
      ScaleHeight     =   270
      ScaleWidth      =   3765
      TabIndex        =   0
      Top             =   0
      Width           =   3825
      Begin VB.Image imgDropButton
         Height          =   270
         Left            =   3510
         Picture         =   "Droptree.ctx":0000
         Top             =   0
         Width           =   240
      End
      Begin VB.Image imgItem
         Height          =   240
         Left            =   15
         Stretch         =   -1  'True
...

read more »



Mon, 15 Nov 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. listbox or combobox with pictures ?

2. listbox or combobox with pictures ?

3. listbox or combobox with pictures ?

4. picture in combobox/listbox/menu

5. picture in combobox/listbox/menu

6. Using the pipe symbol to fill a listbox or combobox

7. Changing from listbox to combobox

8. Reference ComboBox item to fill ListBox

9. Combobox key-entry to match listbox value

10. ensuring unique items in combobox/listbox

11. Combobox or Listbox: separting key values from display values

12. pass listbox or combobox as a parameter

 

 
Powered by phpBB® Forum Software