Codejock Forums Homepage
Forum Home Forum Home > General > XAML Snippets > Samples and Demo Applications
  New Posts New Posts RSS Feed - COM - VB - XAML Colourpicker Combo
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

COM - VB - XAML Colourpicker Combo

 Post Reply Post Reply
Author
Message
Boris View Drop Down
Senior Member
Senior Member
Avatar

Joined: 21 June 2007
Location: United Kingdom
Status: Offline
Points: 179
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boris Quote  Post ReplyReply Direct Link To This Post Topic: COM - VB - XAML Colourpicker Combo
    Posted: 15 May 2008 at 5:14am
Hi Oleg, Thanks for your recent help with Markup.
 
Can you also point me in the right direction to create a small block of colour before any text appears in the list when using a combo with markup. I need to show a user defined colour before some text which is also user defined. Something like the attached image .... The control I am using here is from vbaccellerator and is the OwnerDrawComboList.  I need to create these colours when the combo loads as the user can change the colours in system settings so icons etc are out. Can you help I'm rather stumped?

Regards
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013
Back to Top
ijwelch View Drop Down
Senior Member
Senior Member


Joined: 20 June 2006
Status: Offline
Points: 262
Post Options Post Options   Thanks (0) Thanks(0)   Quote ijwelch Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2008 at 11:13pm
Try the following sub to add each item to list:

Private Sub pAddComboItem(lColor As Long, sText As String, Optional lData As Long = 0)
Dim sColor As String
Dim lRed As Long, lGreen As Long, lBlue As Long

lRed = lColor And &HFF
lGreen = (lColor And &HFF00&) \ &H100&
lBlue = (lColor And &HFF0000) \ &H10000

sColor = Right$("0" & Hex$(lRed), 2) & Right$("0" & Hex$(lGreen), 2) & Right$("0" & Hex$(lBlue), 2)

ComboBoxMarkup.AddItem "<StackPanel Orientation='Horizontal'>" & _
            "<Rectangle  Fill='#" & sColor & "' Stroke='#000000' Width='14' Height='14'/>" & _
            "<TextBlock Padding = '2' VerticalAlignment='Center'>" & sText & "</TextBlock></StackPanel>"
ComboBoxMarkup.ItemData(ComboBoxMarkup.NewIndex) = lData
  
End Sub

Back to Top
Boris View Drop Down
Senior Member
Senior Member
Avatar

Joined: 21 June 2007
Location: United Kingdom
Status: Offline
Points: 179
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boris Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2008 at 10:21am
Hi,
 
That worked a treat!!  
 
I am having trouble with this as I have never used markup before. I have always managed to avoid using it. Could you point me to somewhere where I could get some online help in understanding mark up.?
 
Regards
 
 
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013
Back to Top
ijwelch View Drop Down
Senior Member
Senior Member


Joined: 20 June 2006
Status: Offline
Points: 262
Post Options Post Options   Thanks (0) Thanks(0)   Quote ijwelch Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2008 at 9:54pm
This site has a little info and loads of links:

http://www.xaml.net/index.html
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.