프로젝트

일반

사용자정보

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

markus / KCOM / Views / TopMenu.xaml.cs @ 43e1d368

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

1 cf1cc862 taeseongkim
using System;
2 787a4489 KangIngu
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 366f00c2 taeseongkim
            //App.splashString(ISplashMessage.TOPMENU);
17
            InitializeComponent();
18 022d64c4 ljiyeon
19 366f00c2 taeseongkim
            this.Loaded += TopMenu_Loaded;
20
21
        }
22
23
        bool _Initialize = false;
24 19abb0c0 ljiyeon
25 366f00c2 taeseongkim
        private void TopMenu_Loaded(object sender, RoutedEventArgs e)
26
        {
27 cf1cc862 taeseongkim
            if (!App.IsDesignMode)
28 19abb0c0 ljiyeon
            {
29 cf1cc862 taeseongkim
                if (!_Initialize)
30
                {
31
                    InitDataSet();
32 c5519c44 taeseongkim
33 cf1cc862 taeseongkim
                    _Initialize = true;
34 366f00c2 taeseongkim
35 4fcb686a taeseongkim
                    comboFontFamily.SelectionChanged += comboFontFamily_SelectionChanged;
36 c5519c44 taeseongkim
37 cf1cc862 taeseongkim
                    if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
38
                    {
39
                        SAVE.Visibility = Visibility.Collapsed;
40
                    }
41 19abb0c0 ljiyeon
42 cf1cc862 taeseongkim
                    if (KCOM.Properties.Settings.Default.cad == 0)
43
                    {
44
                        AutoCAD.Visibility = Visibility.Hidden;
45
                    }
46 366f00c2 taeseongkim
47 cf1cc862 taeseongkim
                    if (KCOM.Properties.Settings.Default.grouping == 0)
48
                    {
49
                        GROUP.Visibility = Visibility.Hidden;
50
                    }
51 366f00c2 taeseongkim
                }
52
            }
53 787a4489 KangIngu
        }
54 366f00c2 taeseongkim
55 787a4489 KangIngu
        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 d4b0c723 KangIngu
118 90e7968d ljiyeon
        
119 787a4489 KangIngu
    }
120
}
클립보드 이미지 추가 (최대 크기: 500 MB)