프로젝트

일반

사용자정보

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

markus / KCOM / Views / TopMenu.xaml.cs @ 7fa95b67

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

1 cf1cc862 taeseongkim
using System;
2 a24b6750 swate0609
using System.Text.RegularExpressions;
3 787a4489 KangIngu
using System.Windows;
4
using System.Windows.Controls;
5
using System.Windows.Media.Imaging;
6
using Telerik.Windows.Controls;
7
8
namespace KCOM.Views
9
{
10
    /// <summary>
11
    /// TopMenu.xaml에 대한 상호 작용 논리
12
    /// </summary>
13
    public partial class TopMenu : UserControl
14
    {
15
        public TopMenu()
16
        {
17 366f00c2 taeseongkim
            //App.splashString(ISplashMessage.TOPMENU);
18
            InitializeComponent();
19 022d64c4 ljiyeon
20 366f00c2 taeseongkim
            this.Loaded += TopMenu_Loaded;
21
22
        }
23
24
        bool _Initialize = false;
25 19abb0c0 ljiyeon
26 366f00c2 taeseongkim
        private void TopMenu_Loaded(object sender, RoutedEventArgs e)
27
        {
28 cf1cc862 taeseongkim
            if (!App.IsDesignMode)
29 19abb0c0 ljiyeon
            {
30 cf1cc862 taeseongkim
                if (!_Initialize)
31
                {
32
                    InitDataSet();
33 c5519c44 taeseongkim
34 cf1cc862 taeseongkim
                    _Initialize = true;
35 366f00c2 taeseongkim
36 4fcb686a taeseongkim
                    comboFontFamily.SelectionChanged += comboFontFamily_SelectionChanged;
37 c5519c44 taeseongkim
38 cf1cc862 taeseongkim
                    if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
39
                    {
40
                        SAVE.Visibility = Visibility.Collapsed;
41
                    }
42 19abb0c0 ljiyeon
43 cf1cc862 taeseongkim
                    if (KCOM.Properties.Settings.Default.cad == 0)
44
                    {
45
                        AutoCAD.Visibility = Visibility.Hidden;
46
                    }
47 366f00c2 taeseongkim
48 cf1cc862 taeseongkim
                    if (KCOM.Properties.Settings.Default.grouping == 0)
49
                    {
50
                        GROUP.Visibility = Visibility.Hidden;
51
                    }
52 366f00c2 taeseongkim
                }
53
            }
54 787a4489 KangIngu
        }
55 366f00c2 taeseongkim
56 787a4489 KangIngu
        private void btnFromFile_Click(object sender, RoutedEventArgs e)
57
        {
58
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
59
            var result = dialog.ShowDialog();
60
            if (result == System.Windows.Forms.DialogResult.OK)
61
            {
62 ab7fe8c0 humkyung
                System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName);
63
64
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
65
                t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
66
                BitmapImage ix = new BitmapImage();
67
                ix.BeginInit();
68
                ix.CacheOption = BitmapCacheOption.OnLoad;
69
                ix.StreamSource = ms;
70
                ix.EndInit();
71
72
                this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix;
73
                this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width;
74
                this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height;
75
76
                //this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
77
                //imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
78
                //imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White;
79
80
                //var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None);
81
                //RasterImageViewer vvv = new RasterImageViewer();
82
                //vvv.Image = d;
83
                //zoomAndPanCanvas.Children.Add(vvv);
84
85
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width);
86
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height);
87
88
                //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth);
89
                //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight);
90
91
                Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width;
92
                Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height;
93
                //zoomAndPanControl.AnimatedScaleToFit();
94
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
95 787a4489 KangIngu
            }
96
        }
97
        
98
        private void btnSync_Click(object sender, RoutedEventArgs e)
99
        {
100
            if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden)
101
            {
102
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false;
103
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout();
104
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit();
105
            }
106
            else
107
            {
108
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true;
109
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout();
110
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
111
            }
112
            
113
        }
114 a24b6750 swate0609
115 787a4489 KangIngu
    }
116
}
클립보드 이미지 추가 (최대 크기: 500 MB)