日期:2014-05-17 浏览次数:21617 次
'Dim _Helper As New MyCellMergeHelper(GridView1)
'_Helper.AddMergedCell(1, 0, 1, "MyMergedCell1")
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Columns
Imports System.Windows.Forms
Public Class MyCellMergeHelper
Public Sub New(ByVal view As GridView)
_view = view
AddHandler view.CustomDrawCell, AddressOf view_CustomDrawCell
AddHandler view.GridControl.Paint, AddressOf GridControl_Paint
AddHandler view.CellValueChanged, AddressOf view_CellValueChanged
painter = New MyGridPainter(view)
End Sub
Private painter As MyGridPainter
Private _view As GridView
Private _MergedCells As New List(Of MyMergedCell)()
Public ReadOnly Property MergedCells() As List(Of MyMergedCell)
Get
Return _MergedCells
End Get
End Property
Public Function AddMergedCell(ByVal rowHandle As Integer, ByVal col1 As GridColumn, ByVal col2 As GridColumn) As MyMergedCell
Dim cell As New MyMergedCell(rowHandle, col1, col2)
_MergedCells.Add(cell)
Return cell
End Function
Public Sub AddMergedCell(ByVal rowHandle As Integer, ByVal col1 As Integer, ByVal col2 As Integer, ByVal value As Object)
AddMergedCell(rowHandle, _view.Columns(col1), _view.Columns(col2), value)
End Sub
Public Sub AddMergedCell(ByVal rowHa