CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Location
    Spain
    Posts
    335

    Property sheets moving buttons, Why this don't works ?

    Hi,

    I have one property sheet wit only one button ( Ok button), and I want to move it to the right ( put it in the help button position), I have make a little test with this:

    CRect rectBtn;

    pOkButton->GetWindowRect(rectBtn);
    rectBtn.left = rectBtn.left+5;
    rectBtn.right = rectBtn.right+5;
    pOkButton->MoveWindow(rectBtn);

    But then when the property sheet is shown, the button is not shown !, What have I made wrong ? Is another way to do it easier ?

    Thanks, Bye !
    Braulio


  2. #2
    Join Date
    May 1999
    Posts
    116

    Re: Property sheets moving buttons, Why this don't works ?

    GetWindowRect returns screen coordinates.
    MoveWindow expects coordinates relative to the parent window.

    You are actually moving the button off the property sheet.

    After calling GetWindowRect, call ScreenToClient.. like this:CRect rectBtn;

    pOkButton->GetWindowRect(rectBtn);


    ScreenToClient(&rectBtn);


    rectBtn.left = rectBtn.left+5;
    rectBtn.right = rectBtn.right+5;
    pOkButton->MoveWindow(rectBtn);


    Rgds,
    Brian




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