code
New Member
Posts: 30
|
Post by code on Jan 19, 2021 12:44:22 GMT -5
Hi,
Any sugestions ?
Thx.
|
|
|
Post by Brandon Parker on Jan 19, 2021 13:16:11 GMT -5
Can you elaborate on what exactly you mean?
{:0)
Brandon Parker
|
|
|
Post by tsh73 on Jan 19, 2021 13:17:33 GMT -5
Please be more specific.
|
|
code
New Member
Posts: 30
|
Post by code on Jan 19, 2021 13:40:03 GMT -5
Ok,
It has to do with :
h=hwnd(#scr) open "gdi32" for dll as #co CallDLL #co, "CombineRgn",x1 as long,x2 as long,x3 as long,x4 as long, CombineRgn as long
open "user32" for dll as #sw CallDLL #sw, "SetWindowRgn",h as long,x2 as long,x3 as long, SetWindowRgn as long
=================
Each pixel is a CreateRectRgn (A rectangle 1 by 1), if its not the color of the window itself....
|
|
|
Post by Brandon Parker on Jan 19, 2021 13:57:44 GMT -5
I still do not understand what you are trying to accomplish. Are you trying to draw text/figures on a window? If so then the easiest way is using LB's built-in GraphicBox.
{:0)
Brandon Parker
|
|
code
New Member
Posts: 30
|
Post by code on Jan 19, 2021 14:05:26 GMT -5
|
|
|
Post by Rod on Jan 19, 2021 14:17:31 GMT -5
Why do we need complicated region API code to draw text? What is wrong with statictext? If you are using regions you will need to post the errant code. It is far too complex for us to guess our way to a solution.
|
|
code
New Member
Posts: 30
|
Post by code on Jan 19, 2021 14:22:11 GMT -5
|
|
|
Post by Rod on Jan 19, 2021 15:43:31 GMT -5
'ShapedDemo1.bas - Janet Terra 'Demo to accompany 'Demo - Creating a Nonrectangular Window 'LBPE July, 2011 'Originally appeared in 'LB Newsletter #132, May, 2005 Nomainwin 'Define the Window WindowWidth = 500 WindowHeight = 500 UpperLeftX = int((DisplayWidth-WindowWidth)/2) UpperLeftY = int((DisplayHeight-WindowHeight)/2) graphicbox #ShapeWindow.gb, 0, 0, 500, 500 stylebits #ShapeWindow.gb, 0, _WS_BORDER, 0, 0 'Keep the Shaped Window in the Forefront stylebits #ShapeWindow, 0, 0, _WS_EX_TOPMOST, 0 open "Shape Window" for window_popup as #ShapeWindow #ShapeWindow "trapclose [closeShapeWindow]" 'Obtain the Handles and Device Controls hBw = hWnd(#ShapeWindow) hBgb = hWnd(#ShapeWindow.gb) hDCw = GetDC(hBw) hDCgb = GetDC(hBgb) 'Draw the Shape #ShapeWindow.gb "Down" gosub [drawShape] 'Set background to Transparent call SetBkMode hDCgb, 1 'Release memory call ReleaseDC hBgb, hDCbg 'Format Text #ShapeWindow.gb "font Courier_New 14 Bold" #ShapeWindow.gb "color Black; place 120 150" #ShapeWindow.gb "\Alt-F4 to Close" #ShapeWindow.gb "flush" wait [closeShapeWindow] 'Delete API created objects before closing program call DelObject hBw close #ShapeWindow end [drawShape] 'Original values for hRgn is meaningless hRgn = RectRegion(0, 0, 0, 0) 'hRgn1 = Elliptical Source Region hRgn1 = EllipticRegion(100, 50, 200, 250) 'Paint the Ellipse Red brushColor1 = 255 'Red Brush hBrush1 = createBrush(brushColor1) call SelObject hDCw, hBrush1 call PaintRegion hDCw, hRgn1 call DelObject hBrush1 'Set hRgn to the Combination of itself and hRgn1 newRgn = CombineRgn(hRgn, hRgn, hRgn1, _RGN_OR) 'Delete hRgn1 call DelObject hRgn1 'hRgn2 = Rectangular Source Region hRgn2 = RectRegion(150, 75, 300, 200) 'Paint the rectangle blue brushColor2 = 255 * 256^2 'Blue Brush hBrush2 = createBrush(brushColor2) call SelObject hDCw, hBrush2 call PaintRegion hDCw, hRgn2 call DelObject hBrush2 'Set hRgn to the Combination of itself and hRgn2 newRgn = CombineRgn(hRgn, hRgn, hRgn2, _RGN_OR) 'Delete hRgn2 call DelObject hRgn2 'Set hRgn as the Window call SetWindowRgn hBw, hRgn, 1 return function GetDC(hW) calldll #user32, "GetDC", _ hW as ulong, _ GetDC as ulong end function function RectRegion(ulx, uly, width, height) calldll #gdi32, "CreateRectRgn", _ ulx as long, _ uly as long, _ width as long, _ height as long, _ RectRegion as ulong end function function EllipticRegion(ulx, uly, width, height) calldll #gdi32, "CreateEllipticRgn", _ ulx as long, _ uly as long, _ width as long, _ height as long, _ EllipticRegion as ulong end function function CombineRgn(hDest, hSource1, hSource2, combineMode) calldll #gdi32, "CombineRgn", _ hDest as ulong, _ hSource1 as ulong, _ hSource2 as ulong, _ combineMode as long, _ CombineRgn as ulong end function function createBrush(brushColor) calldll #gdi32, "CreateSolidBrush", _ brushColor as long, _ createBrush as ulong end function sub PaintRegion hDC, hRgn calldll #gdi32, "PaintRgn", _ hDC as ulong, _ hRgn as ulong, _ null as long end sub sub DelObject hObject calldll #gdi32, "DeleteObject",_ hObject as ulong,_ null as long end sub sub SelObject hDC, hBrush calldll #gdi32, "SelectObject", _ hDC as ulong, _ hBrush as ulong, _ null as long end sub sub ReleaseDC hWnd, hDC calldll #user32,"ReleaseDC", _ hWnd as ulong,_ hDC as ulong, _ null as long end sub sub SetWindowRgn hWnd, hRgn, redrawMode calldll #user32, "SetWindowRgn",_ hWnd as ulong,_ hRgn as ulong,_ redrawMode as long,_ SetWindowRgn as long end sub sub SetBkMode hDC, flag calldll #gdi32, "SetBkMode", _ hDC as ulong,_ flag as long, _ null as long end sub
|
|
code
New Member
Posts: 30
|
Post by code on Jan 19, 2021 18:06:41 GMT -5
Thats pretty cool code ... Thx Rod! (and Janet)
|
|