markus / KCOM / Views / TopMenu.xaml.cs @ master
이력 | 보기 | 이력해설 | 다운로드 (5.05 KB)
1 |
using System; |
---|---|
2 |
using System.Text.RegularExpressions; |
3 |
using System.Windows; |
4 |
using System.Windows.Controls; |
5 |
using System.Windows.Media.Imaging; |
6 |
using Telerik.Windows.Controls; |
7 |
|
8 |
namespace KCOM.Views |
9 |
{ |
10 |
/// <summary> |
11 |
/// TopMenu.xaml에 대한 상호 작용 논리 |
12 |
/// </summary> |
13 |
public partial class TopMenu : UserControl |
14 |
{ |
15 |
public TopMenu() |
16 |
{ |
17 |
//App.splashString(ISplashMessage.TOPMENU); |
18 |
InitializeComponent(); |
19 |
|
20 |
this.Loaded += TopMenu_Loaded; |
21 |
|
22 |
} |
23 |
|
24 |
bool _Initialize = false; |
25 |
|
26 |
private void TopMenu_Loaded(object sender, RoutedEventArgs e) |
27 |
{ |
28 |
if (!App.IsDesignMode) |
29 |
{ |
30 |
if (!_Initialize) |
31 |
{ |
32 |
InitDataSet(); |
33 |
|
34 |
_Initialize = true; |
35 |
|
36 |
comboFontFamily.SelectionChanged += comboFontFamily_SelectionChanged; |
37 |
|
38 |
if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
39 |
{ |
40 |
SAVE.Visibility = Visibility.Collapsed; |
41 |
} |
42 |
|
43 |
if (KCOM.Properties.Settings.Default.cad == 0) |
44 |
{ |
45 |
AutoCAD.Visibility = Visibility.Hidden; |
46 |
} |
47 |
|
48 |
if (KCOM.Properties.Settings.Default.grouping == 0) |
49 |
{ |
50 |
GROUP.Visibility = Visibility.Hidden; |
51 |
} |
52 |
} |
53 |
} |
54 |
} |
55 |
|
56 |
private void btnFromFile_Click(object sender, RoutedEventArgs e) |
57 |
{ |
58 |
System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog(); |
59 |
var result = dialog.ShowDialog(); |
60 |
if (result == System.Windows.Forms.DialogResult.OK) |
61 |
{ |
62 |
System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName); |
63 |
|
64 |
System.IO.MemoryStream ms = new System.IO.MemoryStream(); |
65 |
t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); |
66 |
BitmapImage ix = new BitmapImage(); |
67 |
ix.BeginInit(); |
68 |
ix.CacheOption = BitmapCacheOption.OnLoad; |
69 |
ix.StreamSource = ms; |
70 |
ix.EndInit(); |
71 |
|
72 |
this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix; |
73 |
this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width; |
74 |
this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height; |
75 |
|
76 |
//this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1); |
77 |
//imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1); |
78 |
//imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White; |
79 |
|
80 |
//var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None); |
81 |
//RasterImageViewer vvv = new RasterImageViewer(); |
82 |
//vvv.Image = d; |
83 |
//zoomAndPanCanvas.Children.Add(vvv); |
84 |
|
85 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width); |
86 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height); |
87 |
|
88 |
//this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth); |
89 |
//this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight); |
90 |
|
91 |
Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width; |
92 |
Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height; |
93 |
//zoomAndPanControl.AnimatedScaleToFit(); |
94 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit(); |
95 |
} |
96 |
} |
97 |
|
98 |
private void btnSync_Click(object sender, RoutedEventArgs e) |
99 |
{ |
100 |
if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden) |
101 |
{ |
102 |
this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false; |
103 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout(); |
104 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit(); |
105 |
} |
106 |
else |
107 |
{ |
108 |
this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true; |
109 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout(); |
110 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit(); |
111 |
} |
112 |
|
113 |
} |
114 |
} |
115 |
} |