프로젝트

일반

사용자정보

개정판 7e2d29a0

ID7e2d29a073b282b0b45d6cf465f5a388fc9434c6
상위 6fd30ae0
하위 c8e9b3e4

이지연이(가) 약 6년 전에 추가함

issue #763 Maximized 상태일 때 작업표시줄이 안보이는 현상

차이점 보기:

KCOM/MainWindow.xaml.cs
18 18
using System.Windows.Shapes;
19 19
using System.Xml;
20 20
using Telerik.Windows.Controls;
21
using WinInterop = System.Windows.Interop;
21 22

  
22 23
namespace KCOM
23 24
{
......
26 27
    /// </summary>
27 28
    public partial class MainWindow : Window
28 29
    {
29
        
30 30
        public MainWindow()
31 31
        {
32 32
            //InitializeComponent();
33 33
            this.Loaded += MainWindow_Loaded;
34 34
            this.KeyDown += new KeyEventHandler(KeyEventDownAction);
35 35
            this.KeyUp += new KeyEventHandler(KeyEventUpAction);
36
            this.SourceInitialized += new EventHandler(win_SourceInitialized);
36 37
        }
37 38

  
38 39
        public static BitmapImage CursorChange()
......
60 61
            };
61 62
            Telerik.Windows.Controls.RadWindow.Alert(parameters);
62 63
        }
63
                
64

  
64 65
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
65 66
        {
66 67
            InitializeComponent();
......
95 96
                //};
96 97
                //DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내");
97 98

  
98
//#if DEBUG
99
//                App.ViewInfo = new IKCOM.ViewInfo
100
//                {
101
//                    DocumentItemID = "11111112",
102
//                    //DocumentItemID = "10001",
103
//                    bPartner = false,
104
//                    CreateFinalPDFPermission = true,
105
//                    NewCommentPermission = true,
106
//                    ProjectNO = "000000",
107
//                    UserID = "H2011357",
108
//                    //UserID = "H2009115",
109
//                    //Mode = 0 , 1 , 2
110
//                };
111
//                App.ParameterMode = true;
112
//                this.dzMainMenu.ServiceOn();
113
//                this.dzMainMenu.SetView(App.ViewInfo);
114
//#else
99
                //#if DEBUG
100
                //                App.ViewInfo = new IKCOM.ViewInfo
101
                //                {
102
                //                    DocumentItemID = "11111112",
103
                //                    //DocumentItemID = "10001",
104
                //                    bPartner = false,
105
                //                    CreateFinalPDFPermission = true,
106
                //                    NewCommentPermission = true,
107
                //                    ProjectNO = "000000",
108
                //                    UserID = "H2011357",
109
                //                    //UserID = "H2009115",
110
                //                    //Mode = 0 , 1 , 2
111
                //                };
112
                //                App.ParameterMode = true;
113
                //                this.dzMainMenu.ServiceOn();
114
                //                this.dzMainMenu.SetView(App.ViewInfo);
115
                //#else
115 116

  
116 117
                DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내");
117 118
                this.dzMainMenu.pageNavigator.Visibility = Visibility.Collapsed;
......
119 120
                this.dzMainMenu.infoListPane.Visibility = Visibility.Collapsed;
120 121
                this.dzMainMenu.searchPane.Visibility = Visibility.Collapsed;
121 122
                this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed;
122
//#endif
123
                //#endif
123 124
            }
124 125
            else
125 126
            {
......
137 138
                    //this.dzMainMenu.drawingRotateCanvas.IsHitTestVisible = false;
138 139
                }
139 140
                this.dzMainMenu.SetView(App.ViewInfo);
140
                this.dzMainMenu.HubSet();              
141
                this.dzMainMenu.HubSet();
141 142
            }
142 143

  
143 144
            //App.ViewInfo = new IKCOM.ViewInfo
......
158 159
        }
159 160

  
160 161

  
161
        bool restoreIfMove = false;        
162
        bool restoreIfMove = false;
162 163

  
163 164
        private void WindowDragEvent(object sender, MouseButtonEventArgs e)
164 165
        {
......
203 204
                    double targetVertical = RestoreBounds.Height * percentVertical;
204 205

  
205 206
                    POINT lMousePosition;
206
                    GetCursorPos(out lMousePosition);                    
207
                    GetCursorPos(out lMousePosition);
207 208

  
208 209
                    Left = lMousePosition.X - targetHorizontal;
209
                    Top = lMousePosition.Y - targetVertical;
210
                    double top = lMousePosition.Y - targetVertical;
211
                    if(top < 10)
212
                    {
213
                        top = 10;
214
                    }
215
                    Top = lMousePosition.Y;
210 216

  
211 217

  
212 218
                    WindowState = WindowState.Normal;
......
338 344
                dzTopMenu.SaveEvent(null, null);
339 345
            }
