Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Textbox BorderColor with Themes = .T.
Message
From
07/11/2007 10:03:47
 
 
To
07/11/2007 06:56:41
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brazil
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01267215
Message ID:
01267268
Views:
27
This message has been marked as the solution to the initial question of the thread.
>How can I retrieve the correct BorderColor of a textbox with Themes = .T.?
>BorderColor property doesn't return the "Themed" color, it always return the default 0,0,0 color.
>I look at GetSysColor API, but it only has the colors of window elements, not controls.
>Someone can help me?

Yes. the problem with the textbox border color is that what you see is really a theme bitmap, now a system color. You could load the theme part, and get the color of one of the pixels, or you could do someting like this, (implemented in ctl32_scontainer):

*!* KLUDGE ALERT! KLUDGE ALERT!
*!* I am trying to find the default color of a textbox border
*!* what I should do is load the theme part if xp and get somehow the color of the
*!* pixel, or use GetSysColor if no theme.

*!* What I am really doing is add a textbox to the form at a certain location, and
*!* using GetPixel to get the color of the pixel where I know the border of the textbox is

Thisform.AddObject([G99545DACA9E54783B9C9CBDB05C4D580], [Textbox])

Thisform.G99545DACA9E54783B9C9CBDB05C4D580.Top = 0
Thisform.G99545DACA9E54783B9C9CBDB05C4D580.Left = 0
Thisform.G99545DACA9E54783B9C9CBDB05C4D580.Width = 1
Thisform.G99545DACA9E54783B9C9CBDB05C4D580.Height = 1
Thisform.G99545DACA9E54783B9C9CBDB05C4D580.Visible = TRUE

Thisform.Draw()

lnDC = GetDc(This.nHosthWnd)

*!* Store standard textbox bordercolor
This.nDefaultBorderColor = GetPixel(m.lnDC, 0, 0)

Thisform.RemoveObject([G99545DACA9E54783B9C9CBDB05C4D580])

ReleaseDC(This.nHosthWnd, m.lnDC)

*!* End of KLUDGE ALERT


Carlos Alloatti
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform