markus / KCOM / Controls / CommantImage.xaml.cs @ 6c687be8
이력 | 보기 | 이력해설 | 다운로드 (1.38 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Windows; |
6 |
using System.Windows.Controls; |
7 |
using System.Windows.Data; |
8 |
using System.Windows.Documents; |
9 |
using System.Windows.Input; |
10 |
using System.Windows.Media; |
11 |
using System.Windows.Media.Imaging; |
12 |
using System.Windows.Navigation; |
13 |
using System.Windows.Shapes; |
14 |
|
15 |
namespace KCOM.Controls |
16 |
{ |
17 |
/// <summary> |
18 |
/// CommantImage.xaml에 대한 상호 작용 논리 |
19 |
/// </summary> |
20 |
public partial class CommantImage : UserControl |
21 |
{ |
22 |
public Image image |
23 |
{ |
24 |
get; |
25 |
set; |
26 |
} |
27 |
|
28 |
public CommantImage(Image img) |
29 |
{ |
30 |
image = img; |
31 |
this.Loaded += Test_Loaded; |
32 |
this.KeyDown += new KeyEventHandler(KeyEventDownAction); |
33 |
this.KeyUp += new KeyEventHandler(KeyEventDownAction); |
34 |
InitializeComponent(); |
35 |
} |
36 |
private void Test_Loaded(object sender, RoutedEventArgs e) |
37 |
{ |
38 |
this.MainImg.Source = image.Source; |
39 |
} |
40 |
|
41 |
public void KeyEventDownAction(object sender, KeyEventArgs e) |
42 |
{ |
43 |
switch (e.Key) |
44 |
{ |
45 |
case Key.Escape: |
46 |
{ |
47 |
Window window = Window.GetWindow(this); |
48 |
window.Close(); |
49 |
} |
50 |
break; |
51 |
} |
52 |
} |
53 |
} |
54 |
} |