1 | using System;
|
---|
2 | using System.Drawing;
|
---|
3 | using System.Windows.Forms;
|
---|
4 |
|
---|
5 | namespace WeifenLuo.WinFormsUI.Docking {
|
---|
6 | partial class DockPanel {
|
---|
7 | private class AutoHideWindowControl : Panel, ISplitterDragSource {
|
---|
8 | private class SplitterControl : SplitterBase {
|
---|
9 | public SplitterControl(AutoHideWindowControl autoHideWindow) {
|
---|
10 | m_autoHideWindow = autoHideWindow;
|
---|
11 | }
|
---|
12 |
|
---|
13 | private AutoHideWindowControl m_autoHideWindow;
|
---|
14 | private AutoHideWindowControl AutoHideWindow {
|
---|
15 | get { return m_autoHideWindow; }
|
---|
16 | }
|
---|
17 |
|
---|
18 | protected override int SplitterSize {
|
---|
19 | get { return Measures.SplitterSize; }
|
---|
20 | }
|
---|
21 |
|
---|
22 | protected override void StartDrag() {
|
---|
23 | AutoHideWindow.DockPanel.BeginDrag(AutoHideWindow, AutoHideWindow.RectangleToScreen(Bounds));
|
---|
24 | }
|
---|
25 | }
|
---|
26 |
|
---|
27 | #region consts
|
---|
28 | private const int ANIMATE_TIME = 100; // in mini-seconds
|
---|
29 | #endregion
|
---|
30 |
|
---|
31 | private Timer m_timerMouseTrack;
|
---|
32 | private SplitterControl m_splitter;
|
---|
33 |
|
---|
34 | public AutoHideWindowControl(DockPanel dockPanel) {
|
---|
35 | m_dockPanel = dockPanel;
|
---|
36 |
|
---|
37 | m_timerMouseTrack = new Timer();
|
---|
38 | m_timerMouseTrack.Tick += new EventHandler(TimerMouseTrack_Tick);
|
---|
39 |
|
---|
40 | Visible = false;
|
---|
41 | m_splitter = new SplitterControl(this);
|
---|
42 | Controls.Add(m_splitter);
|
---|
43 | }
|
---|
44 |
|
---|
45 | protected override void Dispose(bool disposing) {
|
---|
46 | if (disposing) {
|
---|
47 | m_timerMouseTrack.Dispose();
|
---|
48 | }
|
---|
49 | base.Dispose(disposing);
|
---|
50 | }
|
---|
51 |
|
---|
52 | private DockPanel m_dockPanel = null;
|
---|
53 | public DockPanel DockPanel {
|
---|
54 | get { return m_dockPanel; }
|
---|
55 | }
|
---|
56 |
|
---|
57 | private DockPane m_activePane = null;
|
---|
58 | public DockPane ActivePane {
|
---|
59 | get { return m_activePane; }
|
---|
60 | }
|
---|
61 | private void SetActivePane() {
|
---|
62 | DockPane value = (ActiveContent == null ? null : ActiveContent.DockHandler.Pane);
|
---|
63 |
|
---|
64 | if (value == m_activePane)
|
---|
65 | return;
|
---|
66 |
|
---|
67 | m_activePane = value;
|
---|
68 | }
|
---|
69 |
|
---|
70 | private IDockContent m_activeContent = null;
|
---|
71 | public IDockContent ActiveContent {
|
---|
72 | get { return m_activeContent; }
|
---|
73 | set {
|
---|
74 | if (value == m_activeContent)
|
---|
75 | return;
|
---|
76 |
|
---|
77 | if (value != null) {
|
---|
78 | if (!DockHelper.IsDockStateAutoHide(value.DockHandler.DockState) || value.DockHandler.DockPanel != DockPanel)
|
---|
79 | throw (new InvalidOperationException(Strings.DockPanel_ActiveAutoHideContent_InvalidValue));
|
---|
80 | }
|
---|
81 |
|
---|
82 | DockPanel.SuspendLayout();
|
---|
83 |
|
---|
84 | if (m_activeContent != null) {
|
---|
85 | if (m_activeContent.DockHandler.Form.ContainsFocus)
|
---|
86 | DockPanel.ContentFocusManager.GiveUpFocus(m_activeContent);
|
---|
87 | AnimateWindow(false);
|
---|
88 | }
|
---|
89 |
|
---|
90 | m_activeContent = value;
|
---|
91 | SetActivePane();
|
---|
92 | if (ActivePane != null)
|
---|
93 | ActivePane.ActiveContent = m_activeContent;
|
---|
94 |
|
---|
95 | if (m_activeContent != null)
|
---|
96 | AnimateWindow(true);
|
---|
97 |
|
---|
98 | DockPanel.ResumeLayout();
|
---|
99 | DockPanel.RefreshAutoHideStrip();
|
---|
100 |
|
---|
101 | SetTimerMouseTrack();
|
---|
102 | }
|
---|
103 | }
|
---|
104 |
|
---|
105 | public DockState DockState {
|
---|
106 | get { return ActiveContent == null ? DockState.Unknown : ActiveContent.DockHandler.DockState; }
|
---|
107 | }
|
---|
108 |
|
---|
109 | private bool m_flagAnimate = true;
|
---|
110 | private bool FlagAnimate {
|
---|
111 | get { return m_flagAnimate; }
|
---|
112 | set { m_flagAnimate = value; }
|
---|
113 | }
|
---|
114 |
|
---|
115 | private bool m_flagDragging = false;
|
---|
116 | internal bool FlagDragging {
|
---|
117 | get { return m_flagDragging; }
|
---|
118 | set {
|
---|
119 | if (m_flagDragging == value)
|
---|
120 | return;
|
---|
121 |
|
---|
122 | m_flagDragging = value;
|
---|
123 | SetTimerMouseTrack();
|
---|
124 | }
|
---|
125 | }
|
---|
126 |
|
---|
127 | private void AnimateWindow(bool show) {
|
---|
128 | if (!FlagAnimate && Visible != show) {
|
---|
129 | Visible = show;
|
---|
130 | return;
|
---|
131 | }
|
---|
132 |
|
---|
133 | Parent.SuspendLayout();
|
---|
134 |
|
---|
135 | Rectangle rectSource = GetRectangle(!show);
|
---|
136 | Rectangle rectTarget = GetRectangle(show);
|
---|
137 | int dxLoc, dyLoc;
|
---|
138 | int dWidth, dHeight;
|
---|
139 | dxLoc = dyLoc = dWidth = dHeight = 0;
|
---|
140 | if (DockState == DockState.DockTopAutoHide)
|
---|
141 | dHeight = show ? 1 : -1;
|
---|
142 | else if (DockState == DockState.DockLeftAutoHide)
|
---|
143 | dWidth = show ? 1 : -1;
|
---|
144 | else if (DockState == DockState.DockRightAutoHide) {
|
---|
145 | dxLoc = show ? -1 : 1;
|
---|
146 | dWidth = show ? 1 : -1;
|
---|
147 | } else if (DockState == DockState.DockBottomAutoHide) {
|
---|
148 | dyLoc = (show ? -1 : 1);
|
---|
149 | dHeight = (show ? 1 : -1);
|
---|
150 | }
|
---|
151 |
|
---|
152 | if (show) {
|
---|
153 | Bounds = DockPanel.GetAutoHideWindowBounds(new Rectangle(-rectTarget.Width, -rectTarget.Height, rectTarget.Width, rectTarget.Height));
|
---|
154 | if (Visible == false)
|
---|
155 | Visible = true;
|
---|
156 | PerformLayout();
|
---|
157 | }
|
---|
158 |
|
---|
159 | SuspendLayout();
|
---|
160 |
|
---|
161 | LayoutAnimateWindow(rectSource);
|
---|
162 | if (Visible == false)
|
---|
163 | Visible = true;
|
---|
164 |
|
---|
165 | int speedFactor = 1;
|
---|
166 | int totalPixels = (rectSource.Width != rectTarget.Width) ?
|
---|
167 | Math.Abs(rectSource.Width - rectTarget.Width) :
|
---|
168 | Math.Abs(rectSource.Height - rectTarget.Height);
|
---|
169 | int remainPixels = totalPixels;
|
---|
170 | DateTime startingTime = DateTime.Now;
|
---|
171 | while (rectSource != rectTarget) {
|
---|
172 | DateTime startPerMove = DateTime.Now;
|
---|
173 |
|
---|
174 | rectSource.X += dxLoc * speedFactor;
|
---|
175 | rectSource.Y += dyLoc * speedFactor;
|
---|
176 | rectSource.Width += dWidth * speedFactor;
|
---|
177 | rectSource.Height += dHeight * speedFactor;
|
---|
178 | if (Math.Sign(rectTarget.X - rectSource.X) != Math.Sign(dxLoc))
|
---|
179 | rectSource.X = rectTarget.X;
|
---|
180 | if (Math.Sign(rectTarget.Y - rectSource.Y) != Math.Sign(dyLoc))
|
---|
181 | rectSource.Y = rectTarget.Y;
|
---|
182 | if (Math.Sign(rectTarget.Width - rectSource.Width) != Math.Sign(dWidth))
|
---|
183 | rectSource.Width = rectTarget.Width;
|
---|
184 | if (Math.Sign(rectTarget.Height - rectSource.Height) != Math.Sign(dHeight))
|
---|
185 | rectSource.Height = rectTarget.Height;
|
---|
186 |
|
---|
187 | LayoutAnimateWindow(rectSource);
|
---|
188 | if (Parent != null)
|
---|
189 | Parent.Update();
|
---|
190 |
|
---|
191 | remainPixels -= speedFactor;
|
---|
192 |
|
---|
193 | while (true) {
|
---|
194 | TimeSpan time = new TimeSpan(0, 0, 0, 0, ANIMATE_TIME);
|
---|
195 | TimeSpan elapsedPerMove = DateTime.Now - startPerMove;
|
---|
196 | TimeSpan elapsedTime = DateTime.Now - startingTime;
|
---|
197 | if (((int)((time - elapsedTime).TotalMilliseconds)) <= 0) {
|
---|
198 | speedFactor = remainPixels;
|
---|
199 | break;
|
---|
200 | } else
|
---|
201 | speedFactor = remainPixels * (int)elapsedPerMove.TotalMilliseconds / (int)((time - elapsedTime).TotalMilliseconds);
|
---|
202 | if (speedFactor >= 1)
|
---|
203 | break;
|
---|
204 | }
|
---|
205 | }
|
---|
206 | ResumeLayout();
|
---|
207 | Parent.ResumeLayout();
|
---|
208 | }
|
---|
209 |
|
---|
210 | private void LayoutAnimateWindow(Rectangle rect) {
|
---|
211 | Bounds = DockPanel.GetAutoHideWindowBounds(rect);
|
---|
212 |
|
---|
213 | Rectangle rectClient = ClientRectangle;
|
---|
214 |
|
---|
215 | if (DockState == DockState.DockLeftAutoHide)
|
---|
216 | ActivePane.Location = new Point(rectClient.Right - 2 - Measures.SplitterSize - ActivePane.Width, ActivePane.Location.Y);
|
---|
217 | else if (DockState == DockState.DockTopAutoHide)
|
---|
218 | ActivePane.Location = new Point(ActivePane.Location.X, rectClient.Bottom - 2 - Measures.SplitterSize - ActivePane.Height);
|
---|
219 | }
|
---|
220 |
|
---|
221 | private Rectangle GetRectangle(bool show) {
|
---|
222 | if (DockState == DockState.Unknown)
|
---|
223 | return Rectangle.Empty;
|
---|
224 |
|
---|
225 | Rectangle rect = DockPanel.AutoHideWindowRectangle;
|
---|
226 |
|
---|
227 | if (show)
|
---|
228 | return rect;
|
---|
229 |
|
---|
230 | if (DockState == DockState.DockLeftAutoHide)
|
---|
231 | rect.Width = 0;
|
---|
232 | else if (DockState == DockState.DockRightAutoHide) {
|
---|
233 | rect.X += rect.Width;
|
---|
234 | rect.Width = 0;
|
---|
235 | } else if (DockState == DockState.DockTopAutoHide)
|
---|
236 | rect.Height = 0;
|
---|
237 | else {
|
---|
238 | rect.Y += rect.Height;
|
---|
239 | rect.Height = 0;
|
---|
240 | }
|
---|
241 |
|
---|
242 | return rect;
|
---|
243 | }
|
---|
244 |
|
---|
245 | private void SetTimerMouseTrack() {
|
---|
246 | if (ActivePane == null || ActivePane.IsActivated || FlagDragging) {
|
---|
247 | m_timerMouseTrack.Enabled = false;
|
---|
248 | return;
|
---|
249 | }
|
---|
250 |
|
---|
251 | // start the timer
|
---|
252 | int hovertime = SystemInformation.MouseHoverTime;
|
---|
253 |
|
---|
254 | // assign a default value 400 in case of setting Timer.Interval invalid value exception
|
---|
255 | if (hovertime <= 0)
|
---|
256 | hovertime = 400;
|
---|
257 |
|
---|
258 | m_timerMouseTrack.Interval = 2 * (int)hovertime;
|
---|
259 | m_timerMouseTrack.Enabled = true;
|
---|
260 | }
|
---|
261 |
|
---|
262 | protected virtual Rectangle DisplayingRectangle {
|
---|
263 | get {
|
---|
264 | Rectangle rect = ClientRectangle;
|
---|
265 |
|
---|
266 | // exclude the border and the splitter
|
---|
267 | if (DockState == DockState.DockBottomAutoHide) {
|
---|
268 | rect.Y += 2 + Measures.SplitterSize;
|
---|
269 | rect.Height -= 2 + Measures.SplitterSize;
|
---|
270 | } else if (DockState == DockState.DockRightAutoHide) {
|
---|
271 | rect.X += 2 + Measures.SplitterSize;
|
---|
272 | rect.Width -= 2 + Measures.SplitterSize;
|
---|
273 | } else if (DockState == DockState.DockTopAutoHide)
|
---|
274 | rect.Height -= 2 + Measures.SplitterSize;
|
---|
275 | else if (DockState == DockState.DockLeftAutoHide)
|
---|
276 | rect.Width -= 2 + Measures.SplitterSize;
|
---|
277 |
|
---|
278 | return rect;
|
---|
279 | }
|
---|
280 | }
|
---|
281 |
|
---|
282 | protected override void OnLayout(LayoutEventArgs levent) {
|
---|
283 | DockPadding.All = 0;
|
---|
284 | if (DockState == DockState.DockLeftAutoHide) {
|
---|
285 | DockPadding.Right = 2;
|
---|
286 | m_splitter.Dock = DockStyle.Right;
|
---|
287 | } else if (DockState == DockState.DockRightAutoHide) {
|
---|
288 | DockPadding.Left = 2;
|
---|
289 | m_splitter.Dock = DockStyle.Left;
|
---|
290 | } else if (DockState == DockState.DockTopAutoHide) {
|
---|
291 | DockPadding.Bottom = 2;
|
---|
292 | m_splitter.Dock = DockStyle.Bottom;
|
---|
293 | } else if (DockState == DockState.DockBottomAutoHide) {
|
---|
294 | DockPadding.Top = 2;
|
---|
295 | m_splitter.Dock = DockStyle.Top;
|
---|
296 | }
|
---|
297 |
|
---|
298 | Rectangle rectDisplaying = DisplayingRectangle;
|
---|
299 | Rectangle rectHidden = new Rectangle(-rectDisplaying.Width, rectDisplaying.Y, rectDisplaying.Width, rectDisplaying.Height);
|
---|
300 | foreach (Control c in Controls) {
|
---|
301 | DockPane pane = c as DockPane;
|
---|
302 | if (pane == null)
|
---|
303 | continue;
|
---|
304 |
|
---|
305 |
|
---|
306 | if (pane == ActivePane)
|
---|
307 | pane.Bounds = rectDisplaying;
|
---|
308 | else
|
---|
309 | pane.Bounds = rectHidden;
|
---|
310 | }
|
---|
311 |
|
---|
312 | base.OnLayout(levent);
|
---|
313 | }
|
---|
314 |
|
---|
315 | protected override void OnPaint(PaintEventArgs e) {
|
---|
316 | // Draw the border
|
---|
317 | Graphics g = e.Graphics;
|
---|
318 |
|
---|
319 | if (DockState == DockState.DockBottomAutoHide)
|
---|
320 | g.DrawLine(SystemPens.ControlLightLight, 0, 1, ClientRectangle.Right, 1);
|
---|
321 | else if (DockState == DockState.DockRightAutoHide)
|
---|
322 | g.DrawLine(SystemPens.ControlLightLight, 1, 0, 1, ClientRectangle.Bottom);
|
---|
323 | else if (DockState == DockState.DockTopAutoHide) {
|
---|
324 | g.DrawLine(SystemPens.ControlDark, 0, ClientRectangle.Height - 2, ClientRectangle.Right, ClientRectangle.Height - 2);
|
---|
325 | g.DrawLine(SystemPens.ControlDarkDark, 0, ClientRectangle.Height - 1, ClientRectangle.Right, ClientRectangle.Height - 1);
|
---|
326 | } else if (DockState == DockState.DockLeftAutoHide) {
|
---|
327 | g.DrawLine(SystemPens.ControlDark, ClientRectangle.Width - 2, 0, ClientRectangle.Width - 2, ClientRectangle.Bottom);
|
---|
328 | g.DrawLine(SystemPens.ControlDarkDark, ClientRectangle.Width - 1, 0, ClientRectangle.Width - 1, ClientRectangle.Bottom);
|
---|
329 | }
|
---|
330 |
|
---|
331 | base.OnPaint(e);
|
---|
332 | }
|
---|
333 |
|
---|
334 | public void RefreshActiveContent() {
|
---|
335 | if (ActiveContent == null)
|
---|
336 | return;
|
---|
337 |
|
---|
338 | if (!DockHelper.IsDockStateAutoHide(ActiveContent.DockHandler.DockState)) {
|
---|
339 | FlagAnimate = false;
|
---|
340 | ActiveContent = null;
|
---|
341 | FlagAnimate = true;
|
---|
342 | }
|
---|
343 | }
|
---|
344 |
|
---|
345 | public void RefreshActivePane() {
|
---|
346 | SetTimerMouseTrack();
|
---|
347 | }
|
---|
348 |
|
---|
349 | private void TimerMouseTrack_Tick(object sender, EventArgs e) {
|
---|
350 | if (IsDisposed)
|
---|
351 | return;
|
---|
352 |
|
---|
353 | if (ActivePane == null || ActivePane.IsActivated) {
|
---|
354 | m_timerMouseTrack.Enabled = false;
|
---|
355 | return;
|
---|
356 | }
|
---|
357 |
|
---|
358 | DockPane pane = ActivePane;
|
---|
359 | Point ptMouseInAutoHideWindow = PointToClient(Control.MousePosition);
|
---|
360 | Point ptMouseInDockPanel = DockPanel.PointToClient(Control.MousePosition);
|
---|
361 |
|
---|
362 | Rectangle rectTabStrip = DockPanel.GetTabStripRectangle(pane.DockState);
|
---|
363 |
|
---|
364 | if (!ClientRectangle.Contains(ptMouseInAutoHideWindow) && !rectTabStrip.Contains(ptMouseInDockPanel)) {
|
---|
365 | ActiveContent = null;
|
---|
366 | m_timerMouseTrack.Enabled = false;
|
---|
367 | }
|
---|
368 | }
|
---|
369 |
|
---|
370 | #region ISplitterDragSource Members
|
---|
371 |
|
---|
372 | void ISplitterDragSource.BeginDrag(Rectangle rectSplitter) {
|
---|
373 | FlagDragging = true;
|
---|
374 | }
|
---|
375 |
|
---|
376 | void ISplitterDragSource.EndDrag() {
|
---|
377 | FlagDragging = false;
|
---|
378 | }
|
---|
379 |
|
---|
380 | bool ISplitterDragSource.IsVertical {
|
---|
381 | get { return (DockState == DockState.DockLeftAutoHide || DockState == DockState.DockRightAutoHide); }
|
---|
382 | }
|
---|
383 |
|
---|
384 | Rectangle ISplitterDragSource.DragLimitBounds {
|
---|
385 | get {
|
---|
386 | Rectangle rectLimit = DockPanel.DockArea;
|
---|
387 |
|
---|
388 | if ((this as ISplitterDragSource).IsVertical) {
|
---|
389 | rectLimit.X += MeasurePane.MinSize;
|
---|
390 | rectLimit.Width -= 2 * MeasurePane.MinSize;
|
---|
391 | } else {
|
---|
392 | rectLimit.Y += MeasurePane.MinSize;
|
---|
393 | rectLimit.Height -= 2 * MeasurePane.MinSize;
|
---|
394 | }
|
---|
395 |
|
---|
396 | return DockPanel.RectangleToScreen(rectLimit);
|
---|
397 | }
|
---|
398 | }
|
---|
399 |
|
---|
400 | void ISplitterDragSource.MoveSplitter(int offset) {
|
---|
401 | Rectangle rectDockArea = DockPanel.DockArea;
|
---|
402 | IDockContent content = ActiveContent;
|
---|
403 | if (DockState == DockState.DockLeftAutoHide && rectDockArea.Width > 0) {
|
---|
404 | if (content.DockHandler.AutoHidePortion < 1)
|
---|
405 | content.DockHandler.AutoHidePortion += ((double)offset) / (double)rectDockArea.Width;
|
---|
406 | else
|
---|
407 | content.DockHandler.AutoHidePortion = Width + offset;
|
---|
408 | } else if (DockState == DockState.DockRightAutoHide && rectDockArea.Width > 0) {
|
---|
409 | if (content.DockHandler.AutoHidePortion < 1)
|
---|
410 | content.DockHandler.AutoHidePortion -= ((double)offset) / (double)rectDockArea.Width;
|
---|
411 | else
|
---|
412 | content.DockHandler.AutoHidePortion = Width - offset;
|
---|
413 | } else if (DockState == DockState.DockBottomAutoHide && rectDockArea.Height > 0) {
|
---|
414 | if (content.DockHandler.AutoHidePortion < 1)
|
---|
415 | content.DockHandler.AutoHidePortion -= ((double)offset) / (double)rectDockArea.Height;
|
---|
416 | else
|
---|
417 | content.DockHandler.AutoHidePortion = Height - offset;
|
---|
418 | } else if (DockState == DockState.DockTopAutoHide && rectDockArea.Height > 0) {
|
---|
419 | if (content.DockHandler.AutoHidePortion < 1)
|
---|
420 | content.DockHandler.AutoHidePortion += ((double)offset) / (double)rectDockArea.Height;
|
---|
421 | else
|
---|
422 | content.DockHandler.AutoHidePortion = Height + offset;
|
---|
423 | }
|
---|
424 | }
|
---|
425 |
|
---|
426 | #region IDragSource Members
|
---|
427 |
|
---|
428 | Control IDragSource.DragControl {
|
---|
429 | get { return this; }
|
---|
430 | }
|
---|
431 |
|
---|
432 | #endregion
|
---|
433 |
|
---|
434 | #endregion
|
---|
435 | }
|
---|
436 |
|
---|
437 | private AutoHideWindowControl AutoHideWindow {
|
---|
438 | get { return m_autoHideWindow; }
|
---|
439 | }
|
---|
440 |
|
---|
441 | internal Control AutoHideControl {
|
---|
442 | get { return m_autoHideWindow; }
|
---|
443 | }
|
---|
444 |
|
---|
445 | internal void RefreshActiveAutoHideContent() {
|
---|
446 | AutoHideWindow.RefreshActiveContent();
|
---|
447 | }
|
---|
448 |
|
---|
449 | internal Rectangle AutoHideWindowRectangle {
|
---|
450 | get {
|
---|
451 | DockState state = AutoHideWindow.DockState;
|
---|
452 | Rectangle rectDockArea = DockArea;
|
---|
453 | if (ActiveAutoHideContent == null)
|
---|
454 | return Rectangle.Empty;
|
---|
455 |
|
---|
456 | if (Parent == null)
|
---|
457 | return Rectangle.Empty;
|
---|
458 |
|
---|
459 | Rectangle rect = Rectangle.Empty;
|
---|
460 | double autoHideSize = ActiveAutoHideContent.DockHandler.AutoHidePortion;
|
---|
461 | if (state == DockState.DockLeftAutoHide) {
|
---|
462 | if (autoHideSize < 1)
|
---|
463 | autoHideSize = rectDockArea.Width * autoHideSize;
|
---|
464 | if (autoHideSize > rectDockArea.Width - MeasurePane.MinSize)
|
---|
465 | autoHideSize = rectDockArea.Width - MeasurePane.MinSize;
|
---|
466 | rect.X = rectDockArea.X;
|
---|
467 | rect.Y = rectDockArea.Y;
|
---|
468 | rect.Width = (int)autoHideSize;
|
---|
469 | rect.Height = rectDockArea.Height;
|
---|
470 | } else if (state == DockState.DockRightAutoHide) {
|
---|
471 | if (autoHideSize < 1)
|
---|
472 | autoHideSize = rectDockArea.Width * autoHideSize;
|
---|
473 | if (autoHideSize > rectDockArea.Width - MeasurePane.MinSize)
|
---|
474 | autoHideSize = rectDockArea.Width - MeasurePane.MinSize;
|
---|
475 | rect.X = rectDockArea.X + rectDockArea.Width - (int)autoHideSize;
|
---|
476 | rect.Y = rectDockArea.Y;
|
---|
477 | rect.Width = (int)autoHideSize;
|
---|
478 | rect.Height = rectDockArea.Height;
|
---|
479 | } else if (state == DockState.DockTopAutoHide) {
|
---|
480 | if (autoHideSize < 1)
|
---|
481 | autoHideSize = rectDockArea.Height * autoHideSize;
|
---|
482 | if (autoHideSize > rectDockArea.Height - MeasurePane.MinSize)
|
---|
483 | autoHideSize = rectDockArea.Height - MeasurePane.MinSize;
|
---|
484 | rect.X = rectDockArea.X;
|
---|
485 | rect.Y = rectDockArea.Y;
|
---|
486 | rect.Width = rectDockArea.Width;
|
---|
487 | rect.Height = (int)autoHideSize;
|
---|
488 | } else if (state == DockState.DockBottomAutoHide) {
|
---|
489 | if (autoHideSize < 1)
|
---|
490 | autoHideSize = rectDockArea.Height * autoHideSize;
|
---|
491 | if (autoHideSize > rectDockArea.Height - MeasurePane.MinSize)
|
---|
492 | autoHideSize = rectDockArea.Height - MeasurePane.MinSize;
|
---|
493 | rect.X = rectDockArea.X;
|
---|
494 | rect.Y = rectDockArea.Y + rectDockArea.Height - (int)autoHideSize;
|
---|
495 | rect.Width = rectDockArea.Width;
|
---|
496 | rect.Height = (int)autoHideSize;
|
---|
497 | }
|
---|
498 |
|
---|
499 | return rect;
|
---|
500 | }
|
---|
501 | }
|
---|
502 |
|
---|
503 | internal Rectangle GetAutoHideWindowBounds(Rectangle rectAutoHideWindow) {
|
---|
504 | if (DocumentStyle == DocumentStyle.SystemMdi ||
|
---|
505 | DocumentStyle == DocumentStyle.DockingMdi)
|
---|
506 | return (Parent == null) ? Rectangle.Empty : Parent.RectangleToClient(RectangleToScreen(rectAutoHideWindow));
|
---|
507 | else
|
---|
508 | return rectAutoHideWindow;
|
---|
509 | }
|
---|
510 |
|
---|
511 | internal void RefreshAutoHideStrip() {
|
---|
512 | AutoHideStripControl.RefreshChanges();
|
---|
513 | }
|
---|
514 |
|
---|
515 | }
|
---|
516 | }
|
---|