There is a property called ScrollBars, set it to both
Main Topics
Browse All TopicsI have a windows form with the following basic structure....
Picturebox nested on a Panel nested on a ToolStripContainer.Content
I've set the picturebox.sizemode to AutoSize and the Panel.autoscroll property to true.
Next I generate a BMP which exceeds the X and Y bounds of the form and place it as the image on the picturebox.
When I do this the vertical scrollbar shows up but the horizontal scrollbar is missing? What am I missing here??
using System;
using System.Collections.Generic
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace Project1
{
/* DEMO class for exploring behavior of scrollbars,
* dockstyles, and anchorstyles.
*/
class clsGUI : Form
{
ToolStripContainer tscMain = new ToolStripContainer();
ToolStrip tsTop = new ToolStrip();
ToolStrip tsBottom = new ToolStrip();
Panel pnlMain = new Panel();
PictureBox pboxMain = new PictureBox();
public clsGUI()
{
//tool strip container
tscMain.Anchor = AnchorStyles.Top & AnchorStyles.Left;
tscMain.Dock = DockStyle.Fill;
//panel nested on the toolstrip container contentpanel
pnlMain.Anchor = AnchorStyles.Top & AnchorStyles.Left;
pnlMain.Dock = DockStyle.Fill;
pnlMain.AutoScroll = true;
pnlMain.BackColor = Color.DarkGray;
tscMain.ContentPanel.Contr
//picturebox nested on pnlMain
pboxMain.Anchor = AnchorStyles.Top & AnchorStyles.Left;
pboxMain.Dock = DockStyle.Top;
pboxMain.SizeMode = PictureBoxSizeMode.AutoSiz
pnlMain.Controls.Add(pboxM
ToolStripButton tsbtn1=new ToolStripButton("push me",null,loadImage);
tsTop.Items.Add(tsbtn1);
tscMain.TopToolStripPanel.
tscMain.BottomToolStripPan
base.Controls.Add(tscMain)
}
private void InitializeComponent()
{
base.SuspendLayout();
base.Width = 500;
base.Height = 500;
base.CenterToScreen();
this.ResumeLayout(false);
}
private void loadImage(object sender, EventArgs e)
{
Bitmap objBMP = new Bitmap(1000, 1000);
MemoryStream ms=new MemoryStream();
Graphics GFX=Graphics.FromImage(obj
Pen objPen = new Pen(Color.Red);
objPen.Width = 10;
GFX.DrawEllipse(objPen,0,0
objBMP.Save(ms,ImageFormat
pboxMain.Image = Image.FromStream(ms);
}
}
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: mccainz2Posted on 2006-06-07 at 12:00:48ID: 16855208
One thing I have noticed is that if I set my picturebox dockstyle to left I get the horizontal scrollbar but not the vertical and if I set the picturebox dockstyle to top I get the vertical but not the horizontal. Beyond that if I set the dockstyle to Fill I get neither scrollbar.