Skip to content

Commit 0859fbf

Browse files
SindhuTNSindhuTN
authored andcommitted
Samples has been committed and spell errors has been cleared.
1 parent 0ab60ff commit 0859fbf

22 files changed

+190
-157
lines changed
File renamed without changes.
File renamed without changes.

To set image size/DataGrid_2015.csproj renamed to DataGrid_2015.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@
8585
<ItemGroup>
8686
<Compile Include="Data.cs" />
8787
<Compile Include="DataCollection.cs" />
88-
<Compile Include="Form1.cs">
88+
<Compile Include="Form2.cs">
8989
<SubType>Form</SubType>
9090
</Compile>
91-
<Compile Include="Form1.Designer.cs">
92-
<DependentUpon>Form1.cs</DependentUpon>
91+
<Compile Include="Form2.Designer.cs">
92+
<DependentUpon>Form2.cs</DependentUpon>
9393
</Compile>
9494
<Compile Include="Program.cs" />
9595
<Compile Include="Properties\AssemblyInfo.cs" />
96-
<EmbeddedResource Include="Form1.resx">
97-
<DependentUpon>Form1.cs</DependentUpon>
96+
<EmbeddedResource Include="Form2.resx">
97+
<DependentUpon>Form2.cs</DependentUpon>
9898
</EmbeddedResource>
9999
<EmbeddedResource Include="Properties\Resources.resx">
100100
<Generator>ResXFileCodeGenerator</Generator>

DataGrid_2015.csproj.user

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ReferencePath>C:\Program Files (x86)\Syncfusion\Essential Studio\Windows\16.2.0.44\precompiledassemblies\4.6\</ReferencePath>
5+
<ProjectView>ShowAllFiles</ProjectView>
6+
</PropertyGroup>
7+
</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.

Form2.Designer.cs

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Form2.cs

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
using Syncfusion.Windows.Forms.Grid;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Data;
6+
using System.Drawing;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
using System.Windows.Forms;
11+
12+
namespace DataGrid
13+
{
14+
public partial class Form2 : Form
15+
{
16+
public Form2()
17+
{
18+
InitializeComponent();
19+
this.gridControl1.RowCount = 15;
20+
this.gridControl1.ColCount = 6;
21+
gridControl1.RowCount = 100;
22+
gridControl1.ColCount = 11;
23+
this.gridControl1.DefaultRowHeight = 30;
24+
CreateTable();
25+
for (int i = 1; i <= this.gridControl1.RowCount; i++)
26+
{
27+
for (int j = 1; j <= this.gridControl1.ColCount; j++)
28+
{
29+
this.gridControl1[i, j].CellValue = dt.Rows[i - 1][j - 1];
30+
}
31+
}
32+
for (int i = 1; i <= gridControl1.RowCount; i++)
33+
{
34+
gridControl1[i, 3].CellType = GridCellTypeName.PushButton;
35+
}
36+
for (int i = 1; i <= gridControl1.RowCount; i++)
37+
{
38+
gridControl1[i, 7].CellType = GridCellTypeName.PushButton;
39+
}
40+
//Event triggering
41+
this.gridControl1.DrawCellButton += GridControl1_DrawCellButton;
42+
}
43+
44+
private void GridControl1_DrawCellButton(object sender, GridDrawCellButtonEventArgs e)
45+
{
46+
if (e.Style.CellType == GridCellTypeName.PushButton)
47+
{
48+
Bitmap bitmap = new Bitmap(30, 20);
49+
Rectangle rect = e.Button.Bounds;
50+
if (e.ColIndex == 3)
51+
{
52+
bitmap = new Bitmap(SystemIcons.Error.ToBitmap(), new Size(30, 25));
53+
}
54+
if (e.ColIndex == 7)
55+
{
56+
bitmap = new Bitmap(SystemIcons.Exclamation.ToBitmap(), new Size(20, 20));
57+
}
58+
e.Graphics.DrawImage(bitmap, rect.X + 30, rect.Y, bitmap.Width, bitmap.Height);
59+
e.Cancel = true;
60+
}
61+
}
62+
#region "Create DataTable"
63+
string[] name1 = new string[] { "John", "Peter", "Smith", "Jay", "Krish", "Mike" };
64+
string[] country = new string[] { "UK", "USA", "Pune", "India", "China", "England" };
65+
string[] city = new string[] { "Graz", "Resende", "Bruxelles", "Aires", "Rio de janeiro", "Campinas" };
66+
string[] scountry = new string[] { "Brazil", "Belgium", "Austria", "Argentina", "France", "Beiging" };
67+
DataTable dt = new DataTable();
68+
Random r = new Random();
69+
int col = 0;
70+
private DataTable CreateTable()
71+
{
72+
if (col == 0)
73+
{
74+
dt.Columns.Add("Name");
75+
dt.Columns.Add("Id");
76+
dt.Columns.Add("Date");
77+
dt.Columns.Add("Country");
78+
dt.Columns.Add("Ship City");
79+
dt.Columns.Add("Ship Country");
80+
dt.Columns.Add("Freight");
81+
dt.Columns.Add("Postal code");
82+
dt.Columns.Add("Salary");
83+
dt.Columns.Add("PF");
84+
dt.Columns.Add("EMI");
85+
}
86+
for (int l = 0; l < dt.Columns.Count; l++)
87+
88+
for (int i = 0; i < this.gridControl1.RowCount; i++)
89+
{
90+
DataRow dr = dt.NewRow();
91+
for (int j = 0; j < this.gridControl1.ColCount; j++)
92+
{
93+
dr[0] = name1[r.Next(0, 5)];
94+
dr[1] = "E" + r.Next(30);
95+
dr[2] = new DateTime(2012, 5, 23);
96+
dr[3] = country[r.Next(0, 5)];
97+
dr[4] = city[r.Next(0, 5)];
98+
dr[5] = scountry[r.Next(0, 5)];
99+
dr[6] = r.Next(1000, 2000);
100+
dr[7] = r.Next(10 + (r.Next(600000, 600100)));
101+
dr[8] = r.Next(14000, 20000);
102+
dr[9] = r.Next(r.Next(2000, 4000));
103+
dr[10] = r.Next(300, 1000);
104+
}
105+
dt.Rows.Add(dr);
106+
}
107+
return dt;
108+
}
109+
#endregion
110+
}
111+
}
112+
File renamed without changes.

0 commit comments

Comments
 (0)