프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (5 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
            InitDataSet();
29
            if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
30
            {
31
                SAVE.Visibility = Visibility.Collapsed;
32
            }
33

    
34
            if (KCOM.Properties.Settings.Default.cad == 0)
35
            {
36
                AutoCAD.Visibility = Visibility.Hidden;
37
            }
38

    
39
            if (KCOM.Properties.Settings.Default.grouping == 0)
40
            {
41
                GROUP.Visibility = Visibility.Hidden;
42
            }
43

    
44
        }
45
        private void btnFromFile_Click(object sender, RoutedEventArgs e)
46
        {
47
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
48
            var result = dialog.ShowDialog();
49
            if (result == System.Windows.Forms.DialogResult.OK)
50
            {
51
                //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
52
                //{
53
                    System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName);
54

    
55
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
56
                    t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
57
                    BitmapImage ix = new BitmapImage();
58
                    ix.BeginInit();
59
                    ix.CacheOption = BitmapCacheOption.OnLoad;
60
                    ix.StreamSource = ms;
61
                    ix.EndInit();
62

    
63
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix;
64
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width;
65
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height;
66

    
67

    
68
                    //this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
69
                    //imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
70
                    //imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White;
71

    
72
                    //var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None);
73
                    //RasterImageViewer vvv = new RasterImageViewer();
74
                    //vvv.Image = d;
75
                    //zoomAndPanCanvas.Children.Add(vvv);
76

    
77
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width);
78
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height);
79

    
80
                    //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth);
81
                    //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight);
82

    
83
                    Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width;
84
                    Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height;
85
                    //zoomAndPanControl.AnimatedScaleToFit();
86
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
87
                //}
88
            }
89
        }
90
        
91
        private void btnSync_Click(object sender, RoutedEventArgs e)
92
        {
93
            if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden)
94
            {
95
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false;
96
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout();
97
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit();
98
            }
99
            else
100
            {
101
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true;
102
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout();
103
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
104
            }
105
            
106
        }
107

    
108
        
109
    }
110
}
클립보드 이미지 추가 (최대 크기: 500 MB)