프로젝트

일반

사용자정보

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

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

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

1
using KCOM.Common;
2
using System;
3
using System.Collections.Generic;
4
using System.Linq;
5
using System.Text;
6
using System.Windows;
7
using System.Windows.Controls;
8
using System.Windows.Data;
9
using System.Windows.Documents;
10
using System.Windows.Input;
11
using System.Windows.Media;
12
using System.Windows.Media.Imaging;
13
using System.Windows.Navigation;
14
using System.Windows.Shapes;
15
using Telerik.Windows.Controls;
16

    
17
namespace KCOM.Views
18
{
19
    /// <summary>
20
    /// TopMenu.xaml에 대한 상호 작용 논리
21
    /// </summary>
22
    public partial class TopMenu : UserControl
23
    {
24
        public TopMenu()
25
        {
26
            //App.splashString(ISplashMessage.TOPMENU);
27
            InitializeComponent();
28

    
29
            this.Loaded += TopMenu_Loaded;
30

    
31
        }
32

    
33
        bool _Initialize = false;
34

    
35
        private void TopMenu_Loaded(object sender, RoutedEventArgs e)
36
        {
37
            if(!_Initialize)
38
            {
39
                InitDataSet();
40

    
41
                _Initialize = true;
42

    
43
                comboFontFamily.SelectionChanged += RadRibbonComboBox_SelectionChanged;
44

    
45
                if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
46
                {
47
                    SAVE.Visibility = Visibility.Collapsed;
48
                }
49

    
50
                if (KCOM.Properties.Settings.Default.cad == 0)
51
                {
52
                    AutoCAD.Visibility = Visibility.Hidden;
53
                }
54

    
55
                if (KCOM.Properties.Settings.Default.grouping == 0)
56
                {
57
                    GROUP.Visibility = Visibility.Hidden;
58
                }
59
            }
60
        }
61

    
62
        private void btnFromFile_Click(object sender, RoutedEventArgs e)
63
        {
64
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
65
            var result = dialog.ShowDialog();
66
            if (result == System.Windows.Forms.DialogResult.OK)
67
            {
68
                //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
69
                //{
70
                    System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName);
71

    
72
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
73
                    t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
74
                    BitmapImage ix = new BitmapImage();
75
                    ix.BeginInit();
76
                    ix.CacheOption = BitmapCacheOption.OnLoad;
77
                    ix.StreamSource = ms;
78
                    ix.EndInit();
79

    
80
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix;
81
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width;
82
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height;
83

    
84

    
85
                    //this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
86
                    //imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
87
                    //imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White;
88

    
89
                    //var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None);
90
                    //RasterImageViewer vvv = new RasterImageViewer();
91
                    //vvv.Image = d;
92
                    //zoomAndPanCanvas.Children.Add(vvv);
93

    
94
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width);
95
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height);
96

    
97
                    //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth);
98
                    //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight);
99

    
100
                    Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width;
101
                    Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height;
102
                    //zoomAndPanControl.AnimatedScaleToFit();
103
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
104
                //}
105
            }
106
        }
107
        
108
        private void btnSync_Click(object sender, RoutedEventArgs e)
109
        {
110
            if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden)
111
            {
112
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false;
113
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout();
114
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit();
115
            }
116
            else
117
            {
118
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true;
119
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout();
120
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
121
            }
122
            
123
        }
124

    
125
        
126
    }
127
}
클립보드 이미지 추가 (최대 크기: 500 MB)