CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Dialog dimension

  1. #1
    Join Date
    Oct 2009
    Location
    Holland
    Posts
    201

    Cool Dialog dimension

    Hello,

    Made a dialog.
    when viewing the code using the *.rc option it shows:

    IDD_MAIN_DIALOG DIALOGEX 0, 0, 332, 218

    when running the program, and using the

    pWnd->GetWindowRect(&rcMain);

    the values are:

    top: 334
    bottom: 716
    left: 588
    right: 1092

    do I need to use some kind of a constant, or something like that?

    (Dialog centre option ON, screen res: 1680 x 1050)

    regards,

    ger

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Dialog dimension

    The resource editor measures in "twips".

    http://en.wikipedia.org/wiki/Twip

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: Dialog dimension

    The resource file does not contain absolute coordinates (which would not make much sense). Thus, the top/left for a dialog is 0/0. You can specifically control where it is being displayed by using functions such as 'CenterWindow()' or 'SetWindowPlacement()' and so on....

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,607

    Re: Dialog dimension

    the values are:

    top: 334
    bottom: 716
    left: 588
    right: 1092

    do I need to use some kind of a constant, or something like that?

    (Dialog centre option ON, screen res: 1680 x 1050)
    What for?

    top + bottom = 334 + 716 = 1050
    left + right = 588 + 1092 = 1680

    Your dialog is centered alright. What else is needed?

    Quote Originally Posted by hoxsiew
    The resource editor measures in "twips".
    Dialog Units
    MapDialogRect
    Last edited by Igor Vartanov; April 19th, 2010 at 04:34 AM.
    Best regards,
    Igor

  5. #5
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Dialog dimension

    My bad. I must have misremembered something about VB I think.

  6. #6
    Join Date
    Oct 2009
    Location
    Holland
    Posts
    201

    Re: Dialog dimension

    to igor

    thank you!
    I did not saw the numbers............
    but
    when I put in a button using 166, 196, 50, 14
    it is not in the place I want to
    that is what I meen with using a factor

    regards,
    ger
    Last edited by TBBW; April 20th, 2010 at 03:56 PM.

  7. #7
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,607

    Re: Dialog dimension

    when I put in a button using 166, 196, 50, 14
    it is not in the place I want to
    In case you do that at runtime, you need to MapDialogRect.
    Best regards,
    Igor

  8. #8
    Join Date
    Oct 2009
    Location
    Holland
    Posts
    201

    Re: Dialog dimension

    Oke thanks,

    Now;

    when I have a bitmap image and I want to use it for a button.
    the sizes also do not match
    the bitmap image is 77 x 25
    making a button of that size is not fully correct.

    regards,

    ger

  9. #9
    Join Date
    Oct 2009
    Location
    Holland
    Posts
    201

    Re: Dialog dimension

    Hi,

    Was screeming to soon...
    have to use SizeToContent(), to make the button the same as the image.
    (image is the master, button is slave, correct?)

    and,

    Now I want to make the dialog which hosts this button, the same dimensions as
    the button has. (Yep, it is a very small 1 button dialog)

    is that possible?

    regards,

    ger

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)