프로젝트

일반

사용자정보

개정판 68302e9d

ID68302e9def9bd00b98ec63a09be4c70d776e4982
상위 67994a4d
하위 b643fcca

김태성이(가) 4년 이상 전에 추가함

- main window 수정

Change-Id: I825e1cdfb1cdb1929cb5984eb848518eea111e43

차이점 보기:

KCOM/Controls/CustomWindow.cs
38 38
        }
39 39
    }
40 40

  
41
    public partial class VS2012WindowStyle
41
    public class CustomWindow : Window
42 42
    {
43
        public Rect NomalWindowArea
44
        {
45
            get { return (Rect)GetValue(NomalWindowAreaProperty); }
46
            set { SetValue(NomalWindowAreaProperty, value); }
47
        }
48

  
49
        public static readonly DependencyProperty NomalWindowAreaProperty = DependencyProperty.Register("NomalWindowArea", typeof(Rect),typeof(CustomWindow), null);
50

  
51

  
52
        public WindowState CustomState
53
        {
54
            get { return (WindowState)GetValue(CustomStateProperty); }
55
            set { SetValue(CustomStateProperty, value); }
56
        }
57

  
58
        public static readonly DependencyProperty CustomStateProperty = DependencyProperty.Register("CustomState", typeof(WindowState),
59
                                                                    typeof(CustomWindow), new FrameworkPropertyMetadata(WindowState.Normal, new PropertyChangedCallback(CustomStatePropertyChanged)));
43 60

  
44
        #region sizing event handlers
61
        private static void CustomStatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
62
        {
63
            
64
        }
45 65

  
66
        protected override void OnStateChanged(EventArgs e)
67
        {
68
            base.OnStateChanged(e);
69
        }
70
    }
71

  
72
    public partial class VS2012WindowStyle
73
    {
46 74
        void OnSizeSouth(object sender, MouseButtonEventArgs e) { OnSize(sender, SizingAction.South); }
47 75
        void OnSizeNorth(object sender, MouseButtonEventArgs e) { OnSize(sender, SizingAction.North); }
48 76
        void OnSizeEast(object sender, MouseButtonEventArgs e) { OnSize(sender, SizingAction.East); }
......
58 86
            {
59 87
                sender.ForWindowFromTemplate(w =>
60 88
                {
61
                    if (w.WindowState == WindowState.Normal)
89
                    var win = w as CustomWindow;
90

  
91
                    if (win.CustomState == WindowState.Normal)
62 92
                        DragSize(w.GetWindowHandle(), action);
63 93
                });
64 94
            }
......
91 121
        {
92 122
            sender.ForWindowFromTemplate(w =>
93 123
            {
94
                if (w.WindowState == WindowState.Maximized)
124
                var win = w as CustomizedWindow.CustomWindow;
125

  
126
                if (win.CustomState == WindowState.Maximized)
95 127
                {
96
                    w.WindowState = WindowState.Normal;
128
                    win.WindowState = WindowState.Normal;
129
                    win.CustomState = WindowState.Normal;
130

  
131
                    win.Dispatcher.Invoke(() =>
132
                    {
133
                        win.Left = win.NomalWindowArea.X;
134
                        win.Top = win.NomalWindowArea.Y;
135
                        win.Width = win.NomalWindowArea.Width;
136
                        win.Height = win.NomalWindowArea.Height;
137
                    });
97 138
                }
98 139
                else
99 140
                {
100
                    w.WindowState = WindowState.Maximized;
141
                    win.WindowState = WindowState.Normal;
142
                    win.CustomState = WindowState.Maximized;
143

  
144
                    var screen = GetOnScreen(w);
145

  
146
                    win.NomalWindowArea = new Rect(win.Left, win.Top, win.Width, win.Height);
147

  
148
                    win.Dispatcher.Invoke(() =>
149
                    {
150
                        win.Left = screen.WorkingArea.X;
151
                        win.Width = screen.WorkingArea.Width;
152
                        win.Top = 0;
153
                        win.Height = screen.WorkingArea.Height;
154
                    });
101 155
                }
102 156
            });
103 157
        }
104 158

  
159
        public System.Windows.Forms.Screen GetOnScreen(Window window)
160
        {
161
            var windowRect = new System.Drawing.Rectangle((int)window.Left, (int)window.Top, (int)window.Width, (int)window.Height);
162
            return System.Windows.Forms.Screen.FromRectangle(windowRect);
163
        }
164

  
105 165
        void TitleBarMouseDoubleClick(object sender, MouseButtonEventArgs e)
106 166
        {
107 167
      
......
186 246
            return result;
187 247
        }
188 248

  
189
        #endregion
249
        
190 250

  
191 251
        #region P/Invoke
192 252

  

내보내기 Unified diff

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