Visual Basic, .NET, ASP, VBScript
 

   
 
 
     
   
 

True DBgrid Visual Studio.Net ( 2)

 

 

True DBGrid . True DBGrid , . .

 

True DBGrid

 

True DBGrid.NET .

Component One True DBGrid FilterBar. , true . , . , , , :

 

C#

c1TrueDBGrid1.FilterBar=!c1TrueDBGrid1.FilterBar;

 

FilterBar :

 

 

1

FilterBar , True DBGrid :

 

 

2

 

(! ). , , .

. Ȼ.

. , . , .

True DBGrid , Component One - True DBDropdown. , (LastName) . True DBDropdown C1ExpressTable, ( C1ExpressTable , ). True DBDropdown .

 

 

3

 

 

True DBDropdown . True DBDropdown True DBGrid. c1ExpressTable2. True DBDropdown . LastName, Columns, , LastName.

True DBGrid, Display Columns, LastName

FilterButton=true

Button=false

 

, :

C#

c1TrueDBGrid1.Columns[1].DropDown=c1TrueDBDropdown1;

c1TrueDBGrid1.Splits[0].DisplayColumns[1].FilterButton=true;

c1TrueDBGrid1.Splits[0].DisplayColumns[1].Button=false;

 

VB.NET

 

Me.C1TrueDBGrid1.Columns(1).DropDown = Me.C1TrueDBDropdown1

Me.C1TrueDBGrid1.Splits(0).DisplayColumns(1).FilterButton = True

Me.C1TrueDBGrid1.Splits(0).DisplayColumns(1).Button = False

 

. FilterBar LastName, . .

 

4

. . . .

:

- SortDirection. :

- None ( );

- Ascending;

- Descending;

 

- :

C#:

 

c1TrueDBGrid1.Columns[1].SortDirection=C1.Win.C1TrueDBGrid.SortDirEnum.Ascending;

 

True DBGrid

 

MS FlexGrid. True DBGrid.

 

, , , , , .

 

True Merge ( Display Columns)

 

 

5.

 

:

 

C#:

 

c1TrueDBGrid1.Splits[0].DisplayColumns[1].Merge=true;

 

True DBGrid .

 

 

True DBGrid

 

: , , .

 

True DBGrid . DataView . :

 

1.                     Normal ( ) , .

 

2.                     Inverted :

 

 

6.

 

3.                     Form - ( FoxPro)

 

 

7.

 

.

 

4.                     MultipleLine , True DBGrid .

 

 

8.

 

5.                     GroupBy :

 

 

9.

Drag & Drop ( AllowColMove True), :

 

 

10.

 

, . :

 

C#:

 

private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)

{

switch(comboBox1.SelectedIndex)

{

case 0:

c1TrueDBGrid1.DataView=C1.Win.C1TrueDBGrid.DataViewEnum.Normal;

break;

case 1: c1TrueDBGrid1.DataView=C1.Win.C1TrueDBGrid.DataViewEnum.Inverted;

break;

case 2: c1TrueDBGrid1.DataView=C1.Win.C1TrueDBGrid.DataViewEnum.Form;

break;

case 3: c1TrueDBGrid1.DataView=C1.Win.C1TrueDBGrid.DataViewEnum.GroupBy;

break;

case 4: c1TrueDBGrid1.DataView=C1.Win.C1TrueDBGrid.DataViewEnum.MultipleLines;

break;

case 5:

break;

}

}

 

VB.Net

 

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

 

Select Case ComboBox1.SelectedItem

Case 0

Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Normal

Case 1

Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Inverted

Case 2

Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Form

Case 3

Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.GroupBy

Case 4

Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.MultipleLines

Case 5

End Select

End Sub

 

Hierarchical. , . c1ExpressTable . .NET. oleDbDataAdapter (), oleDbConnection dataSet. Northwind. oleDbDataAdapter Orders, Order Details. dataSet. dataSet 11.

 

 

11.

 

DataSource dataSet1, DataMember Orders .

:

 

C#:

 

oleDbDataAdapter1.Fill(this.dataSet1);

oleDbDataAdapter2.Fill(this.dataSet1);

c1TrueDBGrid1.DataView=C1.Win.C1TrueDBGrid.DataViewEnum.Hierarchical;

:

 

 

12.

 

, , +. .

 

 

True DBGrid .

 

, , . True DBGrid .

, .

, . , . .

, True DBGrid , UnboundColumnFetch. .

 

OrderDetails Northwind. UnitPrice , Quantity Discount . .

, Summa. UnboundColumnFetch:

 

C#:

private void c1TrueDBGrid1_UnboundColumnFetch(object sender, C1.Win.C1TrueDBGrid.UnboundColumnFetchEventArgs e)

