This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
Form1.vb
57 lines (52 loc) · 2.58 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Imports DevExpress.Utils
Imports DevExpress.Utils.Drawing
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Drawing
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraEditors.ViewInfo
Imports DevExpress.XtraVerticalGrid
Imports DevExpress.XtraVerticalGrid.Events
Imports DevExpress.XtraVerticalGrid.Rows
Imports DevExpress.XtraVerticalGrid.ViewInfo
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Windows.Forms
Namespace S170863
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
vGridControl1.DataSource = CreateTable(6)
Dim riCheckEdit As New RepositoryItemCheckEdit()
Dim TempRowInplaceEditorHelper As RowInplaceEditorHelper = New RowInplaceEditorHelper(vGridControl1.GetRowByFieldName("Check"), riCheckEdit)
riCheckEdit.AllowFocused = False
AddHandler riCheckEdit.EditValueChanged, AddressOf riCheckEdit_EditValueChanged
Dim riColorEdit As New RepositoryItemColorEdit()
Dim TempRowInplaceEditorHelper1 As RowInplaceEditorHelper = New RowInplaceEditorHelper(vGridControl1.GetRowByFieldName("Name"), riColorEdit)
riColorEdit.ColorAlignment = HorzAlignment.Center
AddHandler riColorEdit.EditValueChanged, AddressOf riColorEdit_EditValueChanged
End Sub
Private Sub riColorEdit_EditValueChanged(ByVal sender As Object, ByVal e As EventArgs)
vGridControl1.GetRowByFieldName("Name").Appearance.BackColor2 = (TryCast(sender, ColorEdit)).Color
End Sub
Private Sub riCheckEdit_EditValueChanged(ByVal sender As Object, ByVal e As EventArgs)
For i As Integer = 0 To vGridControl1.RecordCount - 1
vGridControl1.SetCellValue(vGridControl1.GetRowByFieldName("Check"), i, (TryCast(sender, CheckEdit)).Checked)
Next i
End Sub
Private Function CreateTable(ByVal recordCount As Integer) As DataTable
Dim dataTable As New DataTable()
dataTable.Columns.Add("Name", GetType(String))
dataTable.Columns.Add("ID", GetType(Integer))
dataTable.Columns.Add("Check", GetType(Boolean))
dataTable.Columns.Add("Date", GetType(Date))
For i As Integer = 0 To recordCount - 1
dataTable.Rows.Add(New Object() { String.Format("Name{0}", i), i, (If(i Mod 2 = 1, True, False)), Date.Now.AddDays(i) })
Next i
Return dataTable
End Function
End Class
End Namespace