markus / KCOM / Views / TopMenu.xaml.cs @ 708637c6
이력 | 보기 | 이력해설 | 다운로드 (4.45 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 |
using Telerik.Windows.Controls; |
15 |
|
16 |
namespace KCOM.Views |
17 |
{ |
18 |
/// <summary> |
19 |
/// TopMenu.xaml에 대한 상호 작용 논리 |
20 |
/// </summary> |
21 |
public partial class TopMenu : UserControl |
22 |
{ |
23 |
public TopMenu() |
24 |
{ |
25 |
InitializeComponent(); |
26 |
InitDataSet(); |
27 |
} |
28 |
|
29 |
private void btnFromFile_Click(object sender, RoutedEventArgs e) |
30 |
{ |
31 |
System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog(); |
32 |
var result = dialog.ShowDialog(); |
33 |
if (result == System.Windows.Forms.DialogResult.OK) |
34 |
{ |
35 |
//using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs()) |
36 |
//{ |
37 |
System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName); |
38 |
|
39 |
System.IO.MemoryStream ms = new System.IO.MemoryStream(); |
40 |
t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); |
41 |
BitmapImage ix = new BitmapImage(); |
42 |
ix.BeginInit(); |
43 |
ix.CacheOption = BitmapCacheOption.OnLoad; |
44 |
ix.StreamSource = ms; |
45 |
ix.EndInit(); |
46 |
|
47 |
this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix; |
48 |
this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width; |
49 |
this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height; |
50 |
|
51 |
|
52 |
//this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1); |
53 |
//imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1); |
54 |
//imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White; |
55 |
|
56 |
//var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None); |
57 |
//RasterImageViewer vvv = new RasterImageViewer(); |
58 |
//vvv.Image = d; |
59 |
//zoomAndPanCanvas.Children.Add(vvv); |
60 |
|
61 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width); |
62 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height); |
63 |
|
64 |
//this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth); |
65 |
//this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight); |
66 |
|
67 |
Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width; |
68 |
Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height; |
69 |
//zoomAndPanControl.AnimatedScaleToFit(); |
70 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit(); |
71 |
//} |
72 |
} |
73 |
} |
74 |
|
75 |
private void btnSync_Click(object sender, RoutedEventArgs e) |
76 |
{ |
77 |
if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden) |
78 |
{ |
79 |
this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false; |
80 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout(); |
81 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit(); |
82 |
} |
83 |
else |
84 |
{ |
85 |
this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true; |
86 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout(); |
87 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit(); |
88 |
} |
89 |
|
90 |
} |
91 |
|
92 |
|
93 |
} |
94 |
} |