Link to home
Start Free TrialLog in
Avatar of jaydeep
jaydeep

asked on

Device context of dialogbox

i want to use graphic gunction line recrcangle /LineTO/MoveTo on dialog box.
i don't know how to get dc of that & where to write code ?
Avatar of mikeblas
mikeblas

Add a handler for WM_PAINT.

In that handler, create a local instance of CPaintDC.  Use the CPaintDC for your painting.

..B ekiM
Hi,

We can use CClientDC as

CClientDC dc(this);
dc.MoveTo(10,10);
dc.LineTo(100,100);

Try it out.
VinExpert
Avatar of jaydeep

ASKER

Hello mikeblas & vinexpert
you can't add WM_PAINT handler to CDialog class.there is WM_CTLCOLOR handler which is for controls.you can't draw on dialog box.
Also by declaring object of CClientDC
it doesn't work .
i have tried it.

Avatar of jaydeep

ASKER

Hello mikeblas & vinexpert
you can't add WM_PAINT handler to CDialog class.there is WM_CTLCOLOR handler which is for controls.you can't draw on dialog box.
Also by declaring object of CClientDC
it doesn't work .
i have tried it.

Hi,

I was able to draw the line on the dialog's client area by using

CClientDC dc(this);
dc.MoveTo(10,10);
dc.LineTo(100,100);

Try it out.
VinExpert
ASKER CERTIFIED SOLUTION
Avatar of mikeblas
mikeblas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Why a "B" and not an "A"? What more information did you need?

..B ekiM