bman
New Member
Posts: 6
|
Post by bman on May 25, 2023 18:28:58 GMT -5
Is it possible to write text without a background color so that it looks natural on a bmp image?
|
|
|
Post by Brandon Parker on May 25, 2023 20:32:02 GMT -5
Here is a nice example from Alyce Watson... See if you can work through her example and use the functions to suit your needs. alycesrestaurant.com/setbkmode.htm{:0) Brandon Parker
|
|
bman
New Member
Posts: 6
|
Post by bman on May 27, 2023 11:18:45 GMT -5
Here is a nice example from Alyce Watson... Thanks Brandon. I've been trying without success to get the code to work on a graphics window. Any advice for doing that?
|
|
|
Post by Brandon Parker on May 27, 2023 13:59:41 GMT -5
Do you mean like this? I just updated Alyce's code to use a Graphic Window instead of a GraphicBox and changed it enough to post it here...
NoMainWin WindowWidth = 400 WindowHeight = 350
Open "SetBkMode" For Graphics As #Test #Test "TrapClose quit" #Test "Font Arial 18 Bold" #Test "Down; Fill DarkPink" #Test "BoxFilled 200 350" #Test "BackColor DarkGreen; Color DarkBlue" 'get handle of graphic window hGBox = Hwnd(#Test)
'get device context handle of graphicbox CallDLL #user32, "GetDC", hGBox As ulong, _ 'handle of graphicbox gDC As ulong 'device context
CallDLL #gdi32, "SetBkMode", gDC As ulong, _ 'handle of graphicbox _TRANSPARENT As long, _ 'flag for transparent background result As long 'previous bkmode
'To see the difference, set background mode to opaque 'by un-remming the following lines 'CallDLL #gdi32, "SetBkMode", gDC As ulong,_ 'handle of graphicbox ' _OPAQUE As long,_ 'flag for opaque background ' result As long 'previous bkmode
'you must free the device context callDLL#user32,"ReleaseDC", hGBox As ulong, _ 'graphicbox handle gDC As ulong, _ 'device context result As long
#Test "\\ Transparent BkMode" #Test "\\ No darkgreen behind text." #Test "Flush" Wait
Sub quit handle$ Close #handle$ End End Sub
{:0)
Brandon Parker
|
|
bman
New Member
Posts: 6
|
Post by bman on May 28, 2023 21:25:07 GMT -5
Thanks Brandon. Code is working great. I really appreciate the help.
|
|
|
Post by Brandon Parker on May 28, 2023 21:26:34 GMT -5
bman, Did you mean to ask a question or make a statement?
{:0)
Brandon Parker
|
|