-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml.vb
More file actions
61 lines (48 loc) · 2.03 KB
/
MainWindow.xaml.vb
File metadata and controls
61 lines (48 loc) · 2.03 KB
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
Imports System.Text
Class MainWindow
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Dim sb As New StringBuilder
sb.AppendLine("This is some sample text")
sb.AppendLine("to illustrate the use of")
sb.AppendLine("the ColorComboBox.")
sb.AppendLine()
sb.AppendLine("Use MouseWheel while hovering")
sb.AppendLine("over the ComboBox")
sb.AppendLine("to cycle through colors,")
sb.AppendLine("or,")
sb.AppendLine("click on the ComboBox")
sb.AppendLine("to pick from the DropDown list.")
TB.Text = sb.ToString
cbBackground.SelectItem(Brushes.White)
cbForeground.SelectItem(Brushes.Black)
End Sub
Private Sub btnWebColors_Click(sender As Object, e As RoutedEventArgs)
cbBackground.DisplayType = ColorType.WebColors
cbForeground.DisplayType = ColorType.WebColors
End Sub
Private Sub btnSysColors_Click(sender As Object, e As RoutedEventArgs)
cbBackground.DisplayType = ColorType.SystemColors
cbForeground.DisplayType = ColorType.SystemColors
End Sub
Private Sub btnAllColors_Click(sender As Object, e As RoutedEventArgs)
cbBackground.DisplayType = ColorType.AllColors
cbForeground.DisplayType = ColorType.AllColors
End Sub
Private Sub cbForeground_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
If e.AddedItems.Count = 1 Then
Dim ci As ColorItem
ci = CType(e.AddedItems(0), ColorItem)
TB.Foreground = ci.Brush
End If
End Sub
Private Sub cbBackground_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
If e.AddedItems.Count = 1 Then
Dim ci As ColorItem
ci = CType(e.AddedItems(0), ColorItem)
TB.Background = ci.Brush
End If
End Sub
End Class