Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

SETDCBRUSHCOLOR

Brooks_Van_Horn
New Contributor I
561 Views

Has the function SETDCBRUSHCOLOR been deprecated and if so how do you change the brush color?

Thanks,

Brooks

0 Kudos
2 Replies
Steve_Lionel
Honored Contributor III
561 Views

No, it hasn't. It ought to be defined in module GDI32, but isn't. You can define your own interface, for example:

interface
function SetDCBrushColor (hdc,color) BIND(C,NAME="SetDCBrushColor")
!DEC$ ATTRIBUTES DEFAULT, STDCALL :: SetDCBrushColor
use IFWINTY
integer(ULONG) :: SetDCBrushColor
integer(HANDLE), intent(IN), value :: hdc
integer(ULONG), intent(IN), value :: color
end function SetDCBrushColor
end interface

 

0 Kudos
Paul_Curtis
Valued Contributor I
561 Views

Interesting...  I use CreateSolidBrush(), which is defined in GDI32, works perfectly.  Note that with this API you have to explicitly clean up with DeleteObject(hbrush) when done.  The MSDN chat on SetDCBrushColor is unclear (to me, at least) about who does the memory management when a stock system brush is replaced with a user brush, so be careful not to create small memory leaks which would be difficult to detect.

0 Kudos
Reply