Re: Win32Lib: Button Color

new topic     » goto parent     » topic index » view thread      » older message » newer message

unknown wrote:
> 
> So what was the verdict on this? I would like to be able to do just
> this.<br>
> <br>
> george<br>
> <br>
> Derek Parnell wrote:
> <blockquote cite="mid359622274-1463792382-1089589004 at boing.topica.com"
>  type="cite">
> 
> 
> cklester wrote:
>     <pre wrap="">Is there a way to set a button color and have it stay that
>     way?
> 
> I'm using setBackColor(myButt, Red )
> 
> and it draws it red until I click on another control, and it
> returns to its normal gray color.
>     </pre>
>   </blockquote>
>   <pre wrap=""><!---->
> I didn't know that one could change the color of a standard 
> PushButton control!
> 
> Can you show me some example code that does that because I can't
> make it happen at all. As far I I know, ou need to have an Owner-Drawn
> type of button.

This effect happens because the clearWindow call drawns a colored rectangle
over the button area, but as soon as Windows gets any event for the button
it redraws the button 'correctly'.
 
There are two main ways to get colored buttons.
(1) Define it as an owner-drawn button and handle the special messages
 (meaning: You do all the graphic work, but you're told when and what to
 do).

(2) Simulate a button with a simple child window. You still get to 
  do all the graphics, and you must handle all the keyboard and
  mouse events too.

In short, its not simple or easy (yet). Maybe in a future release or if
somebody (hint, hint) implements a new type of control.
-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu