1 |
787a4489
|
KangIngu
|
using KCOM.Common;
|
2 |
|
|
using KCOMDataModel;
|
3 |
|
|
using KCOMDataModel.DataModel;
|
4 |
|
|
using System;
|
5 |
|
|
using System.Collections.Generic;
|
6 |
6707a5c7
|
ljiyeon
|
using System.IO;
|
7 |
787a4489
|
KangIngu
|
using System.Linq;
|
8 |
71bfd53e
|
ljiyeon
|
using System.Runtime.InteropServices;
|
9 |
787a4489
|
KangIngu
|
using System.Text;
|
10 |
|
|
using System.Windows;
|
11 |
|
|
using System.Windows.Controls;
|
12 |
|
|
using System.Windows.Data;
|
13 |
|
|
using System.Windows.Documents;
|
14 |
|
|
using System.Windows.Input;
|
15 |
|
|
using System.Windows.Media;
|
16 |
|
|
using System.Windows.Media.Imaging;
|
17 |
|
|
using System.Windows.Navigation;
|
18 |
|
|
using System.Windows.Shapes;
|
19 |
6707a5c7
|
ljiyeon
|
using System.Xml;
|
20 |
992a98b4
|
KangIngu
|
using Telerik.Windows.Controls;
|
21 |
d2b05ce7
|
ljiyeon
|
using WinInterop = System.Windows.Interop;
|
22 |
787a4489
|
KangIngu
|
|
23 |
|
|
namespace KCOM
|
24 |
|
|
{
|
25 |
|
|
/// <summary>
|
26 |
|
|
/// MainWindow.xaml에 대한 상호 작용 논리
|
27 |
|
|
/// </summary>
|
28 |
|
|
public partial class MainWindow : Window
|
29 |
|
|
{
|
30 |
|
|
|
31 |
|
|
public MainWindow()
|
32 |
|
|
{
|
33 |
0c997b99
|
ljiyeon
|
//InitializeComponent();
|
34 |
787a4489
|
KangIngu
|
this.Loaded += MainWindow_Loaded;
|
35 |
|
|
this.KeyDown += new KeyEventHandler(KeyEventDownAction);
|
36 |
|
|
this.KeyUp += new KeyEventHandler(KeyEventUpAction);
|
37 |
d2b05ce7
|
ljiyeon
|
this.SourceInitialized += new EventHandler(win_SourceInitialized);
|
38 |
787a4489
|
KangIngu
|
}
|
39 |
ca16abb2
|
ljiyeon
|
|
40 |
|
|
public static BitmapImage CursorChange()
|
41 |
|
|
{
|
42 |
|
|
BitmapImage bmp = new BitmapImage();
|
43 |
|
|
bmp.BeginInit();
|
44 |
|
|
bmp.StreamSource = System.Windows.Application.GetResourceStream(new Uri("/KCOM;Component/Resources/Cursor/customCursor2.cur", UriKind.Relative)).Stream;
|
45 |
|
|
return bmp;
|
46 |
|
|
}
|
47 |
|
|
|
48 |
787a4489
|
KangIngu
|
public void DialogMessage_Alert(string content, string header)
|
49 |
|
|
{
|
50 |
|
|
var box = new TextBlock();
|
51 |
|
|
box.MinWidth = 400;
|
52 |
|
|
box.FontSize = 12;
|
53 |
|
|
box.Text = content;
|
54 |
|
|
box.TextWrapping = System.Windows.TextWrapping.Wrap;
|
55 |
|
|
|
56 |
|
|
Telerik.Windows.Controls.DialogParameters parameters = new Telerik.Windows.Controls.DialogParameters()
|
57 |
|
|
{
|
58 |
|
|
Content = box,
|
59 |
|
|
Header = header,
|
60 |
|
|
Theme = new Telerik.Windows.Controls.VisualStudio2013Theme(),
|
61 |
|
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
62 |
|
|
};
|
63 |
|
|
Telerik.Windows.Controls.RadWindow.Alert(parameters);
|
64 |
|
|
}
|
65 |
6c781c0c
|
djkim
|
|
66 |
787a4489
|
KangIngu
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
67 |
|
|
{
|
68 |
0c997b99
|
ljiyeon
|
InitializeComponent();
|
69 |
ca16abb2
|
ljiyeon
|
|
70 |
|
|
//cursor change
|
71 |
|
|
this.Cursor = new Cursor(CursorChange().StreamSource);
|
72 |
|
|
|
73 |
787a4489
|
KangIngu
|
double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
|
74 |
|
|
double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
|
75 |
9f473fb7
|
KangIngu
|
//this.Width += 40;
|
76 |
787a4489
|
KangIngu
|
double windowWidth = this.Width;
|
77 |
|
|
double windowHeight = this.Height;
|
78 |
|
|
this.Left = (screenWidth / 2) - (windowWidth / 2);
|
79 |
|
|
this.Top = (screenHeight / 2) - (windowHeight / 2);
|
80 |
|
|
|
81 |
|
|
ViewerDataModel.Instance.SystemMain = this;
|
82 |
|
|
|
83 |
|
|
if (!App.ParameterMode)
|
84 |
|
|
{
|
85 |
|
|
//App.ViewInfo = new IKCOM.ViewInfo
|
86 |
|
|
//{
|
87 |
|
|
// DocumentItemID = "11111112",
|
88 |
|
|
// //DocumentItemID = "10001",
|
89 |
|
|
// bPartner = false,
|
90 |
|
|
// CreateFinalPDFPermission = true,
|
91 |
|
|
// NewCommentPermission = true,
|
92 |
|
|
// ProjectNO = "000000",
|
93 |
|
|
// UserID = "H2011357",
|
94 |
|
|
// //UserID = "H2009115",
|
95 |
|
|
// //Mode = 0 , 1 , 2
|
96 |
|
|
//};
|
97 |
|
|
//DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내");
|
98 |
|
|
|
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
|
116 |
|
|
|
117 |
|
|
DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내");
|
118 |
|
|
this.dzMainMenu.pageNavigator.Visibility = Visibility.Collapsed;
|
119 |
|
|
this.dzMainMenu.historyPane.Visibility = Visibility.Collapsed;
|
120 |
|
|
this.dzMainMenu.infoListPane.Visibility = Visibility.Collapsed;
|
121 |
|
|
this.dzMainMenu.searchPane.Visibility = Visibility.Collapsed;
|
122 |
|
|
this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed;
|
123 |
|
|
//#endif
|
124 |
|
|
}
|
125 |
|
|
else
|
126 |
|
|
{
|
127 |
|
|
this.dzMainMenu.ServiceOn();
|
128 |
992a98b4
|
KangIngu
|
|
129 |
|
|
if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
|
130 |
|
|
{
|
131 |
|
|
this.dzTopMenu.radRibbonView.HelpButtonVisibility = Visibility.Collapsed;
|
132 |
|
|
var list = this.dzTopMenu.ChildrenOfType<RadRibbonTab>().ToList();
|
133 |
|
|
list.ForEach(item => item.Visibility = Visibility.Collapsed);
|
134 |
|
|
this.dzTopMenu.ribbontab_ReadOnly.Visibility = Visibility.Visible;
|
135 |
|
|
this.dzTopMenu.radRibbonView.SelectedItem = this.dzTopMenu.ribbontab_ReadOnly;
|
136 |
e0204db0
|
djkim
|
//this.dzMainMenu.SymbolPane.Visibility = Visibility.Collapsed;
|
137 |
|
|
//this.dzMainMenu.FavoritePane.Visibility = Visibility.Collapsed;
|
138 |
|
|
//this.dzMainMenu.drawingRotateCanvas.IsHitTestVisible = false;
|
139 |
992a98b4
|
KangIngu
|
}
|
140 |
787a4489
|
KangIngu
|
this.dzMainMenu.SetView(App.ViewInfo);
|
141 |
6707a5c7
|
ljiyeon
|
this.dzMainMenu.HubSet();
|
142 |
787a4489
|
KangIngu
|
}
|
143 |
6707a5c7
|
ljiyeon
|
|
144 |
787a4489
|
KangIngu
|
//App.ViewInfo = new IKCOM.ViewInfo
|
145 |
|
|
//{
|
146 |
|
|
// DocumentItemID = "11111112",
|
147 |
|
|
// //DocumentItemID = "10001",
|
148 |
|
|
// bPartner = false,
|
149 |
|
|
// CreateFinalPDFPermission = true,
|
150 |
|
|
// NewCommentPermission = true,
|
151 |
|
|
// ProjectNO = "000000",
|
152 |
|
|
// UserID = "H2011357",
|
153 |
|
|
// //UserID = "H2009115",
|
154 |
|
|
// //Mode = 0 , 1 , 2
|
155 |
|
|
//};
|
156 |
|
|
|
157 |
|
|
//this.dzMainMenu.ServiceOn();
|
158 |
|
|
//this.dzMainMenu.SetView(App.ViewInfo);
|
159 |
|
|
}
|
160 |
6707a5c7
|
ljiyeon
|
|
161 |
71bfd53e
|
ljiyeon
|
|
162 |
|
|
bool restoreIfMove = false;
|
163 |
|
|
|
164 |
787a4489
|
KangIngu
|
private void WindowDragEvent(object sender, MouseButtonEventArgs e)
|
165 |
|
|
{
|
166 |
71bfd53e
|
ljiyeon
|
if (e.ClickCount == 2)
|
167 |
787a4489
|
KangIngu
|
{
|
168 |
71bfd53e
|
ljiyeon
|
if ((ResizeMode == ResizeMode.CanResize) ||
|
169 |
|
|
(ResizeMode == ResizeMode.CanResizeWithGrip))
|
170 |
787a4489
|
KangIngu
|
{
|
171 |
71bfd53e
|
ljiyeon
|
SwitchState();
|
172 |
787a4489
|
KangIngu
|
}
|
173 |
|
|
}
|
174 |
|
|
else
|
175 |
|
|
{
|
176 |
71bfd53e
|
ljiyeon
|
if (WindowState == WindowState.Maximized)
|
177 |
|
|
{
|
178 |
|
|
restoreIfMove = true;
|
179 |
|
|
}
|
180 |
787a4489
|
KangIngu
|
this.DragMove();
|
181 |
|
|
}
|
182 |
|
|
}
|
183 |
|
|
|
184 |
71bfd53e
|
ljiyeon
|
private void WindowDragEventUp(object sender, MouseButtonEventArgs e)
|
185 |
|
|
{
|
186 |
|
|
restoreIfMove = false;
|
187 |
|
|
}
|
188 |
|
|
|
189 |
|
|
private void WindowDragEventMove(object sender, MouseEventArgs e)
|
190 |
|
|
{
|
191 |
|
|
if (restoreIfMove)
|
192 |
|
|
{
|
193 |
|
|
if (Mouse.LeftButton == MouseButtonState.Pressed)
|
194 |
|
|
{
|
195 |
|
|
restoreIfMove = false;
|
196 |
|
|
|
197 |
|
|
double percentHorizontal = e.GetPosition(this).X / ActualWidth;
|
198 |
|
|
double targetHorizontal = RestoreBounds.Width * percentHorizontal;
|
199 |
|
|
|
200 |
|
|
double percentVertical = e.GetPosition(this).Y / ActualHeight;
|
201 |
|
|
double targetVertical = RestoreBounds.Height * percentVertical;
|
202 |
|
|
|
203 |
|
|
POINT lMousePosition;
|
204 |
|
|
GetCursorPos(out lMousePosition);
|
205 |
|
|
|
206 |
|
|
Left = lMousePosition.X - targetHorizontal;
|
207 |
|
|
Top = lMousePosition.Y - targetVertical;
|
208 |
|
|
|
209 |
|
|
WindowState = WindowState.Normal;
|
210 |
|
|
|
211 |
|
|
this.DragMove();
|
212 |
|
|
}
|
213 |
|
|
}
|
214 |
|
|
}
|
215 |
|
|
|
216 |
|
|
[DllImport("user32.dll")]
|
217 |
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
218 |
|
|
static extern bool GetCursorPos(out POINT lpPoint);
|
219 |
|
|
|
220 |
|
|
[StructLayout(LayoutKind.Sequential)]
|
221 |
|
|
public struct POINT
|
222 |
|
|
{
|
223 |
|
|
public int X;
|
224 |
|
|
public int Y;
|
225 |
|
|
|
226 |
|
|
public POINT(int x, int y)
|
227 |
|
|
{
|
228 |
|
|
this.X = x;
|
229 |
|
|
this.Y = y;
|
230 |
|
|
}
|
231 |
|
|
}
|
232 |
|
|
|
233 |
|
|
private void SwitchState()
|
234 |
|
|
{
|
235 |
|
|
switch (WindowState)
|
236 |
|
|
{
|
237 |
|
|
case WindowState.Normal:
|
238 |
|
|
{
|
239 |
|
|
WindowState = WindowState.Maximized;
|
240 |
|
|
break;
|
241 |
|
|
}
|
242 |
|
|
case WindowState.Maximized:
|
243 |
|
|
{
|
244 |
|
|
WindowState = WindowState.Normal;
|
245 |
|
|
break;
|
246 |
|
|
}
|
247 |
|
|
}
|
248 |
|
|
}
|
249 |
|
|
|
250 |
787a4489
|
KangIngu
|
private void RadButton_Click(object sender, RoutedEventArgs e)
|
251 |
|
|
{
|
252 |
|
|
Telerik.Windows.Controls.RadButton button = sender as Telerik.Windows.Controls.RadButton;
|
253 |
|
|
|
254 |
|
|
switch (button.CommandParameter.ToString())
|
255 |
|
|
{
|
256 |
|
|
case ("Min"):
|
257 |
|
|
{
|
258 |
|
|
WindowState = WindowState.Minimized;
|
259 |
|
|
}
|
260 |
|
|
break;
|
261 |
|
|
case ("Max"):
|
262 |
|
|
{
|
263 |
|
|
WindowState = WindowState.Maximized;
|
264 |
|
|
}
|
265 |
|
|
break;
|
266 |
|
|
case ("Exit"):
|
267 |
|
|
{
|
268 |
|
|
|
269 |
|
|
}
|
270 |
|
|
break;
|
271 |
|
|
}
|
272 |
|
|
}
|
273 |
|
|
|
274 |
|
|
private void WinState(object sender, MouseButtonEventArgs e)
|
275 |
|
|
{
|
276 |
af177ca1
|
djkim
|
switch ((e.Source as Image).Name)
|
277 |
787a4489
|
KangIngu
|
{
|
278 |
af177ca1
|
djkim
|
case ("Win_min"):
|
279 |
787a4489
|
KangIngu
|
{
|
280 |
|
|
WindowState = WindowState.Minimized;
|
281 |
|
|
}
|
282 |
|
|
break;
|
283 |
af177ca1
|
djkim
|
case ("Win_max"):
|
284 |
787a4489
|
KangIngu
|
{
|
285 |
af177ca1
|
djkim
|
if (WindowState == WindowState.Maximized)
|
286 |
|
|
{
|
287 |
787a4489
|
KangIngu
|
WindowState = WindowState.Normal;
|
288 |
af177ca1
|
djkim
|
}
|
289 |
787a4489
|
KangIngu
|
else
|
290 |
af177ca1
|
djkim
|
{
|
291 |
787a4489
|
KangIngu
|
WindowState = WindowState.Maximized;
|
292 |
af177ca1
|
djkim
|
}
|
293 |
787a4489
|
KangIngu
|
}
|
294 |
|
|
break;
|
295 |
af177ca1
|
djkim
|
case ("Win_Close"):
|
296 |
787a4489
|
KangIngu
|
{
|
297 |
316d0f5c
|
KangIngu
|
if (ViewerDataModel.Instance.UndoDataList.Count > 0)
|
298 |
69ef0800
|
KangIngu
|
{
|
299 |
316d0f5c
|
KangIngu
|
DateTime undoTime = ViewerDataModel.Instance.UndoDataList.OrderByDescending(order => order.EventTime).FirstOrDefault().EventTime;
|
300 |
d2cd1e16
|
djkim
|
DateTime updatetime = DateTime.Now.AddDays(-1);
|
301 |
|
|
if (ViewerDataModel.Instance._markupInfoList.Count > 0)
|
302 |
|
|
{
|
303 |
|
|
updatetime = ViewerDataModel.Instance._markupInfoList.OrderByDescending(order => order.UpdateTime).FirstOrDefault().UpdateTime;
|
304 |
|
|
}
|
305 |
6707a5c7
|
ljiyeon
|
|
306 |
316d0f5c
|
KangIngu
|
if (undoTime > updatetime)
|
307 |
|
|
{
|
308 |
69ef0800
|
KangIngu
|
var box = new TextBlock();
|
309 |
|
|
box.MinWidth = 400;
|
310 |
|
|
box.FontSize = 11;
|
311 |
|
|
box.Text = "저장되지 않은 코멘트가 있습니다. 저장 하시겠습니까?";
|
312 |
|
|
box.TextWrapping = System.Windows.TextWrapping.Wrap;
|
313 |
|
|
|
314 |
|
|
DialogParameters parameters = new DialogParameters()
|
315 |
|
|
{
|
316 |
|
|
Content = box,
|
317 |
|
|
Header = "Confirm",
|
318 |
|
|
Theme = new VisualStudio2013Theme(),
|
319 |
|
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
320 |
|
|
Closed = Onclose,
|
321 |
|
|
};
|
322 |
|
|
RadWindow.Confirm(parameters);
|
323 |
|
|
}
|
324 |
316d0f5c
|
KangIngu
|
}
|
325 |
787a4489
|
KangIngu
|
this.Close();
|
326 |
|
|
}
|
327 |
|
|
break;
|
328 |
|
|
}
|
329 |
|
|
}
|
330 |
|
|
|
331 |
69ef0800
|
KangIngu
|
private void Onclose(object sender, WindowClosedEventArgs e)
|
332 |
|
|
{
|
333 |
|
|
if (e.DialogResult == true)
|
334 |
|
|
{
|
335 |
|
|
dzTopMenu.SaveEvent(null, null);
|
336 |
|
|
}
|
337 |
|
|
}
|
338 |
d2b05ce7
|
ljiyeon
|
|
339 |
|
|
void win_SourceInitialized(object sender, EventArgs e)
|
340 |
|
|
{
|
341 |
|
|
System.IntPtr handle = (new WinInterop.WindowInteropHelper(this)).Handle;
|
342 |
|
|
WinInterop.HwndSource.FromHwnd(handle).AddHook(new WinInterop.HwndSourceHook(WindowProc));
|
343 |
|
|
}
|
344 |
|
|
|
345 |
|
|
private static System.IntPtr WindowProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)
|
346 |
|
|
{
|
347 |
|
|
switch (msg)
|
348 |
|
|
{
|
349 |
|
|
case 0x0024:
|
350 |
|
|
WmGetMinMaxInfo(hwnd, lParam);
|
351 |
|
|
handled = true;
|
352 |
|
|
break;
|
353 |
|
|
}
|
354 |
|
|
|
355 |
|
|
return (System.IntPtr)0;
|
356 |
|
|
}
|
357 |
|
|
|
358 |
|
|
private static void WmGetMinMaxInfo(System.IntPtr hwnd, System.IntPtr lParam)
|
359 |
|
|
{
|
360 |
|
|
MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
|
361 |
|
|
int MONITOR_DEFAULTTONEAREST = 0x00000002;
|
362 |
|
|
System.IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
|
363 |
|
|
|
364 |
|
|
if (monitor != System.IntPtr.Zero)
|
365 |
|
|
{
|
366 |
|
|
MONITORINFO monitorInfo = new MONITORINFO();
|
367 |
|
|
GetMonitorInfo(monitor, monitorInfo);
|
368 |
|
|
RECT rcWorkArea = monitorInfo.rcWork;
|
369 |
|
|
RECT rcMonitorArea = monitorInfo.rcMonitor;
|
370 |
|
|
mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left);
|
371 |
|
|
mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top);
|
372 |
|
|
mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left);
|
373 |
|
|
mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top);
|
374 |
|
|
}
|
375 |
|
|
Marshal.StructureToPtr(mmi, lParam, true);
|
376 |
|
|
}
|
377 |
|
|
|
378 |
|
|
[StructLayout(LayoutKind.Sequential)]
|
379 |
|
|
public struct POINT2
|
380 |
|
|
{
|
381 |
|
|
public int x;
|
382 |
|
|
public int y;
|
383 |
|
|
public POINT2(int x, int y)
|
384 |
|
|
{
|
385 |
|
|
this.x = x;
|
386 |
|
|
this.y = y;
|
387 |
|
|
}
|
388 |
|
|
}
|
389 |
|
|
|
390 |
|
|
[StructLayout(LayoutKind.Sequential)]
|
391 |
|
|
public struct MINMAXINFO
|
392 |
|
|
{
|
393 |
|
|
public POINT2 ptReserved;
|
394 |
|
|
public POINT2 ptMaxSize;
|
395 |
|
|
public POINT2 ptMaxPosition;
|
396 |
|
|
public POINT2 ptMinTrackSize;
|
397 |
|
|
public POINT2 ptMaxTrackSize;
|
398 |
|
|
};
|
399 |
|
|
|
400 |
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
401 |
|
|
public class MONITORINFO
|
402 |
|
|
{
|
403 |
|
|
public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));
|
404 |
|
|
public RECT rcMonitor = new RECT();
|
405 |
|
|
public RECT rcWork = new RECT();
|
406 |
|
|
public int dwFlags = 0;
|
407 |
|
|
}
|
408 |
|
|
|
409 |
|
|
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
410 |
|
|
public struct RECT
|
411 |
|
|
{
|
412 |
|
|
public int left;
|
413 |
|
|
public int top;
|
414 |
|
|
public int right;
|
415 |
|
|
public int bottom;
|
416 |
|
|
|
417 |
|
|
public static readonly RECT Empty = new RECT();
|
418 |
|
|
|
419 |
|
|
public int Width
|
420 |
|
|
{
|
421 |
|
|
get { return Math.Abs(right - left); } // Abs needed for BIDI OS
|
422 |
|
|
}
|
423 |
|
|
|
424 |
|
|
public int Height
|
425 |
|
|
{
|
426 |
|
|
get { return bottom - top; }
|
427 |
|
|
}
|
428 |
|
|
|
429 |
|
|
public RECT(int left, int top, int right, int bottom)
|
430 |
|
|
{
|
431 |
|
|
this.left = left;
|
432 |
|
|
this.top = top;
|
433 |
|
|
this.right = right;
|
434 |
|
|
this.bottom = bottom;
|
435 |
|
|
}
|
436 |
|
|
|
437 |
|
|
public RECT(RECT rcSrc)
|
438 |
|
|
{
|
439 |
|
|
this.left = rcSrc.left;
|
440 |
|
|
this.top = rcSrc.top;
|
441 |
|
|
this.right = rcSrc.right;
|
442 |
|
|
this.bottom = rcSrc.bottom;
|
443 |
|
|
}
|
444 |
|
|
|
445 |
|
|
public bool IsEmpty
|
446 |
|
|
{
|
447 |
|
|
get
|
448 |
|
|
{
|
449 |
|
|
// BUGBUG : On Bidi OS (hebrew arabic) left > right
|
450 |
|
|
return left >= right || top >= bottom;
|
451 |
|
|
}
|
452 |
|
|
}
|
453 |
|
|
|
454 |
|
|
public override bool Equals(object obj)
|
455 |
|
|
{
|
456 |
|
|
if (!(obj is Rect)) { return false; }
|
457 |
|
|
return (this == (RECT)obj);
|
458 |
|
|
}
|
459 |
|
|
|
460 |
|
|
public override int GetHashCode()
|
461 |
|
|
{
|
462 |
|
|
return left.GetHashCode() + top.GetHashCode() + right.GetHashCode() + bottom.GetHashCode();
|
463 |
|
|
}
|
464 |
|
|
|
465 |
|
|
public static bool operator ==(RECT rect1, RECT rect2)
|
466 |
|
|
{
|
467 |
|
|
return (rect1.left == rect2.left && rect1.top == rect2.top && rect1.right == rect2.right && rect1.bottom == rect2.bottom);
|
468 |
|
|
}
|
469 |
|
|
|
470 |
|
|
public static bool operator !=(RECT rect1, RECT rect2)
|
471 |
|
|
{
|
472 |
|
|
return !(rect1 == rect2);
|
473 |
|
|
}
|
474 |
|
|
}
|
475 |
|
|
|
476 |
|
|
[DllImport("user32")]
|
477 |
|
|
internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
|
478 |
|
|
|
479 |
|
|
[DllImport("User32")]
|
480 |
|
|
internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
|
481 |
787a4489
|
KangIngu
|
}
|
482 |
|
|
}
|