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

Thread: what is the best to adjust the position of all controls on the dialog

  1. #1
    Join Date
    Jun 2002
    Location
    China
    Posts
    74

    what is the best to adjust the position of all controls on the dialog

    My problem is :
    when maximizing the dialog , I want to let all controls(buttoon,edit box,label etc.) on it adjust
    their position .How to achieve this and what is the best way?
    thanks.(谢谢!)

  2. #2
    Join Date
    Jul 2001
    Location
    Germany, near Frankfurt
    Posts
    135

  3. #3
    Join Date
    Jun 2002
    Location
    China
    Posts
    74
    thank for the helpful link
    But I want to write my code to achieve that?
    How can I do for the best way?

  4. #4
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    As I recall there are multiple relevant CodeGuru articles. Use them as samples. We don't know what you need so we can't help any more than that. However if you have a specific question then we are much more likely to be able to help.

    In my opinion the best solution is to use a SDI or MDI application with CView as the view. You must write your own code to dynamically create all controls and position them but probably the same code that positions the controls can be used to reposition the controls. This might be a lot of work but it probably is not much more work than if you use a dialog and if you do it this other way then your application is much more flexible.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  5. #5
    Join Date
    Apr 2003
    Posts
    1,755

    Smile

    I made a sample code that will adjust the controls when I you resize the dialog. Look at the code in OnSize.

    Hope it will help you
    Attached Files Attached Files

  6. #6
    Join Date
    Jun 2002
    Location
    China
    Posts
    74
    rxbagain,thank you for your example!
    Your example works well.you are so kind.
    I see your code handle all concolls in the same style and make all of them center on the dialog.
    But there are many controls on my dialog,and some of the controls must position themself when resizing the dialog individually,So I think your method only can solve a part of my troubles.
    So How can I do?I feel iit is possible f I write code to handle every control's position.But Is it the only way?
    I hope to get more helps from you!
    thanks again!

  7. #7
    Join Date
    Apr 2003
    Posts
    1,755

    Smile

    You can set a flags for the controls on where they should go. I modified the code to accomodate other position maintenace such as the control should be on the lower right corner of the dialog, or it sould be on the left or the control should not move. I set the controls' flags on OnInit using SetWindowLong function.

    Hope this will help you
    Attached Files Attached Files

  8. #8
    Join Date
    Jun 2002
    Location
    China
    Posts
    74
    Hi,rxbagain
    thanks a lots for your help!
    You example is good and it is just what I want!
    I think I will get free from my pazzling problem with your this help!
    thanks again!
    非常感谢!

  9. #9
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by weahappy
    非常感谢!
    You are probably using a different font than most of us. This is no problem except I am unable to see what you are saying with this. If what you are saying is important then perhaps we can figure out a way for you to enter it so we can all read it. Otherwise I hope it helps for you to know that probably most of us cannot read it.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  10. #10
    Join Date
    Jun 2002
    Location
    China
    Posts
    74
    oh,I see
    thank for your reminds .
    The characters you just refer are Chinese Character and means
    "thank you very much " in English.
    By the way,I also hope this forum can show this Character correctly someday!

  11. #11
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    I created a reply in the general discussions forum; see Showing Chinese characters in a web page.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

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)