Heavy painting series: DataGridColumnStyle test code

zhaozj2021-02-16  51

New Test Program (Windows Applications) Need to add references to the above libraries, then add a Form1 and DataGrid1, declaration

Public newstyle as thefivecolumn.thefiveColumn.fiveColumn_Style2

Add in the Sub New of the Form

Newstyle = new thefiveColumn.thefiveColumn.fiveColumn_Style2

Newstyle.mappingname = "Content" newstyle.Headertext = "content summary" newstyle.readonly = true newstyle.width = 344

'Set the picture display attribute of Style

Me.newstyle.SetPath_State_true = Application.StartupPath & "/images/open.gif" Me.newstyle.SetPath_State_false = Application.StartupPath & "/images/copen.gif" Me.newstyle.SetPath_State_unknow = Application.StartupPath & "/ images / unknow.gif "Dim Path_Favorite_false As String = Application.StartupPath &" /images/FolderUnSel.gif "Me.newstyle.SetPath_Favorite_false = Path_Favorite_false Dim Path_Favorite_true As String = Application.StartupPath &" /images/FolderSel.gif "Me.newstyle.SetPath_Favorite_true = Path_favorite_true me.newstyle.setpath_analize_false = Application.Startuppath & "/Images/detail.gif" /images / neystyle.setpath_analize_true = Application.StartupPath & "IMAGES/detail.gif"

'Declaration Tablestyle

Dim TableStyle As New DataGridtablesTyle = "LittleTable" TableSty.RowHeadersVisible = FALSE

'Join TableStyle

TableStyle.GridColumnStyles.Add (NewStyle)

'Join DataGridTableStyle

DataGrid1.tables.add (TableStyle)

'Helry the data source in the Form_Load event:

DIM MyTable As New DataTable

MyTable.Columns.Add ("Content")

'adding data

DIM I as integer

FOR i = 0 to 9 '10 data

dim row () as object = new String () { "key" & "$ @" & "URL" & "$ @" & "text" & _ "$ @" & "1" & "$ @" & Server & "$ @" & "Modification Time" & "$ @" & "Summary" & _

"$ @" & "1"} '"@" is a separator, used in the PAINT method in the column style to split a row data

MyTable.Rows.Add (Row)

NEXT

DataGrid1.datasource = MyTable

Thank you for reading, I hope to contact me, ganelenping @ mainone.com.cn QQ: 44460100

转载请注明原文地址:https://www.9cbs.com/read-23375.html

New Post(0)