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