OnCustomDraw Event
Fired when the picture control is done redrawing but before the final image is presented.
Version Introduced: 3.0.5
Definition
OnCustomDraw(DeviceContextHandle, HorzScrollPos, VertScrollPos, Zoom)
Parameters
| Parameter | Description |
|---|---|
| DeviceContextHandle | Handle to the control's background Device Context (DC) |
| HorzScrollPos | The current horizontal scroll position |
| VertScrollPos | The current vertical scroll position |
| Zoom | The current zoom factor |
Remarks
The OnCustomDraw allows developers to add custom on top of the loaded image. After the image is drawn, but before it is rendered to the screen, this event is fired. During this event, the developer can use the supplied Device Context (DC) handle with any GDI32 calls to draw lines, text, etc. However, for this to work, there are a few things to note.
First, the DC's state is saved before firing this event and restored when the event returns, so developers do not need to fret about messing up the state.
Second, do not select new bitmaps into the DC or call SetWindowOrg. Either action will cause the final rendering to fail.
Third, make sure you qualify the event synchronously. For example:
Qualifier = ""
Qualifier\<1\> = 1 ; // Enable the event
Qualifier\<4\> = 2 ; // Make the event synchronous
Send_Message(@Window:".OLE_PICTURE", "QUALIFY_EVENT", "OLE.OnCustomDraw", Qualifier)
The other parameters are provided for convenience. HorzScrollPos and VertScrollPos contain the current scroll position, so developers can offset their renderings so that they appear to scroll along with the image. The Zoom parameter contains the amount the image is scaled. So, a value of 1.0 means there is no zooming, while a value of 2.0 means the image is twice as large. Developers can use this to make there drawing zoom in as well.