Hatch with transparent background sometimes working

Paul Thomas
01-31-2005, 07:24 AM
Hi I am using the following function to set null brushes and transparent backgrounds:
Public Function SetBkColour(Mode As Integer, Optional Colour As Long = 0)
Select Case Mode
Case 1
SelectObject hDrawBuffer, GetStockObject(NULL_BRUSH)
SetBkMode hDrawBuffer, 1
Case 2
SetBkMode hDrawBuffer, 2
SetBkColor hDrawBuffer, Colour
End Select
End Function
I works just fine for solid filled shapes and text but it doesn't always work for the hatch background, why is that? If I manage to get it to work as soon as the application is restarted it could be gone again. If I so much as change some calls it is gone again. What could be causing this?

02-01-2005, 12:54 AM
How are you doing the hatch backgrounds -- are you using a backbuffer?

Here's some hatch drawing samples to check out...

"Regions.zip" on this page:

"Draw Hotchpotch" link at the bottom of this page:

Also the CreateHatchBrush API might come in handy.

Paul Thomas
02-02-2005, 08:23 AM
I draw everything to the back buffer then 'paint' it onto the device by doing a copy transfer. I'm not using any masking techniques or anything fancy. I am using the CreateHatchBrush API. This work fine to create hatches, but the background to hatch is determined by setBackgroundColor and setBackGroundMode. However it is not always working. Could it be a caused by a memory leak?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum