Hello Matt,

Tuesday, October 15, 2002, 2:36:50 PM, you wrote:

MT> I am trying to change the background colour of a Mapper Window, so that when
MT> it re-draws, it begins with a black background. At the moment, I draw the
MT> black background using a layer, but this creates a 'flashing' effect when
MT> users pan across the map, which is causing one of my users problems.

MT> I can, of course, change the windows environment to achieve this, but then I
MT> end up with a black background in all in Word too!
I think you cannot do what you wnat using Mapbasic.
Perhaps you can do it when you change Window class member using
SetClassLong function (API).

>From MSDN:

==============================================================================
WM_ERASEBKGND
The WM_ERASEBKGND message is sent when the window background must be erased (for 
example, when a window is resized). The message is sent to prepare an invalidated 
portion of a window for painting. 
A window receives this message through its WindowProc function.

Remarks
The DefWindowProc function erases the background by using the class background brush 
specified by the hbrBackground member of the WNDCLASS structure. If hbrBackground is 
NULL, the application should process the WM_ERASEBKGND message and erase the 
background. 
//Lashin: You dont need to process this message - just modify Window Class Long
==============================================================================
SetClassLong
The SetClassLong function replaces the specified 32-bit (long) value at the specified 
offset into the extra class memory or the WNDCLASSEX structure for the class to which 
the specified window belongs. 

Note  This function has been superseded by the SetClassLongPtr function. To write code 
that is compatible with both 32-bit and 64-bit versions of Windows, use 
SetClassLongPtr. 

DWORD SetClassLong(
  HWND hWnd,       // handle to window
  int nIndex,      // index of value to change
  LONG dwNewLong   // new value
);
Parameters
hWnd [in] Handle to the window and, indirectly, the class to which the window belongs.
nIndex [in] Specifies the 32-bit value to replace. To set a 32-bit value in the extra 
class memory, specify the positive, zero-based byte offset of the value to be set. 
Valid values are in the range zero through the number of bytes of extra class memory, 
minus four; for example, if you specified 12 or more bytes of extra class memory, a 
value of 8 would be an index to the third 32-bit integer. To set any other value from 
the WNDCLASSEX structure, specify one of the following values.
//Lashin: You need modify value of class member at nIndex == GCL_HBRBACKGROUND
GCL_HBRBACKGROUND Replaces a handle to the background brush associated with the class.
======================================================================================
CreateSolidBrush
The CreateSolidBrush function creates a logical brush that has the specified solid 
color. 

HBRUSH CreateSolidBrush(
  COLORREF crColor   // brush color value
);
Parameters
crColor 
[in] Specifies the color of the brush. To create a COLORREF color value, use the RGB 
macro. 
Return Values
If the function succeeds, the return value identifies a logical brush.

If the function fails, the return value is NULL. 


MT> I guess I need to make an API call. I have been playing with SendMessage (in
MT> user32.dll) but I cannot find the message ID required to change a window's
MT> background.

MT> Any ideas?

MT> Matt


-- 
Best regards,
Vladimir Lashin
microOLAP Technologies LLC

-------------------------------------------------------------------------------------------------------
MBBuilder - Visual Development Tool for MapBasic - 
http://www.microolap.com/products/gis/mbbuilder.htm
Raster Handler for ERDAS Imagine to MapInfo - 
http://www.microolap.com/products/gis/imgrhl.htm
MapInfo Callbacks Manager ActiveX - http://www.microolap.com/products/gis/micmx.htm
EasyMap VCL - http://www.microolap.com/products/gis/easymap.htm
-------------------------------------------------------------------------------------------------------

mailto:[EMAIL PROTECTED]
http://www.microolap.com/gis/ - GIS related products



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 3573

Reply via email to