340 346
        }
347

  
348
        void win_SourceInitialized(object sender, EventArgs e)
349
        {
350
            System.IntPtr handle = (new WinInterop.WindowInteropHelper(this)).Handle;
351
            WinInterop.HwndSource.FromHwnd(handle).AddHook(new WinInterop.HwndSourceHook(WindowProc));
352
        }
353

  
354
        private static System.IntPtr WindowProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)
355
        {
356
            switch (msg)
357
            {
358
                case 0x0024:
359
                    WmGetMinMaxInfo(hwnd, lParam);
360
                    handled = true;
361
                    break;
362
            }
363
            return (System.IntPtr)0;
364
        }
365

  
366
        private static void WmGetMinMaxInfo(System.IntPtr hwnd, System.IntPtr lParam)
367
        {
368
            MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
369
            int MONITOR_DEFAULTTONEAREST = 0x00000002;
370
            System.IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
371

  
372
            if (monitor != System.IntPtr.Zero)
373
            {
374
                MONITORINFO monitorInfo = new MONITORINFO();
375
                GetMonitorInfo(monitor, monitorInfo);
376
                RECT rcWorkArea = monitorInfo.rcWork;
377
                RECT rcMonitorArea = monitorInfo.rcMonitor;
378
                mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left);
379
                mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top);
380
                mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left);
381
                mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top);
382
            }
383
            Marshal.StructureToPtr(mmi, lParam, true);
384
        }
385

  
386
        [StructLayout(LayoutKind.Sequential)]
387
        public struct POINT2
388
        {
389
            public int x;
390
            public int y;
391
            public POINT2(int x, int y)
392
            {
393
                this.x = x;
394
                this.y = y;
395
            }
396
        }
397

  
398
        [StructLayout(LayoutKind.Sequential)]
399
        public struct MINMAXINFO
400
        {
401
            public POINT2 ptReserved;
402
            public POINT2 ptMaxSize;
403
            public POINT2 ptMaxPosition;
404
            public POINT2 ptMinTrackSize;
405
            public POINT2 ptMaxTrackSize;
406
        };
407

  
408
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
409
        public class MONITORINFO
410
        {         
411
            public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));          
412
            public RECT rcMonitor = new RECT();      
413
            public RECT rcWork = new RECT();      
414
            public int dwFlags = 0;
415
        }
416

  
417
        [StructLayout(LayoutKind.Sequential, Pack = 0)]
418
        public struct RECT
419
        {
420
            public int left;
421
            public int top;
422
            public int right; 
423
            public int bottom;
424

  
425
            public static readonly RECT Empty = new RECT();
426

  
427
            public int Width
428
            {
429
                get { return Math.Abs(right - left); }  // Abs needed for BIDI OS
430
            }
431

  
432
            public int Height
433
            {
434
                get { return bottom - top; }
435
            }
436

  
437
            public RECT(int left, int top, int right, int bottom)
438
            {
439
                this.left = left;
440
                this.top = top;
441
                this.right = right;
442
                this.bottom = bottom;
443
            }
444

  
445
            public RECT(RECT rcSrc)
446
            {
447
                this.left = rcSrc.left;
448
                this.top = rcSrc.top;
449
                this.right = rcSrc.right;
450
                this.bottom = rcSrc.bottom;
451
            }
452

  
453
            public bool IsEmpty
454
            {
455
                get
456
                {
457
                    // BUGBUG : On Bidi OS (hebrew arabic) left > right
458
                    return left >= right || top >= bottom;
459
                }
460
            }
461

  
462
            public override bool Equals(object obj)
463
            {
464
                if (!(obj is Rect)) { return false; }
465
                return (this == (RECT)obj);
466
            }
467

  
468
            public override int GetHashCode()
469
            {
470
                return left.GetHashCode() + top.GetHashCode() + right.GetHashCode() + bottom.GetHashCode();
471
            }
472

  
473
            public static bool operator ==(RECT rect1, RECT rect2)
474
            {
475
                return (rect1.left == rect2.left && rect1.top == rect2.top && rect1.right == rect2.right && rect1.bottom == rect2.bottom);
476
            }
477

  
478
            public static bool operator !=(RECT rect1, RECT rect2)
479
            {
480
                return !(rect1 == rect2);
481
            }
482
        }
483

  
484
        [DllImport("user32")]
485
        internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
486
        [DllImport("User32")]
487
        internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
341 488
    }
342 489
}

내보내기 Unified diff

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