Results 1 to 9 of 9

Thread: Drawing in a dialog box

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    4

    Unhappy Drawing in a dialog box

    I'm trying to draw a graph on a dialog box for a numerical solution program I'm writing. I can draw on an SDI window, but I can't figure out how to draw on a dialog box, and it's driving me nuts. I'm using VC++ 6. Thanks

  2. #2
    Fanatic Member twanvl's Avatar
    Join Date
    Dec 2001
    Posts
    771
    Are you using MFC?

    In WinAPI it's pretty much the same as with a normal window. You just handle the WM_PAINT message in the DialogProc. You can then get a hDC with BeginPaint

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    4
    I am using MFC. If there's a better way to do it, I'm all ears. Thanks

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    4
    I am using MFC. If there's a better way to do it, I'm all ears. Thanks

  5. #5
    New Member
    Join Date
    May 2002
    Posts
    13
    use OnPaint method in your derived class from CDialog to do this.
    OK.

  6. #6

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    4
    I'm a little new to VC++ Can anyone give me an example of some code to draw a line somewhere on a dialog box? Thanks.

  7. #7
    New Member
    Join Date
    May 2002
    Posts
    13
    this is an example !
    OK
    Attached Files Attached Files

  8. #8
    Lively Member
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    83
    C examples of API calls for common dialoge boxes. With many other examples in different languages.

    http://users.chariot.net.au/~akia/Home.htm

  9. #9
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    Unhappy Hi

    Hi,

    How to draw lines or any other on a Dialog Box.

    I want to draw lines when I move my mouse...

    How can I do it.. I am Using VC++ 6.0.


    I have already tried using .. But no good..

    Help me out....

    Code:
    void CPaintBDlg::OnLButtonDown(UINT nFlags, CPoint point) 
    {
    static CPoint p;	
    CPaintDC dc(this);
    	
    CPen * myPen = new CPen(PS_SOLID,2,RGB(255,0,0));
    	
    dc.SelectObject(myPen);
    
    dc.MoveTo(p.x,p.y);
    dc.LineTo(point.x,point.y);
    p.x=point.x;
    p.y=point.y;
    delete myPen;	
    
    CDialog::OnLButtonDown(nFlags, point);
    }
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width