Hello,

I wonder if this can be done on windows (RB2006r4) and if so how.
I made a new class with as super ComboBox.
I made a method SetColor with the following code :
Soft Declare Function GetWindowDC Lib "user32" (hwnd As Integer) As Integer Soft Declare Function SetBkMode Lib "gdi32" (hDC As Integer, nBkMode As Integer) As Integer Soft Declare Function SetBkColor Lib "gdi32" ( hDC As Integer, crColor As Integer ) As Integer
 Dim ikleur As Integer
 dim isuccess As Integer
 dim iDC As Integer
 ikleur=ColorToInt(rgb(255,0,0))
 iDC=GetWindowDC(me.Handle)
 isuccess=SetBkMode(iDC,2)
 isuccess=setbkcolor(iDC,ikleur)
I also have the Function ColorToInt(c As color) As Integer with the following code.
 dim mb as new MemoryBlock( 4 )
 mb.Byte( 0 ) = c.Red
 mb.Byte( 1 ) = c.Green
 mb.Byte( 2 ) = c.Blue
 return mb.Long( 0 )

In the window paint event I have
 MyComboBox1.SetColor
 MyComboBox1.DeleteAllRows
 MyComboBox1.AddRow "Background should be red?"
 MyComboBox1.Text="Background should be red?"

SetColor seems to give me the right results (isuccess=the previous color, as specified in the Microsoft documentation for SetBkColor), but the code seems to do nothing at all. The combobox still remains white. Is it possible to change this through a Windows API? Failing that is there any way to expose a graphics object for the combobox to draw in.

I uploaded a demo of what I'm trying to achieve at http://www.useitgroup.net/comboboxtest.rbp It also shows a picture of the current Windows program (programmed in Ms Access) that we sell, so people can see what I am aiming for, and why (request by the boss for things being as close to the current version as possible, so that our customers don't get confused by the new version.

Thanks in advance.

Dirk Cleenwerck
Chief programmer
Useitgroup NV
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to