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. Panel scrolling

Panel scrolling

Scheduled Pinned Locked Moved C#
questiondata-structures
5 Posts 3 Posters 2 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.
  • B Offline
    B Offline
    blackjack2150
    wrote on last edited by
    #1

    Hi. I want to plot the spectral diagram of a wav file onto a panel, which can be pretty long(the graph). The panel has a limited length, say 400 px. How can I add scroll bars to the Panel, so I can scroll back and forth to see the entire graph? I know that the Panel has a property called Autoscroll, automatically adds H&V scroll bars if there are controls outside the visible area. But nothing similar happens if I programatically draw something outside the panel's client area. Any ideas or suggestions? Thanks.

    H 1 Reply Last reply
    0
    • B blackjack2150

      Hi. I want to plot the spectral diagram of a wav file onto a panel, which can be pretty long(the graph). The panel has a limited length, say 400 px. How can I add scroll bars to the Panel, so I can scroll back and forth to see the entire graph? I know that the Panel has a property called Autoscroll, automatically adds H&V scroll bars if there are controls outside the visible area. But nothing similar happens if I programatically draw something outside the panel's client area. Any ideas or suggestions? Thanks.

      H Offline
      H Offline
      Harini N K
      wrote on last edited by
      #2

      Hi Use DIV section instead of panel. Add your diagram section inside DIV Section and you can set the size for width and height; add the style as OVERFLOW: auto; Hope this solves your problem.

      Harini

      B 1 Reply Last reply
      0
      • H Harini N K

        Hi Use DIV section instead of panel. Add your diagram section inside DIV Section and you can set the size for width and height; add the style as OVERFLOW: auto; Hope this solves your problem.

        Harini

        B Offline
        B Offline
        blackjack2150
        wrote on last edited by
        #3

        I forgot to mention that this is a Windows application, not a web site. Thanks anyway.

        A 1 Reply Last reply
        0
        • B blackjack2150

          I forgot to mention that this is a Windows application, not a web site. Thanks anyway.

          A Offline
          A Offline
          Ajay k_Singh
          wrote on last edited by
          #4

          Put a picture box control in a panel and set its SizeMode property to AutoSize and then set AutoScroll property of Panel to True. Now draw your chart on Picture box instead of Panel. However the most important point is that, in this scenario you will need to reset the width of Picture box according to the increasing size of Graph. Therefore you will have to measure the width of the drawn area and reset width of Picture Box. Following is a small code snippet which I used to test, it draws a long string on a Picturebox and Panel will show scroll bar as expected.- ------------------Code Start------------------------------------------------------ private void PictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics g = e.Graphics; string str = "JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmJJJJJJJJJJJ"; g.DrawString(str, new Font("Arial", 14, FontStyle.Bold, GraphicsUnit.Pixel), Brushes.Black, 50, 50); this.PictureBox1.Width = g.MeasureString(str, new Font("Arial", 14, FontStyle.Bold, GraphicsUnit.Pixel)).Width + 4; } -------------Code End-------------------------------------- I hope this will help you in finding the exact resolution. -Dave.

          Dave Traister, ComponentOne LLC. www.componentone.com

          B 1 Reply Last reply
          0
          • A Ajay k_Singh

            Put a picture box control in a panel and set its SizeMode property to AutoSize and then set AutoScroll property of Panel to True. Now draw your chart on Picture box instead of Panel. However the most important point is that, in this scenario you will need to reset the width of Picture box according to the increasing size of Graph. Therefore you will have to measure the width of the drawn area and reset width of Picture Box. Following is a small code snippet which I used to test, it draws a long string on a Picturebox and Panel will show scroll bar as expected.- ------------------Code Start------------------------------------------------------ private void PictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics g = e.Graphics; string str = "JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmJJJJJJJJJJJ"; g.DrawString(str, new Font("Arial", 14, FontStyle.Bold, GraphicsUnit.Pixel), Brushes.Black, 50, 50); this.PictureBox1.Width = g.MeasureString(str, new Font("Arial", 14, FontStyle.Bold, GraphicsUnit.Pixel)).Width + 4; } -------------Code End-------------------------------------- I hope this will help you in finding the exact resolution. -Dave.

            Dave Traister, ComponentOne LLC. www.componentone.com

            B Offline
            B Offline
            blackjack2150
            wrote on last edited by
            #5

            Thank you! You saved my day and got my 5.

            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