프로젝트

일반

사용자정보

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

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

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

1
using System;
2
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
            //App.splashString(ISplashMessage.TOPMENU);
17
            InitializeComponent();
18

    
19
            this.Loaded += TopMenu_Loaded;
20

    
21
        }
22

    
23
        bool _Initialize = false;
24

    
25
        private void TopMenu_Loaded(object sender, RoutedEventArgs e)
26
        {
27
            if (!App.IsDesignMode)
28
            {
29
                if (!_Initialize)
30
                {
31
                    InitDataSet();
32

    
33
                    _Initialize = true;
34

    
35
                    comboFontFamily.SelectionChanged += comboFontFamily_SelectionChanged;
36

    
37
                    if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
38
                    {
39
                        SAVE.Visibility = Visibility.Collapsed;
40
                    }
41

    
42
                    if (KCOM.Properties.Settings.Default.cad == 0)
43
                    {
44
                        AutoCAD.Visibility = Visibility.Hidden;
45
                    }
46

    
47
                    if (KCOM.Properties.Settings.Default.grouping == 0)
48
                    {
49
                        GROUP.Visibility = Visibility.Hidden;
50
                    }
51
                }
52
            }
53
        }
54

    
55
        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
                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
            }
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)