Re: [Dev-C++] Whoops - drawing in Windows
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Carlos d. M. <cg...@wo...> - 2002-10-24 14:23:52
|
You can create a DC where you select a bitmap, you draw in that bitmap an=
d you
BitBlt to the window each time you need it: when sizing and restoring, wh=
en you
draw something...
Daniel Glenfield escribi=F3:
> Nope maybe not, serialising is for saving and restoring.
>
> I think you have to store the info in to an array, but looking at this =
old
> code I cannot remember what exactly you have to do. I worked on the Scr=
ibble
> tutorial that comes with VC++ - have a look on MSDN for it.
>
> >From: "Vlada Djurovic" <dj...@im...>
> >To: "'DevC++ help'" <dev...@li...>
> >Subject: [Dev-C++] drawing in Windows
> >Date: Thu, 24 Oct 2002 10:32:16 +0200
> >
> >Hi, everybody
> >Here's my problem: I'm trying to write a simple drawing app (just for
> >exercise) and so far its been going OK. I can draw lines in client are=
a in
> >different colors, but when ever I minimize or maximize the window, or
> >something similar happenes, all the content of the window is gone. I t=
ried
> >to use a memory DC an bitmap to save the contents in, and BitBlt it ba=
ck in
> >response to WM_PAINT message, but the program just "froze". Can anybod=
y
> >give me a hint how to do it? Here's the code used for drawing lines wi=
thout
> >any restoring parts:
> >
> > case WM_MOUSEMOVE:
> > {
> > switch(iTool) /* iTool is used for dtetrmining =
which
> >drawing tool is selected(line, rect etc.)*/
> > {
> > case 0:
> > {
> > if(wParam=3D=3DMK_LBUTTON) /*if line is selecte=
d
> >(itool=3D0) and left button presed*/
> > {
> > HDC hDC=3DGetDC(hwnd);
> >
> > HPEN hPen=3DCreatePen(PS_SOLID,iCurWidth,crCur=
Color);
> > HPEN hOldPen=3D(HPEN)SelectObject(hDC,hPen);
> > CLine* pLine=3Dnew
> >CLine(ptPrevPos,MAKEPOINTS(lParam),iCurWidth,crCurColor); /*create new=
line
> >object*/
> > pLine->DrawLine(hDC);
> > ptPrevPos=3DMAKEPOINTS(lParam);
> > SelectObject(hDC,hOldPen);
> > DeleteDC(hDC);
> > }
> > }
> > break;
> > case 1: /* nothing here yet*/
> > break;
> > }
> > }
>
> _________________________________________________________________
> Get a speedy connection with MSN Broadband. Join now!
> http://resourcecenter.msn.com/access/plans/freeactivation.asp
>
> -------------------------------------------------------
> This sf.net email is sponsored by: Influence the future
> of Java(TM) technology. Join the Java Community
> Process(SM) (JCP(SM)) program now.
> http://ad.doubleclick.net/clk;4729346;7592162;s?http://www.sun.com/java=
vote
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|