This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FlashedCell.vb
68 lines (59 loc) · 1.86 KB
/
FlashedCell.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
58
59
60
61
62
63
64
65
66
67
68
' Developer Express Code Central Example:
' How to implement a flashing cell in GridView?
'
' This example demonstrates how to force a specific cell to flash in GridView. The
' first column allows you to specify flashing speed.
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E2987
Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Columns
Namespace WindowsApplication1
Public Class FlashedCell
Inherits GridCell
Private timer As New Timer()
Public Sub New(ByVal rowHandle As Integer, ByVal column As GridColumn, ByVal view As GridView)
MyBase.New(rowHandle, column)
_View = view
AddHandler view.RowCellStyle, AddressOf view_RowCellStyle
AddHandler timer.Tick, AddressOf timer_Tick
timer.Enabled = True
End Sub
Private Sub timer_Tick(ByVal sender As Object, ByVal e As EventArgs)
isColored = Not isColored
_View.RefreshRowCell(RowHandle, Column)
End Sub
Private isColored As Boolean
Private Sub view_RowCellStyle(ByVal sender As Object, ByVal e As RowCellStyleEventArgs)
If isColored Then
If e.RowHandle = RowHandle AndAlso e.Column Is Column Then
e.Appearance.Assign(FlashedCellsHelper.FlashedCellAppearance)
End If
End If
End Sub
Private _Speed As Integer
Private ReadOnly _View As GridView
Public Property Speed() As Integer
Get
Return _Speed
End Get
Set(ByVal value As Integer)
If value < 0 OrElse _Speed = value Then
Return
End If
_Speed = value
timer.Stop()
If (_Speed = 0) Then
Return
End If
timer.Interval = value
timer.Start()
End Set
End Property
End Class
End Namespace