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. scrollbars... *sigh*

scrollbars... *sigh*

Scheduled Pinned Locked Moved C#
helpquestion
8 Posts 2 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.
  • L Offline
    L Offline
    l a u r e n
    wrote on last edited by
    #1

    this is a really boring question so sorry in advance... i am writing a pdf viewer (don't ask why or i'll have to kill you) and have most of the code working BUT the scrollbars are driving me slightly nutz i have the picturebox control set to autosize inside of a panel set to autoscroll when i set the (generated) image into the picturebox i get a vscrollbar (as expected) and no hscrollbar (again as expected because i resize the form client area to fit the width of the page i'm displaying) when i shrink the window (with the mouse) i would have expected the hscrollbar to show up but no .. it doesn't i do catch the form resize event and if the the client area is wider than the page being displayed i change the picturebox size mode to centered so it looks nice otherwise i have tried all the 217 posts i have read on the net and they all say the same thing and they all don't work for me here any help greatly appreciated :)

    "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

    L 1 Reply Last reply
    0
    • L l a u r e n

      this is a really boring question so sorry in advance... i am writing a pdf viewer (don't ask why or i'll have to kill you) and have most of the code working BUT the scrollbars are driving me slightly nutz i have the picturebox control set to autosize inside of a panel set to autoscroll when i set the (generated) image into the picturebox i get a vscrollbar (as expected) and no hscrollbar (again as expected because i resize the form client area to fit the width of the page i'm displaying) when i shrink the window (with the mouse) i would have expected the hscrollbar to show up but no .. it doesn't i do catch the form resize event and if the the client area is wider than the page being displayed i change the picturebox size mode to centered so it looks nice otherwise i have tried all the 217 posts i have read on the net and they all say the same thing and they all don't work for me here any help greatly appreciated :)

      "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      How about dropping your PictureBox (full size) in a Panel, and let the panel worry about scrolling?

      Bastard Programmer from Hell :suss:

      L 1 Reply Last reply
      0
      • L Lost User

        How about dropping your PictureBox (full size) in a Panel, and let the panel worry about scrolling?

        Bastard Programmer from Hell :suss:

        L Offline
        L Offline
        l a u r e n
        wrote on last edited by
        #3

        ummmmm that's what i am doing no? :confused:

        "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

        L 1 Reply Last reply
        0
        • L l a u r e n

          ummmmm that's what i am doing no? :confused:

          "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          With the picturebox as large as the picture is, so it can scroll inside it's container? The code below worked for me; is your picturebox by any chance smaller than it's container?

          public partial class Form1 : Form
          {
              Panel somePanel;
              PictureBox somePictureBox;
              public Form1()
              {
                  InitializeComponent();
          
                  this.somePanel = new Panel()
                  {
                      Dock = DockStyle.Fill,
                      AutoScroll = true,
                  };
                  this.somePictureBox = new PictureBox()
                  {
                      Size = Screen.PrimaryScreen.WorkingArea.Size,
                      BackColor = Color.Blue
                  };
                  this.somePanel.Controls.Add(somePictureBox);
                  this.Controls.Add(this.somePanel);
              }
          }
          

          Bastard Programmer from Hell :suss:

          L 1 Reply Last reply
          0
          • L Lost User

            With the picturebox as large as the picture is, so it can scroll inside it's container? The code below worked for me; is your picturebox by any chance smaller than it's container?

            public partial class Form1 : Form
            {
                Panel somePanel;
                PictureBox somePictureBox;
                public Form1()
                {
                    InitializeComponent();
            
                    this.somePanel = new Panel()
                    {
                        Dock = DockStyle.Fill,
                        AutoScroll = true,
                    };
                    this.somePictureBox = new PictureBox()
                    {
                        Size = Screen.PrimaryScreen.WorkingArea.Size,
                        BackColor = Color.Blue
                    };
                    this.somePanel.Controls.Add(somePictureBox);
                    this.Controls.Add(this.somePanel);
                }
            }
            

            Bastard Programmer from Hell :suss:

            L Offline
            L Offline
            l a u r e n
            wrote on last edited by
            #5

            eddy thnx for the reply again i see that you are making your picturebox a fixed size yes? mine has to change as they zoom in and out of the "image" as well as scroll i have it kind of working (god only know how) but i know the code is horrendous as it has a bunch of "magic fudge factors" in it as i am not familiar enough with .NET / C# and graphics etc i think i am not getting the actual screen dpi for the bitmap dpi, as that means i need to do some rather opaque calcs on the scaling factor for the pdf renderer and and and... *sigh* i think if i had a fixed size picturebox the code would work properly as that is a "trivial" case yes?

            "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

            L 1 Reply Last reply
            0
            • L l a u r e n

              eddy thnx for the reply again i see that you are making your picturebox a fixed size yes? mine has to change as they zoom in and out of the "image" as well as scroll i have it kind of working (god only know how) but i know the code is horrendous as it has a bunch of "magic fudge factors" in it as i am not familiar enough with .NET / C# and graphics etc i think i am not getting the actual screen dpi for the bitmap dpi, as that means i need to do some rather opaque calcs on the scaling factor for the pdf renderer and and and... *sigh* i think if i had a fixed size picturebox the code would work properly as that is a "trivial" case yes?

              "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              l a u r e n wrote:

              i see that you are making your picturebox a fixed size yes?

              Yup :)

              l a u r e n wrote:

              i think if i had a fixed size picturebox the code would work properly as that is a "trivial" case yes?

              It should be. You could try putting the PictureBox in a fixed-size container, and have that in a scrollable Panel again.

              l a u r e n wrote:

              i have it kind of working

              In a typical Dilbert-comic that gets translated to "it's ready to ship"! :cool:

              Bastard Programmer from Hell :suss:

              L 1 Reply Last reply
              0
              • L Lost User

                l a u r e n wrote:

                i see that you are making your picturebox a fixed size yes?

                Yup :)

                l a u r e n wrote:

                i think if i had a fixed size picturebox the code would work properly as that is a "trivial" case yes?

                It should be. You could try putting the PictureBox in a fixed-size container, and have that in a scrollable Panel again.

                l a u r e n wrote:

                i have it kind of working

                In a typical Dilbert-comic that gets translated to "it's ready to ship"! :cool:

                Bastard Programmer from Hell :suss:

                L Offline
                L Offline
                l a u r e n
                wrote on last edited by
                #7

                hehe yah no... not in my world right now it is working but i *know* parts of it are not written properly so i have to figure those bits out and make them right i have a proof of concept that is *good enough* to show the general approach and UI work but that sure as hell isn't a "product" last 10% of the code == 90% of the time *sigh* anyways i will be asking embarrassingly dumb questions in the next few days i'm sure but that's what 9yrs of web dev does for a programmer :~

                "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

                L 1 Reply Last reply
                0
                • L l a u r e n

                  hehe yah no... not in my world right now it is working but i *know* parts of it are not written properly so i have to figure those bits out and make them right i have a proof of concept that is *good enough* to show the general approach and UI work but that sure as hell isn't a "product" last 10% of the code == 90% of the time *sigh* anyways i will be asking embarrassingly dumb questions in the next few days i'm sure but that's what 9yrs of web dev does for a programmer :~

                  "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  l a u r e n wrote:

                  last 10% of the code == 90% of the time

                  Yup, last few percentages may take a bit long.

                  l a u r e n wrote:

                  anyways i will be asking embarrassingly dumb questions in the next few days

                  There's no such thing as a dumb question, only posts without PRE tags. ..and some without a question at all, or with advertising.

                  Bastard Programmer from Hell :suss:

                  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