{

C1.Data.C1DataTable dtData=c1ExpressTable1.DataTable;

C1.Data.C1DataRow drData=dtData.Rows[e.Row]; e.Value=(Convert.ToDecimal(drData[2])*Convert.ToInt32(drData[3])*(1-Convert.ToDecimal(drData[4]))).ToString("f2");

}

 

 

 

VB.NET

Private Sub C1TrueDBGrid1_UnboundColumnFetch(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.UnboundColumnFetchEventArgs) Handles C1TrueDBGrid1.UnboundColumnFetch

Dim dtData As C1.Data.C1DataTable

Dim drData As C1.Data.C1DataRow

dtData = C1ExpressTable1.DataTable

drData = dtData.Rows(e.Row)

e.Value = (Convert.ToDecimal(drData(2)) * Convert.ToInt32(drData(3)) * (1 - Convert.ToDecimal(drData(4)))).ToString("f2")

End Sub

 

 

, , :

 

 

13.

 

 

True DBGrid.

 

 

. , True DBGrid , . OwnerDrawCell, .

-, , OwnerDraw true.

-, GDI+, :

 

C#:

using System.Drawing.Drawing2D;

using System.Drawing.Text;

 

VB.NET:

Imports System.Drawing.Drawing2D

Imports System.Drawing.Text

 

:

 

C#:

 

private void c1TrueDBGrid1_OwnerDrawCell(object sender, C1.Win.C1TrueDBGrid.OwnerDrawCellEventArgs e)

{

if(e.Col==0)// 1-

{

//

Graphics g=e.Graphics;

// ,

Rectangle rt=new Rectangle(e.CellRect.X,e.CellRect.Y,e.CellRect.Width,e.CellRect.Height);

//

LinearGradientBrush brGrad=new LinearGradientBrush(rt,Color.Red,Color.Blue,0,true);

//

g.FillRectangle(brGrad,rt);

//

SolidBrush brWhite=new SolidBrush(Color.White);

//

C1.Win.C1TrueDBGrid.C1DisplayColumn dCol=c1TrueDBGrid1.Splits[0].DisplayColumns[e.Col];

//

StringFormat stf=new StringFormat();

stf.Alignment=StringAlignment.Center;

//

e.Graphics.DrawString(dCol.DataColumn.CellText(e.Row),dCol.Style.Font,brWhite,rt,stf);

// ,

e.Handled=true;

//

brGrad.Dispose();

brWhite.Dispose();

}

}

 

 

VB.NET:

 

Private Sub C1TrueDBGrid1_OwnerDrawCell(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.OwnerDrawCellEventArgs) Handles C1TrueDBGrid1.OwnerDrawCell

' VB.NET

Dim g As Graphics

Dim rt As RectangleF

Dim brGrad As LinearGradientBrush

Dim brWhite As SolidBrush

Dim dCol As C1.Win.C1TrueDBGrid.C1DisplayColumn

Dim stf As StringFormat

If e.Col = 0 Then ' 1-

'

g = e.Graphics

' ,

rt = New RectangleF(e.CellRect.X, e.CellRect.Y, e.CellRect.Width, e.CellRect.Height)

'

brGrad = New LinearGradientBrush(rt, Color.Red, Color.Blue, 0, True)

'

g.FillRectangle(brGrad, rt)

'

brWhite = New SolidBrush(Color.White)

'

dCol = C1TrueDBGrid1.Splits(0).DisplayColumns(e.Col)

'

stf = New StringFormat

stf.Alignment = StringAlignment.Center

'

e.Graphics.DrawString(dCol.DataColumn.CellText(e.Row), dCol.Style.Font, brWhite, rt, stf)

' ,

e.Handled = True

'

brGrad.Dispose()

brWhite.Dispose()

End If

End Sub

 

:

 

 

14.

 

 

:

 

C#:

 

private void c1TrueDBGrid1_OwnerDrawCell(object sender, C1.Win.C1TrueDBGrid.OwnerDrawCellEventArgs e)

{

if(e.Col==0)

{

Graphics g=e.Graphics;

Rectangle rt=new Rectangle(e.CellRect.X,e.CellRect.Y,e.CellRect.Width,e.CellRect.Height);

SolidBrush brRed=new SolidBrush(Color.Red);

g.FillEllipse(brRed,rt);

SolidBrush brGreen=new SolidBrush(Color.Green);

C1.Win.C1TrueDBGrid.C1DisplayColumn dCol=c1TrueDBGrid1.Splits[0].DisplayColumns[e.Col];

StringFormat stf=new StringFormat();

stf.Alignment=StringAlignment.Center;

e.Graphics.DrawString(dCol.DataColumn.CellText(e.Row),dCol.Style.Font,brGreen,rt,stf);

e.Handled=true;

brRed.Dispose();

brGreen.Dispose();

}

}

 

VB.NET

 

Private Sub C1TrueDBGrid1_OwnerDrawCell(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.OwnerDrawCellEventArgs) Handles C1TrueDBGrid1.OwnerDrawCell

