In this step the C1TileControl.FormatValue event is used to format the tile’s backcolor, tile’s images, and the tile’s country name.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub c1TileControl1_FormatValue(sender As Object, e As FormatValueEventArgs) If e.TileProperty = TileProperty.BackColor Then If TypeOf e.Value Is Boolean AndAlso CBool(e.Value) Then e.Value = Color.Firebrick Else e.Value = Color.DimGray End If ElseIf e.TileProperty = TileProperty.IntValue Then Dim result As Integer = 0 Select Case TryCast(e.Value, String) Case "UK" result = 1 Exit Select Case "France" result = 2 Exit Select Case "Brazil" result = 3 Exit Select Case "Singapore" result = 4 Exit Select Case "USA" result = 5 Exit Select Case "Germany" result = 6 Exit Select Case "Australia" result = 7 Exit Select Case "Japan" result = 8 Exit Select Case "Canada" result = 9 Exit Select Case "Netherlands" result = 10 Exit Select Case "Finland" result = 11 Exit Select Case "Norway" result = 12 Exit Select Case "Italy" result = 13 Exit Select Case "Spain" result = 14 Exit Select Case "Sweden" result = 15 Exit Select Case "Denmark" result = 16 Exit Select End Select e.Value = result End If End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
{ if (e.TileProperty == TileProperty.BackColor) { if (e.Value is bool && (bool)e.Value) e.Value = Color.Firebrick; else e.Value = Color.DimGray; } else if (e.TileProperty == TileProperty.IntValue) { int result = 0; switch (e.Value as string) { case "UK": result = 1; break; case "France": result = 2; break; case "Brazil": result = 3; break; case "Singapore": result = 4; break; case "USA": result = 5; break; case "Germany": result = 6; break; case "Australia": result = 7; break; case "Japan": result = 8; break; case "Canada": result = 9; break; case "Netherlands": result = 10; break; case "Finland": result = 11; break; case "Norway": result = 12; break; case "Italy": result = 13; break; case "Spain": result = 14; break; case "Sweden": result = 15; break; case "Denmark": result = 16; break; } e.Value = result; } } |