Greg Ewing wrote:
Has anyone successfully used the PyCWnd.OnCtlColor
virtual function to change the appearance of a
control?

The program below tries to use it to set the colour
of the text in a PyCButton. My OnCtlColor method gets
called, but it doesn't have any effect on the appearance
of the button.

Also, if I attempt to return a PyCBrush from the
OnCtlColor method as the docs suggest, I get
"TypeError: An integer is required" errors.

Am I doing something wrong?

OnCtlColor is expected to return a GDI handle rather than a full
MFC object.  Try something like:

return win32gui.CreateSolidBrush(win32api.RGB(255,0,0)).Detach()

      Roger

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to