scrollbars... *sigh*
-
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"
-
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"
-
How about dropping your
PictureBox
(full size) in aPanel
, and let the panel worry about scrolling?Bastard Programmer from Hell :suss:
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"
-
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"
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:
-
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:
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"
-
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 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 scrollablePanel
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 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 scrollablePanel
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:
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"
-
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 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: