Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
On-screen drawing
Functions and examples of on-screen drawing.
You can draw anything (various shapes, text, icons, etc) using Windows API functions.

Drawing functions are documented in the MSDN Library.

Minimum QM version 2.2.0.

Attached Files
.qml   On-screen draw.qml (Size: 4.68 KB / Downloads: 1,091)
i figured out how to get the taskbar background and draw
it to the hdc (testing in OSD_ProcExample).
can you tell me how to set the background of ToolbarWindow32 ?
do i have to use NMTBCUSTOMDRAW like in Dialog Explorer for LV and TV ?

Copy      Help
int _hTheme=OpenThemeData(0 L"Taskbar")
RECT r2.left=0;r2.right=100;; r2.bottom=30
DrawThemeBackground(_hTheme hdc WP_CAPTION 0 &r2 0)

i tried this in my taskbar dialog, but i guess its nonsense ...
htb is the handle of ToolbarWindow32.

Copy      Help
,case WM_PAINT
,,int hdc=BeginPaint(htb &pa)
,,int _hTheme=OpenThemeData(0 L"Taskbar")
,,RECT rc;GetClientRect htb &rc
,,DrawThemeBackground(_hTheme hdc WP_CAPTION 0 &rc 0)
,,EndPaint htb &pa
If ToolbarWindow32 is transparent, you can draw on hDlg, on WM_ERASEBKGND message. It is easier than to use toolbar custom draw feature.

Copy      Help
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("Dialog36" &Dialog36)) ret

;0 "" 0x90CC0A44 0x100 0 0 217 129 "Dialog"
;3 ToolbarWindow32 0x54018800 0x0 0 0 217 17 ""
;DIALOG EDITOR: "" 0x2020100 "" ""

sel message
,int htb=id(3 hDlg)
,int il1=ImageList_LoadImage(0 _s.expandpath("$qm$\de_ctrl.bmp") 16 0 0xFF00FF IMAGE_BITMAP LR_LOADFROMFILE)
,SendMessage htb TB_SETIMAGELIST 0 il1
,ARRAY(TBBUTTON) a.create(3)
,ARRAY(str) as="One[]Two[]Three"
,int i
,for i 0 a.len
,,TBBUTTON& t=a[i]
,,t.iString=SendMessage(htb TB_ADDSTRINGA 0 as[i])
,SendMessage(htb TB_BUTTONSTRUCTSIZE sizeof(TBBUTTON) 0)
,SendMessage(htb TB_ADDBUTTONS a.len &a[0])
,SendMessage id(3 hDlg) TB_AUTOSIZE 0 0
,case WM_COMMAND goto messages2
,RECT rc; GetClientRect hDlg &rc
,int hdc=wParam
,FillRect hdc &rc COLOR_BTNFACE+1
,OSD_ProcExample hDlg hdc rc.right rc.bottom 0
,ret DT_Ret(hDlg 1)
ret 1
this is AWESOME!!!
cant wait to start using it.
An old blog on QM coding and automation.

The Macro Hook
Hey, when ever i try to use this, i get this error...

Error (RT) in OSD_Dialog: invalid pointer

and it goes to this in the OSD_Dialog Function...

Copy      Help
,if( and siz hDlg
Quote:Minimum QM version 2.2.0.
I have QM Version
Then maybe you somehow use old version of System folder. Can you post function DefDialogProc? It is in System\Dialogs\Dialog Functions\Private.
Here is

Copy      Help
function# hDlg message wParam lParam

;ShowDialog uses this function as dialog
;procedure when dlgproc is omitted or 0.

sel message
,DT_Init(hDlg lParam)
,ret 1
,int msg(wParam >> 16) ctrlid(wParam & 0xFFFF)
,sel msg
,,if(ctrlid=IDCANCEL) DT_Cancel hDlg
,,else if(GetWinStyle(lParam)&15<2) DT_Ok hDlg ctrlid
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
It is from QM 2.1.8.

If you for some reason don't want to use System of QM 2.2.0, you can probably make OSD_Dialog work with your System version. Add DT_Init and DT_DeleteData, like it is in all other QM 2.1.8 dialogs.
is it possible to attach a rectangle to a window ?
i mean that it follows the window when moving.

in my program i have a static with a colormap.bmp and notify.
its easy to get color values from mouse position.
now i need a solution to display the picked color as rectangles.

one idea is to use datagrid cells because the rest of the info
is there also visible.
my client needs up to three colors for a product (per row).

all what i found for individual cell background has to do with paint/draw.

another idea is define a virtual grid for painting.

Forum Jump:

Users browsing this thread: 1 Guest(s)