如何改变网格的细节按钮颜色和样式?突出显示在下面的图像。

如何在CustomDrawCell事件中以与XtraGrid完全相同的方式绘制主行的展开按钮。这不管用。
我们能添加我们自己的按钮/图像吗?或者有任何选项,我们可以添加另一个按钮与这个细节按钮?
编辑1:这里是代码。
Private Sub GridView1_CustomDrawCell(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell
Dim cell As GridCellInfo = CType(e.Cell, GridCellInfo)
Dim view As GridView = CType(sender, GridView)
Dim p As ObjectPainter = cell.RowInfo.ViewInfo.Painter.ElementsPainter.DetailButton
If Not cell.CellButtonRect.IsEmpty Then
ObjectPainter.DrawObject(e.Cache, p, _
New DevExpress.XtraGrid.Drawing.DetailButtonObjectInfoArgs( _
cell.CellButtonRect, view.GetMasterRowExpanded(cell.RowHandle), cell.RowInfo.IsMasterRowEmpty))
End If
...
e.Handled = True
End Sub发布于 2015-08-19 06:33:10
您可以使用GridView.CustomDrawCell事件。只需将GridCellInfo.CellButtonRect属性设置为Rectangle.Empty,使用e.DefaultDraw()方法执行单元格的默认绘制,恢复GridCellInfo.CellButtonRect属性的值,然后绘制图像即可。
下面是一个例子:
Private Sub gridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles gridView1.CustomDrawCell
Dim info = CType(e.Cell, GridCellInfo)
If Not info.CellButtonRect.IsEmpty Then
Dim detailRect = info.CellButtonRect
info.CellButtonRect = Rectangle.Empty
e.DefaultDraw()
info.CellButtonRect = detailRect
e.Graphics.DrawImageUnscaled(yourImageHere, detailRect.X, detailRect.Y)
e.Handled = True
End If
End Subhttps://stackoverflow.com/questions/32074500
复制相似问题