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

using splitter

P: n/a
How to use this control?

I have to grids on my form, one on the top and one on bottom.

When I start application I want to be able to move bottom grip up, and top
grid down, but it doesn't work!

Where should I put splitter?

Hrcko
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Set the "top" DataGrids Dock property to "Top". Set the Splitters Dock
property to "Top". Set the "bottom" DataGrids Dock property to "Fill". Then
select the "top" DataGrid and bring it to the front of the zorder (this is a
button on the Layout toolbar). Then select the Splitter and bring it to the
front of the zorder. Then select the "bottom" DataGrid and bring it to the
front of the zorder. It's really just the right combination of docking and
zordering.

--
Tim Wilson
..Net Compact Framework MVP

"Hrcko" <hr**********@zg.htnet.hr> wrote in message
news:d9**********@ss405.t-com.hr...
How to use this control?

I have to grids on my form, one on the top and one on bottom.

When I start application I want to be able to move bottom grip up, and top
grid down, but it doesn't work!

Where should I put splitter?

Hrcko

Nov 17 '05 #2

P: n/a
Here is a very simple implementation for you
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace UsingASplitter
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.Splitter splitter1;
private System.Windows.Forms.DataGrid dataGrid2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.splitter1 = new System.Windows.Forms.Splitter();
this.dataGrid2 = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.d ataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.d ataGrid2)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Top;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(0, 0);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(292, 80);
this.dataGrid1.TabIndex = 0;
//
// splitter1
//
this.splitter1.Dock = System.Windows.Forms.DockStyle.Top;
this.splitter1.Location = new System.Drawing.Point(0, 80);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(292, 3);
this.splitter1.TabIndex = 1;
this.splitter1.TabStop = false;
//
// dataGrid2
//
this.dataGrid2.DataMember = "";
this.dataGrid2.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid2.Location = new System.Drawing.Point(0, 83);
this.dataGrid2.Name = "dataGrid2";
this.dataGrid2.Size = new System.Drawing.Size(292, 183);
this.dataGrid2.TabIndex = 2;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.dataGrid2);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.dataGrid1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.d ataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.d ataGrid2)).EndInit();
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
Br
Mark.
"Hrcko" <hr**********@zg.htnet.hr> wrote in message
news:d9**********@ss405.t-com.hr...
How to use this control?

I have to grids on my form, one on the top and one on bottom.

When I start application I want to be able to move bottom grip up, and top
grid down, but it doesn't work!

Where should I put splitter?

Hrcko

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.