프로젝트

일반

사용자정보

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

markus / KCOM / Views / TopMenu.xaml.cs @ 19abb0c0

이력 | 보기 | 이력해설 | 다운로드 (4.92 KB)

1 787a4489 KangIngu
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 65eb8dd6 ljiyeon
            InitDataSet();
27
            if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
28
            {
29
                SAVE.Visibility = Visibility.Collapsed;
30
            }
31 022d64c4 ljiyeon
32
            if (KCOM.Properties.Settings.Default.cad == 0)
33
            {
34
                AutoCAD.Visibility = Visibility.Hidden;
35
            }
36 19abb0c0 ljiyeon
37
            if (KCOM.Properties.Settings.Default.grouping == 0)
38
            {
39
                GROUP.Visibility = Visibility.Hidden;
40
            }
41
42 787a4489 KangIngu
        }
43
        private void btnFromFile_Click(object sender, RoutedEventArgs e)
44
        {
45
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
46
            var result = dialog.ShowDialog();
47
            if (result == System.Windows.Forms.DialogResult.OK)
48
            {
49
                //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
50
                //{
51
                    System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName);
52
53
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
54
                    t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
55
                    BitmapImage ix = new BitmapImage();
56
                    ix.BeginInit();
57
                    ix.CacheOption = BitmapCacheOption.OnLoad;
58
                    ix.StreamSource = ms;
59
                    ix.EndInit();
60
61
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix;
62
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width;
63
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height;
64
65
66
                    //this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
67
                    //imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
68
                    //imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White;
69
70
                    //var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None);
71
                    //RasterImageViewer vvv = new RasterImageViewer();
72
                    //vvv.Image = d;
73
                    //zoomAndPanCanvas.Children.Add(vvv);
74
75
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width);
76
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height);
77
78
                    //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth);
79
                    //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight);
80
81
                    Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width;
82
                    Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height;
83
                    //zoomAndPanControl.AnimatedScaleToFit();
84
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
85
                //}
86
            }
87
        }
88
        
89
        private void btnSync_Click(object sender, RoutedEventArgs e)
90
        {
91
            if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden)
92
            {
93
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false;
94
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout();
95
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit();
96
            }
97
            else
98
            {
99
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true;
100
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout();
101
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
102
            }
103
            
104
        }
105 d4b0c723 KangIngu
106 90e7968d ljiyeon
        
107 787a4489 KangIngu
    }
108
}
클립보드 이미지 추가 (최대 크기: 500 MB)