//QM v2.9. Do not edit with text editor!!! //
11    14
å=!+ßCb½6œìR*Ig‹ä[¸[„TÄÓËñ
  Examples  65536 34041023 0

  Macro527  0 34042C58 1
 draws rectangle, filled ellipse, icon and text
int hwnd=OnScreenDraw(300 300 300 200 &OSD_ProcExample 0 160)
2
 OnScreenDrawEnd hwnd
2
	

  OSD_ProcExample  8 345C241A 1
 /Macro527
function hwnd hdc cx cy param

int hpen oldpen hbrush oldbrush oldfont

 create/select pen and draw rectangle
hpen=CreatePen(0 10 0xff0000); oldpen=SelectObject(hdc hpen)
 Rectangle hdc 5 5 cx-10 cy-10 ;;simple
RoundRect hdc 5 5 cx-10 cy-10 20 20 ;;rounded corners

 create/select brush and pen, and draw ellipse
hbrush=CreateSolidBrush(0x00ff00); oldbrush=SelectObject(hdc hbrush)
hpen=CreatePen(0 3 0x00ff00); oldpen=SelectObject(hdc hpen)
Ellipse hdc 50 50 cx-50 cy-50
DeleteObject SelectObject(hdc oldbrush)
DeleteObject SelectObject(hdc oldpen)

 draw icon
int hicon=GetFileIcon("$qm$" 0 1)
DrawIconEx hdc cx/2-16 40 hicon 32 32 0 0 3
DestroyIcon hicon

 draw text
str txt="Some Text"
 create font. To create fonts easily, download CFont class from the forum
#ifdef CFont
CFont hfont.Create("Tahoma" 25 0)
oldfont=SelectObject(hdc hfont)
#endif
 set text color and transparent background
SetTextColor(hdc 0x00ffff)
SetBkMode(hdc TRANSPARENT)
 set rectangle
RECT r
DrawText hdc txt -1 &r DT_CALCRECT
OffsetRect &r 70 80
 draw
DrawText hdc txt -1 &r 0

#ifdef CFont
SelectObject hdc oldfont
#endif

  Macro528  0 34042C4F 1
 draws rectangle of specified color and border
type OSDCOLORANDBORDER color border
OSDCOLORANDBORDER a
a.color=ColorFromRGB(128 0 255)
a.border=10
OnScreenDraw 400 400 100 100 &OSD_ProcExample2 &a
2
	

  OSD_ProcExample2  8 34042B3E 1
 /Macro528
function hwnd hdc cx cy OSDCOLORANDBORDER&a

int hpen oldpen

 create/select pen and draw rectangle
hpen=CreatePen(0 10 a.color); oldpen=SelectObject(hdc hpen)
Rectangle hdc a.border a.border cx-a.border cy-a.border ;;simple
DeleteObject SelectObject(hdc oldpen)

  OnScreenDraw  8 348BDF64 0
 /
function# x y cx cy drawfunction [param] [transparency] [flags] ;;flags: 1 don't adjust coordinates

 Calls an user-defined function to perform on-screen drawing.
 The function can draw anything (shapes, text, icons, etc) using Windows API functions.
 The on-screen image disappears when the macro ends. To remove the image earlier, call OnScreenDrawEnd.
 Returns window handle that can be used with OnScreenDrawEnd. Also can be used to add controls, etc (not tested).
 The dialog background color is transparent, except on Windows 9x.

 x, y, cx, cy - bounding rectangle on screen. Depends on flag 1.
 drawfunction - address of user-defined function that performs drawing. Must begin with:
  function hwnd hdc cx cy param
  Arguments:
  hwnd - transparent window that is used for on-screen drawing.
  hdc - device context.
  cx, cy - width and height of bounding rectangle.
  param - value passed to OnScreenDraw.
 param - value to pass to the draw function.
 transparency - value between 1 (almost transparent) and 255 (opaque). If omitted or 0, the drawn image will be opaque.
 flags:
   1 - don't adjust coordinates. By default, 0 would be interpreted as screen center, and negative - as offset from screen right/bottom.

type OSDA fa param cx cy transp
OSDA* d._new
d.fa=drawfunction
d.param=param
d.cx=cx
d.cy=cy
d.transp=transparency

int hDlg
if(flags&1)
	hDlg=ShowDialog("OSD_Dialog" &OSD_Dialog 0 0 1 0 WS_VISIBLE d)
	mov x y hDlg
	hid- hDlg
else hDlg=ShowDialog("OSD_Dialog" &OSD_Dialog 0 0 1 0 0 d x y)

atend OnScreenDrawEnd hDlg
opt waitmsg 2
0
ret hDlg

  OnScreenDrawEnd  8 34042DC0 0
 /
function hwnd

 Hides on-screen image drawn by OnScreenDraw.
 Must be called from the same thread as OnScreenDraw.

 hwnd - value returned by OnScreenDraw.


DestroyWindow hwnd

  private  65536 34040DDE 0

  OSD_Dialog  8 345C2344 8
\Dialog_Editor
function# hDlg message wParam lParam

 BEGIN DIALOG
 0 "" 0x90000044 0x80000A8 0 0 227 151 "OSD_Dialog"
 END DIALOG
 DIALOG EDITOR: "" 0x2020100 "" ""

OSDA* d
sel message
	case WM_INITDIALOG
	d=+DT_GetParam(hDlg)
	if(d.cx and d.cy) siz d.cx d.cy hDlg
	Transparent hDlg iif(d.transp d.transp 255) GetSysColor(COLOR_BTNFACE)
	
	case WM_DESTROY
	d=+DT_GetParam(hDlg); d._delete
	
	case WM_PAINT
	 begin paint
	PAINTSTRUCT p
	int hdc=BeginPaint(hDlg &p)
	
	 set transparent brush
	int oldbrush=SelectObject(hdc GetStockObject(NULL_BRUSH))
	
	 call user-defined draw function
	d=+DT_GetParam(hDlg)
	RECT rc; GetClientRect hDlg &rc
	call d.fa hDlg hdc rc.right rc.bottom d.param
	
	SelectObject(hdc oldbrush)
	
	 end paint
	EndPaint hDlg &p
	ret 1

  file  268500992 0

  