-
Notifications
You must be signed in to change notification settings - Fork 5
/
MainWindow.xaml.cs
91 lines (79 loc) · 2.55 KB
/
MainWindow.xaml.cs
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using MahApps.Metro.Controls;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Brushes = System.Windows.Media.Brushes;
namespace Whiteboard
{
public partial class MainWindow : MetroWindow
{
public MainWindow()
{
InitializeComponent();
}
private void MainWindow_KeyDown(object sender, KeyEventArgs e)
{
switch (e.Key)
{
case Key.Z:
if ((System.Windows.Forms.Control.ModifierKeys & System.Windows.Forms.Keys.Control) == System.Windows.Forms.Keys.Control)
theWhiteboard.Undo();
break;
}
}
private void Btn_White_Click(object sender, RoutedEventArgs e)
{
theWhiteboard.Background = Brushes.White;
}
private void Btn_Chroma_Click(object sender, RoutedEventArgs e)
{
Button btn = (Button)sender;
theWhiteboard.Background = btn.Foreground;
}
private void Btn_Transparent_Click(object sender, RoutedEventArgs e)
{
theWhiteboard.Background = Brushes.Transparent;
}
private void Btn_Pen_Click(object sender, RoutedEventArgs e)
{
/*
foreach (UIElement control in DrawSettings.Children)
{
if (control is Border)
{
Border border = control as Border;
border.BorderBrush = Brushes.Transparent;
}
}
*/
Button btn = (Button)sender;
//btn.BorderBrush = Brushes.Red;
theWhiteboard.SetPenColor(btn.Foreground);
}
private void Btn_Delete_Click(object sender, RoutedEventArgs e)
{
theWhiteboard.Clear();
}
private void Btn_Size1_Click(object sender, RoutedEventArgs e)
{
theWhiteboard.SetPenThickness(1.0);
}
private void Btn_Size2_Click(object sender, RoutedEventArgs e)
{
theWhiteboard.SetPenThickness(2.0);
}
private void Btn_Size3_Click(object sender, RoutedEventArgs e)
{
theWhiteboard.SetPenThickness(3.0);
}
private void Btn_Size4_Click(object sender, RoutedEventArgs e)
{
theWhiteboard.SetPenThickness(4.0);
}
private void Btn_Size5_Click(object sender, RoutedEventArgs e)
{
theWhiteboard.SetPenThickness(5.0);
}
}
}