Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. AutoScroll not working

AutoScroll not working

Scheduled Pinned Locked Moved C#
graphicshelptutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    printscreen12345
    wrote on last edited by
    #1

    I have created graphics on a tabpage but cannot get its autoscroll working at all. Graphics g = tabPage1.CreateGraphics(); g.DrawString("Hello how are you?", new Font("Courier New", 10, System.Drawing.FontStyle.Regular), new SolidBrush(Color.Black), 10, 20); tabPage1.AutoScroll = true; Anybody know how to fix this problem?

    J G 2 Replies Last reply
    0
    • P printscreen12345

      I have created graphics on a tabpage but cannot get its autoscroll working at all. Graphics g = tabPage1.CreateGraphics(); g.DrawString("Hello how are you?", new Font("Courier New", 10, System.Drawing.FontStyle.Regular), new SolidBrush(Color.Black), 10, 20); tabPage1.AutoScroll = true; Anybody know how to fix this problem?

      J Offline
      J Offline
      Josh Smith
      wrote on last edited by
      #2

      AutoScroll is concerned with the location/size of child controls. Rendering a string onto a tabpage has no effect on the logical visible area required to show all child controls, so the autoscrolling is unaffected. I suppose that you could add a Label to the tabpage, set it's Text to the string you are drawing, and position the Label such that it is outside of the currently visible area of the tabpage. Josh

      P 1 Reply Last reply
      0
      • P printscreen12345

        I have created graphics on a tabpage but cannot get its autoscroll working at all. Graphics g = tabPage1.CreateGraphics(); g.DrawString("Hello how are you?", new Font("Courier New", 10, System.Drawing.FontStyle.Regular), new SolidBrush(Color.Black), 10, 20); tabPage1.AutoScroll = true; Anybody know how to fix this problem?

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        No, you have drawn something on the screen where the tabpage happens to be. Whatever you do to the tabpage won't affect what you drew. Actually, anything that makes the tabpage redraw will draw over what you drew. If you want to draw something on the control, you have to use it's Paint event, so that whatever you draw will be redrawn when the control is redrawn. --- b { font-weight: normal; }

        P 1 Reply Last reply
        0
        • J Josh Smith

          AutoScroll is concerned with the location/size of child controls. Rendering a string onto a tabpage has no effect on the logical visible area required to show all child controls, so the autoscrolling is unaffected. I suppose that you could add a Label to the tabpage, set it's Text to the string you are drawing, and position the Label such that it is outside of the currently visible area of the tabpage. Josh

          P Offline
          P Offline
          printscreen12345
          wrote on last edited by
          #4

          Thanks. But it doesn't seem to allow using both label and graphics on the same tabpage !? I used labels before but the display time was very very slow. So I changed to use graphics which can be displayed much much faster. I tried adding a label right after the last graphic object which should be outside of the currently visible area of the tabpage. However, all the graphic objects just blink & disappeared.

          1 Reply Last reply
          0
          • G Guffa

            No, you have drawn something on the screen where the tabpage happens to be. Whatever you do to the tabpage won't affect what you drew. Actually, anything that makes the tabpage redraw will draw over what you drew. If you want to draw something on the control, you have to use it's Paint event, so that whatever you draw will be redrawn when the control is redrawn. --- b { font-weight: normal; }

            P Offline
            P Offline
            printscreen12345
            wrote on last edited by
            #5

            How do I use paint event? When will the paint event be triggered? I need to write different text on a tabpage line by line. Can the paint event draw different strings to a control? Please help!!! I need a solution to it.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups