프로젝트

일반

사용자정보

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

markus / KCOM / Views / TopMenu.xaml.cs @ ab7fe8c0

이력 | 보기 | 이력해설 | 다운로드 (5.01 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 ab7fe8c0 humkyung
                System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName);
62
63
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
64
                t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
65
                BitmapImage ix = new BitmapImage();
66
                ix.BeginInit();
67
                ix.CacheOption = BitmapCacheOption.OnLoad;
68
                ix.StreamSource = ms;
69
                ix.EndInit();
70
71
                this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix;
72
                this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width;
73
                this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height;
74
75
                //this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
76
                //imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
77
                //imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White;
78
79
                //var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None);
80
                //RasterImageViewer vvv = new RasterImageViewer();
81
                //vvv.Image = d;
82
                //zoomAndPanCanvas.Children.Add(vvv);
83
84
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width);
85
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height);
86
87
                //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth);
88
                //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight);
89
90
                Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width;
91
                Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height;
92
                //zoomAndPanControl.AnimatedScaleToFit();
93
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
94 787a4489 KangIngu
            }
95
        }
96
        
97
        private void btnSync_Click(object sender, RoutedEventArgs e)
98
        {
99
            if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden)
100
            {
101
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false;
102
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout();
103
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit();
104
            }
105
            else
106
            {
107
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true;
108
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout();
109
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
110
            }
111
            
112
        }
113
    }
114
}
클립보드 이미지 추가 (최대 크기: 500 MB)