Dim g As Graphics

Dim rt As RectangleF

Dim brRed As SolidBrush

Dim brGreen As SolidBrush

Dim dCol As C1.Win.C1TrueDBGrid.C1DisplayColumn

Dim stf As StringFormat

If e.Col = 0 Then

g = e.Graphics

rt = New RectangleF(e.CellRect.X, e.CellRect.Y, e.CellRect.Width, e.CellRect.Height)

brRed = New SolidBrush(Color.Red)

g.FillEllipse(brRed, rt)

brGreen = New SolidBrush(Color.Green)

dCol = C1TrueDBGrid1.Splits(0).DisplayColumns(e.Col)

stf = New StringFormat

stf.Alignment = StringAlignment.Center

e.Graphics.DrawString(dCol.DataColumn.CellText(e.Row), dCol.Style.Font, brGreen, rt, stf)

e.Handled = True

brRed.Dispose()

brGreen.Dispose()

End If

End Sub

 

, :

 

 

15.

 

,

 

True DBGrid.

 

True DBGrid. .

 

, True DBGrid . , , , . 5-6 ( ), . .

 

.

 

. True DBGrid . True Button . , :

 

C#:

 

c1TrueDBGrid1.Splits[0].DisplayColumns[0].Button=true;

 

:

 

 

16.

 

. True ButtonOlways, :

 

 

17.

 

True ButtonText, :

 

 

18.

 

. . ButtonClick.

 

. , . , . , , listBox.

 

. Customers Northwind. True DBGrid . Button=true CompanyName.

listBox (, Windows Forms). . listBox . c1ExpressTable. . DataSource listBox c1ExpressTable2. listBox CompanyName.

( C#)

listBox . :

 

listBox1.Visible=false;

 

:

 

private void c1TrueDBGrid1_ButtonClick(object sender, C1.Win.C1TrueDBGrid.ColEventArgs e)

{

listBox1.Left=c1TrueDBGrid1.Left+c1TrueDBGrid1.Splits[0].DisplayColumns[0].Width+c1TrueDBGrid1.RecordSelectorWidth;

listBox1.Top=c1TrueDBGrid1.Top+c1TrueDBGrid1.RowTop(c1TrueDBGrid1.Row)+c1TrueDBGrid1.RowHeight;

listBox1.Width=c1TrueDBGrid1.Splits[0].DisplayColumns[2].Width;

listBox1.Visible=true;

}

 

listBox .

 

listBox:

 

private void listBox1_DoubleClick(object sender, System.EventArgs e)

{

c1TrueDBGrid1.Columns[1].Text=listBox1.Text;

listBox1.Visible=false;

}

 

, listBox, :

 

private void c1TrueDBGrid1_Click(object sender, System.EventArgs e)

{

listBox1.Visible=false;

}

 

, , :

 

 

19.

 

, . ComponentOne C1TrueDBDropdown, .

 

True DBGrid DateTimePicker. : ( ) DateTimePicker.

, DateTimePicker . DateTimePicker .

DateTimePicker :

 

private void Form1_Load(object sender, System.EventArgs e)

{

dateTimePicker1.Height=c1TrueDBGrid1.RowHeight;

}

 

 

:

 

private void c1TrueDBGrid1_RowColChange(object sender, C1.Win.C1TrueDBGrid.RowColChangeEventArgs e)

{

//

C1.Win.C1TrueDBGrid.C1DataColumn col = c1TrueDBGrid1.Splits[0].DisplayColumns[c1TrueDBGrid1.Col].DataColumn;

if(col.DataField == "BirthDate")// "BirthDate"

{

//

Rectangle rt = c1TrueDBGrid1.Splits[0].GetCellBounds(c1TrueDBGrid1.Row, c1TrueDBGrid1.Col);

//

rt = c1TrueDBGrid1.RectangleToScreen(rt);

// dateTimePicker1

dateTimePicker1.Location = RectangleToClient(rt).Location;

// dateTimePicker1

dateTimePicker1.Size = rt.Size;

//

dateTimePicker1.Text = col.CellText(c1TrueDBGrid1.Row);

//

dateTimePicker1.Visible = true;

}

else

// . dateTimePicker1

dateTimePicker1.Visible = false;

}

 

, DateTimePicker:

 

private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)

{

C1.Win.C1TrueDBGrid.C1DataColumn col = c1TrueDBGrid1.Splits[0].DisplayColumns[c1TrueDBGrid1.Col].DataColumn;

col.Text = dateTimePicker1.Text;

}

 

:

 

 

20.

 

True DBGrid .

 

 

True DBGrid. .

(1.Data). :

- True DBGrid;

- True DBGrid ;

- FlexGrid.Net

 
     

   
 

:

:

, ?

 
     
  VBNet