프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Views / TopMenu.xaml.cs @ 65eb8dd6

이력 | 보기 | 이력해설 | 다운로드 (4.64 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
            if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
28
            {
29
                SAVE.Visibility = Visibility.Collapsed;
30
            }
31
        }
32
        private void btnFromFile_Click(object sender, RoutedEventArgs e)
33
        {
34
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
35
            var result = dialog.ShowDialog();
36
            if (result == System.Windows.Forms.DialogResult.OK)
37
            {
38
                //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
39
                //{
40
                    System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName);
41

    
42
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
43
                    t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
44
                    BitmapImage ix = new BitmapImage();
45
                    ix.BeginInit();
46
                    ix.CacheOption = BitmapCacheOption.OnLoad;
47
                    ix.StreamSource = ms;
48
                    ix.EndInit();
49

    
50
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix;
51
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width;
52
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height;
53

    
54

    
55
                    //this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
56
                    //imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
57
                    //imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White;
58

    
59
                    //var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None);
60
                    //RasterImageViewer vvv = new RasterImageViewer();
61
                    //vvv.Image = d;
62
                    //zoomAndPanCanvas.Children.Add(vvv);
63

    
64
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width);
65
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height);
66

    
67
                    //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth);
68
                    //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight);
69

    
70
                    Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width;
71
                    Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height;
72
                    //zoomAndPanControl.AnimatedScaleToFit();
73
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
74
                //}
75
            }
76
        }
77
        
78
        private void btnSync_Click(object sender, RoutedEventArgs e)
79
        {
80
            if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden)
81
            {
82
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false;
83
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout();
84
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit();
85
            }
86
            else
87
            {
88
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true;
89
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout();
90
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
91
            }
92
            
93
        }
94

    
95
        
96
    }
97
}
클립보드 이미지 추가 (최대 크기: 500 MB)