By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,610 Members | 2,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,610 IT Pros & Developers. It's quick & easy.

Horiz scroll error in tree view

P: n/a
Hi,

I have docked a tree view to the left on a form. When I
start to populate this tree view with nodes, a horizontal
scroll box appears in the bottom of the tree view even
though thee tree view is big largely big enough to fit
the nodes and text. If I widen the tree view the scroll
bar doesn't resize itself to show the relative view size
in relation to the total size. Only if I narrow the view
to not fit the nodes, the scroll box starts to behave as
expected - and disappears when all nodes fits within the
tree view. Is this a bug, can I make a work around - It
doesn't look nice.

best regards Jesper.
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I have a outlook like GUI.

On the left a treeview and on the right a datagrid.
Seperated by a splitterbar. I dont have such a behavior like you describe.
I did not used the designer, i used 3 panel Controls to do that.

I guess the dockstyle is the problem. I use dockstyle.fill

Regard

Michael

Code snipped:

public Form1()

{

#region Form1 einstellen

Icon = new Icon(GetType(), "Key.ico");

Text = "PLCSetup";

Size = new Size(640,480);

StartPosition = FormStartPosition.CenterScreen;

MinimumSize = new Size(400,150);

#endregion
#region Form1 zwei mal Splitten einstellen

Panel panel = new Panel();

panel.Parent = this;

panel.Dock = DockStyle.Fill;

Splitter split1 = new Splitter();

split1.Parent = this;

split1.Dock = DockStyle.Left;

Panel panel1 = new Panel();

panel1.Parent = this;

panel1.Dock = DockStyle.Left;

panel1.BackColor = Color.Lime;

Panel panel2 = new Panel();

panel2.Parent = panel;

panel2.Dock = DockStyle.Fill;

panel2.BackColor = Color.Blue;

Splitter split2 = new Splitter();

split2.Parent = panel;

split2.Dock = DockStyle.Top;

Panel panel3 = new Panel();

panel3.Parent = panel;

panel3.Dock = DockStyle.Top;

panel3.BackColor = Color.Tan;

panel1.Width = ClientSize.Width / 3;

panel3.Height = ClientSize.Height / 3;

#endregion
#region Statusleiste einstellen
sb = new ProgressStatusBar();

sb.Parent = this;

sb.ShowPanels = true;

sb.SizingGrip = true;

sb.Dock = DockStyle.Bottom;
// -Pannels erstellen

// -Hilfe Panel

sbpHelp = new StatusBarPanel();

sbpHelp.Text = "Bereit";

sbpHelp.AutoSize = StatusBarPanelAutoSize.Spring;

// -ProgressPanel

sbpProgress = new ProgressPanel();

sbpProgress.Width = 100;

sbpProgress.Maximum = 100;

sbpProgress.Minimum = 0;

sbpProgress.Value = 50;

sbpProgress.ToolTipText = "Fortschritt in Prozent";

// -GoStopPanel

sbpGoStop = new StatusBarPanel();

sbpGoStop.Icon = new Icon(GetType(), "Green.ico");

sbpGoStop.ToolTipText = "GO";

sbpGoStop.Width = 35;

sbpGoStop.BorderStyle = StatusBarPanelBorderStyle.None;

sb.Panels.AddRange(new StatusBarPanel[]{sbpHelp,sbpProgress,sbpGoStop});
#endregion

#region Menuleiste einstellen

Menu = new MainMenu();

EventHandler ehSelect = new EventHandler(OnMenuSelect);

EventHandler ehClick = new EventHandler(OnMenuClick);
MenuItem mi = new MenuItem("Datei");

mi.Select += ehSelect;

Menu.MenuItems.Add(mi);

mi = new MenuItem("Ende");

mi.Select += ehSelect;

mi.Click += ehClick;

Menu.MenuItems[0].MenuItems.Add(mi);

#endregion

#region Buttonleiste einstellen

bm = new Bitmap(GetType(), "ToolBar1.bmp");

ImageList imglist = new ImageList();

//Size size = new Size(32,32)

imglist.ImageSize = new Size(32,32);

imglist.Images.AddStrip(bm);

imglist.TransparentColor = Color.Magenta;

ToolBar tbar = new ToolBar();

tbar.Parent = this;

tbar.ImageList = imglist;

tbar.Appearance = ToolBarAppearance.Flat;

for(int i = 0; i < 8; i++)

{

ToolBarButton tbarbtn = new ToolBarButton();
tbarbtn.ImageIndex = i;

tbar.Buttons.Add(tbarbtn);

}

#endregion

treeView1 = new TreeView();

treeView1.Parent = panel1;

treeView1.Dock = DockStyle.Fill;

dataGrid1 = new DataGrid();

dataGrid1.Parent = panel3;

dataGrid1.Dock = DockStyle.Fill;


string connString = @"Provider=Microsoft.JET.OLEDB.4.0;data
source=C:\plcsetup.mdb";

string sqlString = "SELECT * FROM plc_parameter";

OleDbConnection connection = new OleDbConnection(connString);

OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sqlString, connection);

DataSet dataSet = new DataSet();

dataAdapter.Fill(dataSet, "plc_parameter");

dataGrid1.DataSource = dataSet.Tables["plc_parameter"].DefaultView;

//dataGrid1.Text
listBox1 = new ListBox();

listBox1.Parent = panel2;

listBox1.Dock = DockStyle.Fill;

listBox1.IntegralHeight = false;

"Jesper DK" <je****@hotmail.com> schrieb im Newsbeitrag
news:09****************************@phx.gbl...
Hi,

I have docked a tree view to the left on a form. When I
start to populate this tree view with nodes, a horizontal
scroll box appears in the bottom of the tree view even
though thee tree view is big largely big enough to fit
the nodes and text. If I widen the tree view the scroll
bar doesn't resize itself to show the relative view size
in relation to the total size. Only if I narrow the view
to not fit the nodes, the scroll box starts to behave as
expected - and disappears when all nodes fits within the
tree view. Is this a bug, can I make a work around - It
doesn't look nice.

best regards Jesper.

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.