CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2008
    Posts
    5

    GDI+ Ruler Problem

    Hi Everyone

    Can someone please assist me with the following : I have attached a basic paint app. The zooming works fine, but the rulers disappear when I scroll horizontally or vertically. I need the rulers to stay fixed like for example MS Word's rulers.

    Thank you very much
    Attached Files Attached Files

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

    Re: GDI+ Ruler Problem

    Quote Originally Posted by ReconMarine
    Hi Everyone

    Can someone please assist me with the following : I have attached a basic paint app. The zooming works fine, but the rulers disappear when I scroll horizontally or vertically. I need the rulers to stay fixed like for example MS Word's rulers.

    Thank you very much
    This is a library my IDE said, so where is a testapp to use this code and to be able to start the application and run it to see your troubles. Is there something missing ?
    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
    Feb 2008
    Posts
    5

    Re: GDI+ Ruler Problem

    Hi

    Yes, I'm sorry, I uploaded the wrong file I see.
    Here's the file that contains the library and the test app.


    Thanks a million!
    Attached Files Attached Files

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

    Re: GDI+ Ruler Problem

    Quote Originally Posted by ReconMarine
    Hi

    Yes, I'm sorry, I uploaded the wrong file I see.
    Here's the file that contains the library and the test app.

    OK.I have done a short look in the moment. How to verify your problem ? As this is an editor obviously so what do I need to do to get your problem on the screen ? I'll have more time to look on it in the evening. ( its just 14h here now )
    Last edited by JonnyPoet; February 14th, 2008 at 07:56 AM.
    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
    Feb 2008
    Posts
    5

    Re: GDI+ Ruler Problem

    Thanks a lot for the help, I appreciate it.
    You have to zoom in until the horizontal and vertical scrollbars appear.
    Then when you scroll down or to the right, you will see the rulers are not shown anymore.
    I have tried everything to move the rulers as the user scrolls, but to no avail.
    What I need is that as the user scrolls, the rulers must still be visible.

    Thanks a million.

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

    Re: GDI+ Ruler Problem

    Quote Originally Posted by ReconMarine
    .....I have tried everything to move the rulers as the user scrolls, but to no avail.
    What I need is that as the user scrolls, the rulers must still be visible.
    ....
    What you gave me the rulers still are there but they dont scroll. Do simple the following in the DocumentArea class
    1) Add a Scroll delegate to panel1
    Code:
    private void panel1_Scroll(object sender, ScrollEventArgs e) {
    	 if (e.ScrollOrientation == ScrollOrientation.HorizontalScroll) {
    		 this.hRuler1.RulerMargin = this.drawArea1.Left + this.hRuler2.Width;
    	 }
    	 if (e.ScrollOrientation == ScrollOrientation.VerticalScroll) {
    		 this.hRuler2.RulerMargin = this.drawArea1.Top;
    	 }
    }
    Then your rulers will scroll with your aerea. Hope this helps. Vienna is greeting France

    BTW: Excellent design, great code !
    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

  7. #7
    Join Date
    Feb 2008
    Posts
    5

    Re: GDI+ Ruler Problem

    Thanks a lot for your trouble!! It works perfectly now! I can't believe I missed something so obvious

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

    Re: GDI+ Ruler Problem

    Quote Originally Posted by ReconMarine
    Thanks a lot for your trouble!! It works perfectly now! I can't believe I missed something so obvious
    No problem. It was a pleasure to help in such a great design. I thought, that this was obviously only forgotten to add, as in the resize delegate you have it. BTW Dont forget to use threadtools and sign post as resolved.
    And as this seems me to be a professional project -- remove the zips.
    Last edited by JonnyPoet; February 15th, 2008 at 06:45 AM.
    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

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