VScrollbar

G

Guest

Hi,all.

It is so stupid question.

I want to add a vertical scroll bar to my form, but I can not.
On my Form: I add a Panel, and add my VScrollbar to Panel
or directly add VScrollbar to Form
Both of them do not work.


My source is below:
public calss myFrom:From
{
private TabControl pageTabControl;
private Panel tabPanel;
private VScrollBar vs;
public myForm
{
pageTabControl = new TabControl();
tabPanel = new Panel();
vs = new VScrollBar();
vs.Maximum = 1000;
vs.Minimum = 0;
vs.Location = new Point(10, 10);
vs.Enabled = true;
vs.Width = 12;

InitializeComponent();

tabPanel.Controls.Add(pageTabControl);
tabPanel.Controls.Add(vs);

//this.Controls.Add(vs);
this.Controls.Add(tabPanel);

}
private void InitializeComponent()
{
...
...
DisplayForm()
...
...
}
private void DisplayForm()
{
TabPage tp = new TabPage();
Panel sPanel = new Panel();

sPanel .Controls.Add(new CheckBox());
tp.Controls.Add(sPanel);
pageTabControl.Controls.Add(tp);

tp = new TabPage();
sPanel = new Panel();
sPanel.COntrols.Add(new RadioBox());
tp.Controls.Add(sPanel);
pageTabControl.Controls.Add(tp);
}
}

thanks.
 
P

Paul G. Tobey [eMVP]

"Do not work" isn't quite enough information, probably. What happens?

Paul T.
 
G

Guest

Sorry,
I got it work,

It because I first add VCSrollBar, and then add other controls

However, How Can I know I click the key is up forward or down Forward?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top