By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,400 Members | 1,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,400 IT Pros & Developers. It's quick & easy.

ImageCombos- how to use them?

P: n/a
D T
Hi,
I need some general info on ImageCombos
how do you use them? how do u put imgs into them?
can u use them as normal combos? can u do an event according to what img
the user chose?

Thanx
|DT|

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

Here is an example.

Dim arColor() As String

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ComboBox1.DrawMode = DrawMode.OwnerDrawFixed
ComboBox1.Location = New Point(60, 60)
ComboBox1.Width = 150
ComboBox1.Visible = True
ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList

arColor = KnownColor.GetNames(GetType(KnownColor))
ComboBox1.Items.AddRange(arColor)
End Sub
Private Sub combobox1_DrawItem(ByVal sender As Object, ByVal e As
System.Windows.Forms.DrawItemEventArgs) Handles ComboBox1.DrawItem
Dim g As Graphics = e.Graphics
Dim s As String
Dim d As Date
Dim br As Brush = SystemBrushes.WindowText
Dim brBack As Brush
Dim rDraw As Rectangle
Dim bSelected As Boolean = CBool(e.State And DrawItemState.Selected)
Dim bValue As Boolean = CBool(e.State And
DrawItemState.ComboBoxEdit)

rDraw = e.Bounds
rDraw.Inflate(-1, -1)

If bSelected And Not bValue Then
brBack = Brushes.LightBlue
g.FillRectangle(Brushes.LightBlue, rDraw)
g.DrawRectangle(Pens.Blue, rDraw)
Else
brBack = Brushes.White
g.FillRectangle(brBack, e.Bounds)
End If

br = Nothing
brBack = Nothing
rDraw = Nothing

Try
s = ComboBox1.Items.Item(e.Index).ToString
Catch
s = ""
End Try

Dim x, y As Integer

x = e.Bounds.Left + 25
y = e.Bounds.Top + 1
Dim c As Color
Dim b As SolidBrush
c = Color.FromName(s)
b = New SolidBrush(c)

g.FillRectangle(b, x - 20, y + 2, 10, 10)
g.DrawString(s, ComboBox1.Font, Brushes.Black, x, y)
End Sub
Ken
------------------
"D T" <dt*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,
I need some general info on ImageCombos
how do you use them? how do u put imgs into them?
can u use them as normal combos? can u do an event according to what img
the user chose?

Thanx
|DT|

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #2

P: n/a
"D T" <dt*******@hotmail.com> schrieb
Hi,
I need some general info on ImageCombos
how do you use them? how do u put imgs into them?
can u use them as normal combos? can u do an event according to what
img the user chose?


There is no ImageCombo in VB.Net or the .Net Framework.

http://msdn.microsoft.com/library/en...bleObjects.asp
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3

P: n/a
* D T <dt*******@hotmail.com> scripsit:
I need some general info on ImageCombos
how do you use them? how do u put imgs into them?
can u use them as normal combos? can u do an event according to what img
the user chose?


You will have to create an ownerdrawn combobox. Samples can be found
here:

<URL:http://www.codeproject.com/cs/combobox/>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

P: n/a
D T
Hi Ken,
Thanks for your reply but is not what im looking for, Sorry perhaps I
didnt explain it well enough, you see there is an component you can load
that comes with Microsoft VB 6.0 called Microsoft Windows Common
Controls 6.0 (sp6) (MsComClt.ocx). There U can find a control called
ImageCombo. I want to know how to use them.

Thanks :-)
|DT|

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.