While developing trading and finance applications features like data grid view cannot be overlooked. The .Net based trading and finance applications allow the use of data grid view features which in turn provide multiple benefits. For example the data grid view feature allows data grouping which can be used to group data from multiple sources. The use of data grid view feature also allows grouping even if the data format might have a mismatch tendency due to incompatibility in the data format. While grouping the data which is arriving via real time update technique there is a chance of data loss too if he thread safe nature of data grid view feature is not put to use within the .Net based application. Thus nowadays most of the .Net based trading and finance applications make use of data grid view feature. Separating the view from the business logic is also an important feature of the data grid view feature.
grid.PaintGroupPanel += delegate(object sender, PaintGroupPanelEventArgs e)
{
e.Appearance.BackColor = ControlPaint.Light(Color.LightBlack);
e.Appearance.GradientEndBackColor = Color.LightBlack;
};
grid.PaintColumnCaption += delegate(object sender, PaintColumnCaptionEventArgs e)
{
if(e.Column.Grouped)
{
e.Font = new Font(e.Font, FontStyle.Bold);
e.Appearance.ForeColor = Color.DarkPink;
e.Appearance.BackColor = Color.Blue;
e.Appearance.GradientEndBackColor = Color.LightSalmon;
e.Image = Resources.star_black;
e.ImageSettings.Alignment = ContentAlignment.TopLeft;
e.ImageSettings.Padding = new Padding(4, 0, 0, 0);
}
};
grid.PaintGroupRow += delegate(object sender, PaintGroupRowEventArgs e)
{
string departament = (string) e.Row[e.Column.Id].Value;
e.Text = string.Format("Any custom text here: {0}", departament.ToLower());
e.Font = new Font(e.Font, FontStyle.Bold | FontStyle.Italic);
e.Appearance.ForeColor = Color.ForestGreen;
e.Appearance.BackColor = ControlPaint.LightLight(Color.LightGreen);
e.Appearance.GradientEndBackColor = Color.LightGreen;
e.Appearance.GradientDirection = GradientDirection.Vertical;
e.Appearance.GradientEnabled = false;
e.Image = Resources.bullet_triangle_blue;
e.ImageSettings.Alignment = ContentAlignment.TopLeft;
e.ImageSettings.Padding = new Padding(4, 0, 0, 0);
};
In the above code the data grid view feature allows the user to group the requisite data without considering the fact of the data source. The data format which is being integrated is automatically converted by the data grid view feature.
//Create some employees and bind grid to the collection:
List<Employee> employees = new List<Employee>();
employees.Add(new Employee("Tom Hanks", "Department of physics", "Director IT Security"));
employees.Add(new Employee("Morgan Freeman", "Department of biology", "Divisional Support Unit Officer "));
employees.Add(new Employee("James Bond", "Department of biology", "Scientific Programer"));
employees.Add(new Employee("Pierce Crossman", "Department of physics", "Head of Department"));
employees.Add(new Employee("Clarke Gable", "Department of physics", "Divisional Support Unit Officer"));
employees.Add(new Employee("Julia Roberts", "Department of biology", "Operations Manager"));
employees.Add(new Employee("Meg Ryan", "Department of physics", "Physics Change Coordinator"));
This code above demonstrates the benefit of data grid view feature which allows the data to be bound to the collection, and viewed as and when needed. The data grid view feature also allows the separation of the business logic from the actual presentation layer, which keeps the data thread safe and avoid data loss. Thus data grid view feature is needed for an effective trading and finance application.
grid.PaintGroupPanel += delegate(object sender, PaintGroupPanelEventArgs e)
{
e.Appearance.BackColor = ControlPaint.Light(Color.LightBlack);
e.Appearance.GradientEndBackColor = Color.LightBlack;
};
grid.PaintColumnCaption += delegate(object sender, PaintColumnCaptionEventArgs e)
{
if(e.Column.Grouped)
{
e.Font = new Font(e.Font, FontStyle.Bold);
e.Appearance.ForeColor = Color.DarkPink;
e.Appearance.BackColor = Color.Blue;
e.Appearance.GradientEndBackColor = Color.LightSalmon;
e.Image = Resources.star_black;
e.ImageSettings.Alignment = ContentAlignment.TopLeft;
e.ImageSettings.Padding = new Padding(4, 0, 0, 0);
}
};
grid.PaintGroupRow += delegate(object sender, PaintGroupRowEventArgs e)
{
string departament = (string) e.Row[e.Column.Id].Value;
e.Text = string.Format("Any custom text here: {0}", departament.ToLower());
e.Font = new Font(e.Font, FontStyle.Bold | FontStyle.Italic);
e.Appearance.ForeColor = Color.ForestGreen;
e.Appearance.BackColor = ControlPaint.LightLight(Color.LightGreen);
e.Appearance.GradientEndBackColor = Color.LightGreen;
e.Appearance.GradientDirection = GradientDirection.Vertical;
e.Appearance.GradientEnabled = false;
e.Image = Resources.bullet_triangle_blue;
e.ImageSettings.Alignment = ContentAlignment.TopLeft;
e.ImageSettings.Padding = new Padding(4, 0, 0, 0);
};
In the above code the data grid view feature allows the user to group the requisite data without considering the fact of the data source. The data format which is being integrated is automatically converted by the data grid view feature.
//Create some employees and bind grid to the collection:
List<Employee> employees = new List<Employee>();
employees.Add(new Employee("Tom Hanks", "Department of physics", "Director IT Security"));
employees.Add(new Employee("Morgan Freeman", "Department of biology", "Divisional Support Unit Officer "));
employees.Add(new Employee("James Bond", "Department of biology", "Scientific Programer"));
employees.Add(new Employee("Pierce Crossman", "Department of physics", "Head of Department"));
employees.Add(new Employee("Clarke Gable", "Department of physics", "Divisional Support Unit Officer"));
employees.Add(new Employee("Julia Roberts", "Department of biology", "Operations Manager"));
employees.Add(new Employee("Meg Ryan", "Department of physics", "Physics Change Coordinator"));
This code above demonstrates the benefit of data grid view feature which allows the data to be bound to the collection, and viewed as and when needed. The data grid view feature also allows the separation of the business logic from the actual presentation layer, which keeps the data thread safe and avoid data loss. Thus data grid view feature is needed for an effective trading and finance application.