CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2003
    Location
    Lisbon
    Posts
    165

    Simple Dialog in SDI

    Hello, my problem:
    Need a dialog box to get 2 coordinates (x,y) to draw a rectangle in the main window!! I have managed to do it but only when I resize the window!
    Probably a stupid question but... Thankx

  2. #2
    Join Date
    May 2000
    Location
    Toronto, ON, Canada
    Posts
    3,573
    Hi,

    After closing the dialog try to invalidate the main window. Look at CWnd::InvalidateRect or SDK
    Code:
    BOOL InvalidateRect(
      HWND hWnd,           // handle to window
      CONST RECT* lpRect,  // rectangle coordinates
      BOOL bErase          // erase state
    );
    Regards,

    Emanuel Vaduva

  3. #3
    Join Date
    Mar 2003
    Location
    Lisbon
    Posts
    165
    Thank you for answering but...
    I have a OnOk function member of MyDialog class that calls Invalidate().
    The ideia is when you press the OK button the figure is placed in the main window!
    I´m still searching for a solution ( i´m a begginer in this matter)
    Thankx again!!

  4. #4
    Join Date
    May 2000
    Location
    Toronto, ON, Canada
    Posts
    3,573
    If you have a pointer to the main wnd in your dialog then call invalidate in OnOK (pMainWnd->InvalidateRect(...)). Otherwise call invalidate for the main wnd after DoModal is finished.
    Regards,

    Emanuel Vaduva

  5. #5
    Join Date
    Mar 2003
    Location
    Lisbon
    Posts
    165
    Hey!!! It works!!
    Thank YOU VERY MUCH!!

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

Featured