CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2002
    Location
    Czech
    Posts
    251

    Horizontal scrollbar in MDI

    Hi all,
    I have MDI application and a child form which height can be more than a MDI main form. In this case the horizontal scrollbar will be displayed. In the code I need to find out if the scrollbar is displayed or not. I tried HScroll and HorizontalScroll properties, but they always contain false.
    Do they work in MDI, how to find out that please? I am in VS2005, .net 2.0.

    Thanks,
    David

  2. #2
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Horizontal scrollbar in MDI

    IMHO there is no such property in VS 2005. I would use the resize event of the MDI child. There I would check the MDI parents Form size and comparing it with the actual size of my child form , throwing an event when this exceeds size of parent because this is the time when the scroll switches on. Something like that. It may depend a bit on how your application is designed
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  3. #3
    Join Date
    Jan 2002
    Location
    Czech
    Posts
    251

    Re: Horizontal scrollbar in MDI

    thanks for answer Jonny.
    yes, there are. Form has properties HScroll and VScroll properties derived from Control class I think.
    I got the idea with calculation of form height as well, but at the moment I am trying to avoid it (I think I need to calculate with captions, border width etc. to get exact calculation) and looking for a more "cool" solution . If there is no any, then I am going to implement the solution as you suggest.

    thank you,
    David

  4. #4
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Horizontal scrollbar in MDI

    Quote Originally Posted by David Bajgar
    yes, there are. Form has properties HScroll and VScroll properties derived from Control class I think....
    I know that, but you cannot use them for your purpose, as they dont show the actual state. This properties are only a general I would say 'autorisation' for the form to use Hor or ver scroll ability, not the actual state of them. (IMHO there should be additional events to get informed when the scrollbar really appears on screen, but they arn't. There is a Scroll event but this only appears when you are already using the scrollbar. (BTW: I never tried if StyleChanged Property fires when scrollbars appears. Maybe test this, if they are a solution, please post it here, )
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  5. #5
    Join Date
    Jan 2002
    Location
    Czech
    Posts
    251

    Re: Horizontal scrollbar in MDI

    StyleChanged nor Scroll events are not fired when scrollbar appears. I overrided also WndProc to find all messages, but no sensible event.
    API function GetScrollInfo could be a way, but does not work for main form (still returns FALSE), it works OK for child controls like RichTextBox. When I change the property AutoScroll to true then it works fine! but IsMdiContainer property is changed to false automatically. Both properties cannot be true together. Maybe is that some MDI app limitation, strange

    thanks anyway
    Last edited by David Bajgar; August 4th, 2008 at 03:41 PM.

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