How do I change a brush's background color?
cjqp
Printable View
How do I change a brush's background color?
cjqp
cjqp, I looked for answers to your question, and came up with nothing, do you mean "How do I change a control's background color?"
No, here (this is from Dan Appleman's API book):
-Under PaintRgn-
"This function fills the specified region using the current brush background color."
cjqp
Ok I looked in my giant VB API book and I found what you need to use: 'SetBkColor' will set the background for a brush. Here's a few links I found that do this, but I'm not sure what your doing:
http://www.listensoftware.com/hrxp/c...?contentid=581
http://www.vbapihelpline.de/ref/func...Color&Letter=s Last link is in German, but if you look at the code you should get the idea
http://www.developersdex.com/vb/mess...p13.phx.gbl%3E On this 1, ctrl+f to find ''SetBkColor"
I hope this gives you a decent idea or direction of where to go.
Thanks for the help so far! What I'm trying to do is set up a program that will color another window's bg. I have tried the SetBkColor/Mode API, and through what I have discovered I need:
VB Code:
SetBkMode Form1.hdc, 2 SetBkColor Form1.hdc, RGB(0, 0, 255) Dim hBrush As Long hBrush = CreateSolidBrush(RGB(0, 0, 255)) SetBkColor GetDC(hBrush), RGB(0, 0, 255) SelectObject Form1.hdc, hBrush DeleteObject hBrush dargb = CreateRectRgn(0, 0, 1024, 1024) PaintRgn Form1.hdc, dargb
This won't color the form, but commenting out the SelectObject line will color the form the selected FillColor.
Any other ideas?
cjqp
I'm still looking, here's an example of coloring a component using CShape, mabey you could use that some how?
http://www.vb-helper.com/howto_set_frame_backcolor.html
Using the '[Form].BackColor' you can directly change the form's background without using brushes, but not sure how to do so for a different app. http://www.visualbasicforum.com/showthread.php?t=133832
And finally this example looked the most intresting, yet I can't figure out what message needs to be sent instead of "TVM_SETBKCOLOR", so you may have to give it some time. http://www.vb-helper.com/tut10.htm I looked pretty hard and it seems like this topic is a lil scarce on resources. There's plenty of tuts on how to change the backgound color of controls but not the actual forms. Good luck! :wave: