202 |
|
|
203 |
|
protected override void OnPaint(PaintEventArgs e) |
204 |
|
{ |
205 |
< |
Graphics g = e.Graphics; |
205 |
> |
try |
206 |
> |
{ |
207 |
> |
Graphics g = e.Graphics; |
208 |
|
|
209 |
< |
Color startColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.StartColor; |
210 |
< |
Color endColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.EndColor; |
211 |
< |
LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.LinearGradientMode; |
212 |
< |
using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode)) |
209 |
> |
Color startColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.StartColor; |
210 |
> |
Color endColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.EndColor; |
211 |
> |
LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.LinearGradientMode; |
212 |
> |
using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, startColor, endColor, gradientMode)) |
213 |
> |
{ |
214 |
> |
g.FillRectangle(brush, ClientRectangle); |
215 |
> |
} |
216 |
> |
|
217 |
> |
DrawTabStrip(g); |
218 |
> |
} |
219 |
> |
catch (Exception) |
220 |
|
{ |
221 |
< |
g.FillRectangle(brush, ClientRectangle); |
221 |
> |
throw; |
222 |
|
} |
214 |
– |
|
215 |
– |
DrawTabStrip(g); |
223 |
|
} |
224 |
|
|
225 |
|
protected override void OnLayout(LayoutEventArgs levent) |
238 |
|
|
239 |
|
private void DrawTabStrip(Graphics g, DockState dockState) |
240 |
|
{ |
241 |
< |
Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); |
241 |
> |
try |
242 |
> |
{ |
243 |
> |
Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); |
244 |
|
|
245 |
< |
if (rectTabStrip.IsEmpty) |
246 |
< |
return; |
245 |
> |
if (rectTabStrip.IsEmpty) |
246 |
> |
return; |
247 |
|
|
248 |
< |
Matrix matrixIdentity = g.Transform; |
249 |
< |
if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) |
250 |
< |
{ |
251 |
< |
Matrix matrixRotated = new Matrix(); |
252 |
< |
matrixRotated.RotateAt(90, new PointF((float)rectTabStrip.X + (float)rectTabStrip.Height / 2, |
253 |
< |
(float)rectTabStrip.Y + (float)rectTabStrip.Height / 2)); |
254 |
< |
g.Transform = matrixRotated; |
255 |
< |
} |
248 |
> |
Matrix matrixIdentity = g.Transform; |
249 |
> |
if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) |
250 |
> |
{ |
251 |
> |
Matrix matrixRotated = new Matrix(); |
252 |
> |
matrixRotated.RotateAt(90, new PointF((float)rectTabStrip.X + (float)rectTabStrip.Height / 2, |
253 |
> |
(float)rectTabStrip.Y + (float)rectTabStrip.Height / 2)); |
254 |
> |
g.Transform = matrixRotated; |
255 |
> |
} |
256 |
|
|
257 |
< |
foreach (Pane pane in GetPanes(dockState)) |
257 |
> |
foreach (Pane pane in GetPanes(dockState)) |
258 |
> |
{ |
259 |
> |
foreach (TabVS2005 tab in pane.AutoHideTabs) |
260 |
> |
DrawTab(g, tab); |
261 |
> |
} |
262 |
> |
g.Transform = matrixIdentity; |
263 |
> |
} |
264 |
> |
catch (Exception) |
265 |
|
{ |
266 |
< |
foreach (TabVS2005 tab in pane.AutoHideTabs) |
251 |
< |
DrawTab(g, tab); |
266 |
> |
throw; |
267 |
|
} |
253 |
– |
g.Transform = matrixIdentity; |
268 |
|
} |
269 |
|
|
270 |
|
private void CalculateTabs() |
277 |
|
|
278 |
|
private void CalculateTabs(DockState dockState) |
279 |
|
{ |
280 |
< |
Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); |
280 |
> |
try |
281 |
> |
{ |
282 |
> |
Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); |
283 |
|
|
284 |
< |
int imageHeight = rectTabStrip.Height - ImageGapTop - ImageGapBottom; |
285 |
< |
int imageWidth = ImageWidth; |
286 |
< |
if (imageHeight > ImageHeight) |
287 |
< |
imageWidth = ImageWidth * (imageHeight / ImageHeight); |
284 |
> |
int imageHeight = rectTabStrip.Height - ImageGapTop - ImageGapBottom; |
285 |
> |
int imageWidth = ImageWidth; |
286 |
> |
if (imageHeight > ImageHeight) |
287 |
> |
imageWidth = ImageWidth * (imageHeight / ImageHeight); |
288 |
|
|
289 |
< |
int x = TabGapLeft + rectTabStrip.X; |
290 |
< |
foreach (Pane pane in GetPanes(dockState)) |
275 |
< |
{ |
276 |
< |
foreach (TabVS2005 tab in pane.AutoHideTabs) |
289 |
> |
int x = TabGapLeft + rectTabStrip.X; |
290 |
> |
foreach (Pane pane in GetPanes(dockState)) |
291 |
|
{ |
292 |
< |
int width = imageWidth + ImageGapLeft + ImageGapRight + |
293 |
< |
TextRenderer.MeasureText(tab.Content.DockHandler.TabText, TextFont).Width + |
294 |
< |
TextGapLeft + TextGapRight; |
295 |
< |
tab.TabX = x; |
296 |
< |
tab.TabWidth = width; |
297 |
< |
x += width; |
298 |
< |
} |
292 |
> |
foreach (TabVS2005 tab in pane.AutoHideTabs) |
293 |
> |
{ |
294 |
> |
int width = imageWidth + ImageGapLeft + ImageGapRight + |
295 |
> |
TextRenderer.MeasureText(tab.Content.DockHandler.TabText, TextFont).Width + |
296 |
> |
TextGapLeft + TextGapRight; |
297 |
> |
tab.TabX = x; |
298 |
> |
tab.TabWidth = width; |
299 |
> |
x += width; |
300 |
> |
} |
301 |
|
|
302 |
< |
x += TabGapBetween; |
302 |
> |
x += TabGapBetween; |
303 |
> |
} |
304 |
> |
} |
305 |
> |
catch (Exception) |
306 |
> |
{ |
307 |
> |
throw; |
308 |
|
} |
309 |
|
} |
310 |
|
|
311 |
|
private Rectangle RtlTransform(Rectangle rect, DockState dockState) |
312 |
|
{ |
313 |
< |
Rectangle rectTransformed; |
314 |
< |
if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) |
315 |
< |
rectTransformed = rect; |
316 |
< |
else |
317 |
< |
rectTransformed = DrawHelper.RtlTransform(this, rect); |
313 |
> |
try |
314 |
> |
{ |
315 |
> |
Rectangle rectTransformed; |
316 |
> |
if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) |
317 |
> |
rectTransformed = rect; |
318 |
> |
else |
319 |
> |
rectTransformed = DrawHelper.RtlTransform(this, rect); |
320 |
|
|
321 |
< |
return rectTransformed; |
321 |
> |
return rectTransformed; |
322 |
> |
} |
323 |
> |
catch (Exception) |
324 |
> |
{ |
325 |
> |
throw; |
326 |
> |
} |
327 |
|
} |
328 |
|
|
329 |
|
private GraphicsPath GetTabOutline(TabVS2005 tab, bool transformed, bool rtlTransform) |
330 |
|
{ |
331 |
< |
DockState dockState = tab.Content.DockHandler.DockState; |
332 |
< |
Rectangle rectTab = GetTabRectangle(tab, transformed); |
333 |
< |
if (rtlTransform) |
334 |
< |
rectTab = RtlTransform(rectTab, dockState); |
335 |
< |
bool upTab = (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockBottomAutoHide); |
336 |
< |
DrawHelper.GetRoundedCornerTab(GraphicsPath, rectTab, upTab); |
331 |
> |
try |
332 |
> |
{ |
333 |
> |
DockState dockState = tab.Content.DockHandler.DockState; |
334 |
> |
Rectangle rectTab = GetTabRectangle(tab, transformed); |
335 |
> |
if (rtlTransform) |
336 |
> |
rectTab = RtlTransform(rectTab, dockState); |
337 |
> |
bool upTab = (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockBottomAutoHide); |
338 |
> |
DrawHelper.GetRoundedCornerTab(GraphicsPath, rectTab, upTab); |
339 |
|
|
340 |
< |
return GraphicsPath; |
340 |
> |
return GraphicsPath; |
341 |
> |
} |
342 |
> |
catch (Exception) |
343 |
> |
{ |
344 |
> |
throw; |
345 |
> |
} |
346 |
|
} |
347 |
|
|
348 |
|
private void DrawTab(Graphics g, TabVS2005 tab) |
349 |
|
{ |
350 |
< |
Rectangle rectTabOrigin = GetTabRectangle(tab); |
351 |
< |
if (rectTabOrigin.IsEmpty) |
352 |
< |
return; |
353 |
< |
|
354 |
< |
DockState dockState = tab.Content.DockHandler.DockState; |
355 |
< |
IDockContent content = tab.Content; |
356 |
< |
|
357 |
< |
GraphicsPath path = GetTabOutline(tab, false, true); |
358 |
< |
|
359 |
< |
Color startColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.StartColor; |
360 |
< |
Color endColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.EndColor; |
361 |
< |
LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.TabGradient.LinearGradientMode; |
362 |
< |
g.FillPath(new LinearGradientBrush(rectTabOrigin, startColor, endColor, gradientMode), path); |
363 |
< |
g.DrawPath(PenTabBorder, path); |
364 |
< |
|
365 |
< |
// Set no rotate for drawing icon and text |
366 |
< |
Matrix matrixRotate = g.Transform; |
367 |
< |
g.Transform = MatrixIdentity; |
368 |
< |
|
369 |
< |
// Draw the icon |
370 |
< |
Rectangle rectImage = rectTabOrigin; |
371 |
< |
rectImage.X += ImageGapLeft; |
372 |
< |
rectImage.Y += ImageGapTop; |
373 |
< |
int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom; |
374 |
< |
int imageWidth = ImageWidth; |
375 |
< |
if (imageHeight > ImageHeight) |
376 |
< |
imageWidth = ImageWidth * (imageHeight / ImageHeight); |
377 |
< |
rectImage.Height = imageHeight; |
378 |
< |
rectImage.Width = imageWidth; |
379 |
< |
rectImage = GetTransformedRectangle(dockState, rectImage); |
380 |
< |
|
381 |
< |
if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) |
382 |
< |
{ |
383 |
< |
// The DockState is DockLeftAutoHide or DockRightAutoHide, so rotate the image 90 degrees to the right. |
384 |
< |
Rectangle rectTransform = RtlTransform(rectImage, dockState); |
385 |
< |
Point[] rotationPoints = |
350 |
> |
try |
351 |
> |
{ |
352 |
> |
Rectangle rectTabOrigin = GetTabRectangle(tab); |
353 |
> |
if (rectTabOrigin.IsEmpty) |
354 |
> |
return; |
355 |
> |
|
356 |
> |
DockState dockState = tab.Content.DockHandler.DockState; |
357 |
> |
IDockContent content = tab.Content; |
358 |
> |
|
359 |
> |
GraphicsPath path = GetTabOutline(tab, false, true); |
360 |
> |
|
361 |
> |
Color startColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.StartColor; |
362 |
> |
Color endColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.EndColor; |
363 |
> |
LinearGradientMode gradientMode = DockPanel.Skin.AutoHideStripSkin.TabGradient.LinearGradientMode; |
364 |
> |
g.FillPath(new LinearGradientBrush(rectTabOrigin, startColor, endColor, gradientMode), path); |
365 |
> |
g.DrawPath(PenTabBorder, path); |
366 |
> |
|
367 |
> |
// Set no rotate for drawing icon and text |
368 |
> |
Matrix matrixRotate = g.Transform; |
369 |
> |
g.Transform = MatrixIdentity; |
370 |
> |
|
371 |
> |
// Draw the icon |
372 |
> |
Rectangle rectImage = rectTabOrigin; |
373 |
> |
rectImage.X += ImageGapLeft; |
374 |
> |
rectImage.Y += ImageGapTop; |
375 |
> |
int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom; |
376 |
> |
int imageWidth = ImageWidth; |
377 |
> |
if (imageHeight > ImageHeight) |
378 |
> |
imageWidth = ImageWidth * (imageHeight / ImageHeight); |
379 |
> |
rectImage.Height = imageHeight; |
380 |
> |
rectImage.Width = imageWidth; |
381 |
> |
rectImage = GetTransformedRectangle(dockState, rectImage); |
382 |
> |
|
383 |
> |
if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) |
384 |
> |
{ |
385 |
> |
// The DockState is DockLeftAutoHide or DockRightAutoHide, so rotate the image 90 degrees to the right. |
386 |
> |
Rectangle rectTransform = RtlTransform(rectImage, dockState); |
387 |
> |
Point[] rotationPoints = |
388 |
|
{ |
389 |
|
new Point(rectTransform.X + rectTransform.Width, rectTransform.Y), |
390 |
|
new Point(rectTransform.X + rectTransform.Width, rectTransform.Y + rectTransform.Height), |
391 |
|
new Point(rectTransform.X, rectTransform.Y) |
392 |
|
}; |
393 |
|
|
394 |
< |
using (Icon rotatedIcon = new Icon(((Form)content).Icon, 16, 16)) |
394 |
> |
using (Icon rotatedIcon = new Icon(((Form)content).Icon, 16, 16)) |
395 |
> |
{ |
396 |
> |
g.DrawImage(rotatedIcon.ToBitmap(), rotationPoints); |
397 |
> |
} |
398 |
> |
} |
399 |
> |
else |
400 |
|
{ |
401 |
< |
g.DrawImage(rotatedIcon.ToBitmap(), rotationPoints); |
401 |
> |
// Draw the icon normally without any rotation. |
402 |
> |
g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState)); |
403 |
|
} |
361 |
– |
} |
362 |
– |
else |
363 |
– |
{ |
364 |
– |
// Draw the icon normally without any rotation. |
365 |
– |
g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState)); |
366 |
– |
} |
404 |
|
|
405 |
< |
// Draw the text |
406 |
< |
Rectangle rectText = rectTabOrigin; |
407 |
< |
rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft; |
408 |
< |
rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft; |
409 |
< |
rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState); |
405 |
> |
// Draw the text |
406 |
> |
Rectangle rectText = rectTabOrigin; |
407 |
> |
rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft; |
408 |
> |
rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft; |
409 |
> |
rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState); |
410 |
|
|
411 |
< |
Color textColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.TextColor; |
411 |
> |
Color textColor = DockPanel.Skin.AutoHideStripSkin.TabGradient.TextColor; |
412 |
|
|
413 |
< |
if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) |
414 |
< |
g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabVertical); |
415 |
< |
else |
416 |
< |
g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabHorizontal); |
413 |
> |
if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) |
414 |
> |
g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabVertical); |
415 |
> |
else |
416 |
> |
g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabHorizontal); |
417 |
|
|
418 |
< |
// Set rotate back |
419 |
< |
g.Transform = matrixRotate; |
418 |
> |
// Set rotate back |
419 |
> |
g.Transform = matrixRotate; |
420 |
> |
} |
421 |
> |
catch (Exception) |
422 |
> |
{ |
423 |
> |
throw; |
424 |
> |
} |
425 |
|
} |
426 |
|
|
427 |
|
private Rectangle GetLogicalTabStripRectangle(DockState dockState) |
431 |
|
|
432 |
|
private Rectangle GetLogicalTabStripRectangle(DockState dockState, bool transformed) |
433 |
|
{ |
434 |
< |
if (!DockHelper.IsDockStateAutoHide(dockState)) |
435 |
< |
return Rectangle.Empty; |
434 |
> |
try |
435 |
> |
{ |
436 |
> |
if (!DockHelper.IsDockStateAutoHide(dockState)) |
437 |
> |
return Rectangle.Empty; |
438 |
|
|
439 |
< |
int leftPanes = GetPanes(DockState.DockLeftAutoHide).Count; |
440 |
< |
int rightPanes = GetPanes(DockState.DockRightAutoHide).Count; |
441 |
< |
int topPanes = GetPanes(DockState.DockTopAutoHide).Count; |
442 |
< |
int bottomPanes = GetPanes(DockState.DockBottomAutoHide).Count; |
439 |
> |
int leftPanes = GetPanes(DockState.DockLeftAutoHide).Count; |
440 |
> |
int rightPanes = GetPanes(DockState.DockRightAutoHide).Count; |
441 |
> |
int topPanes = GetPanes(DockState.DockTopAutoHide).Count; |
442 |
> |
int bottomPanes = GetPanes(DockState.DockBottomAutoHide).Count; |
443 |
|
|
444 |
< |
int x, y, width, height; |
444 |
> |
int x, y, width, height; |
445 |
|
|
446 |
< |
height = MeasureHeight(); |
447 |
< |
if (dockState == DockState.DockLeftAutoHide && leftPanes > 0) |
448 |
< |
{ |
449 |
< |
x = 0; |
450 |
< |
y = (topPanes == 0) ? 0 : height; |
451 |
< |
width = Height - (topPanes == 0 ? 0 : height) - (bottomPanes == 0 ? 0 : height); |
452 |
< |
} |
453 |
< |
else if (dockState == DockState.DockRightAutoHide && rightPanes > 0) |
454 |
< |
{ |
455 |
< |
x = Width - height; |
456 |
< |
if (leftPanes != 0 && x < height) |
457 |
< |
x = height; |
458 |
< |
y = (topPanes == 0) ? 0 : height; |
459 |
< |
width = Height - (topPanes == 0 ? 0 : height) - (bottomPanes == 0 ? 0 : height); |
460 |
< |
} |
461 |
< |
else if (dockState == DockState.DockTopAutoHide && topPanes > 0) |
462 |
< |
{ |
463 |
< |
x = leftPanes == 0 ? 0 : height; |
464 |
< |
y = 0; |
465 |
< |
width = Width - (leftPanes == 0 ? 0 : height) - (rightPanes == 0 ? 0 : height); |
446 |
> |
height = MeasureHeight(); |
447 |
> |
if (dockState == DockState.DockLeftAutoHide && leftPanes > 0) |
448 |
> |
{ |
449 |
> |
x = 0; |
450 |
> |
y = (topPanes == 0) ? 0 : height; |
451 |
> |
width = Height - (topPanes == 0 ? 0 : height) - (bottomPanes == 0 ? 0 : height); |
452 |
> |
} |
453 |
> |
else if (dockState == DockState.DockRightAutoHide && rightPanes > 0) |
454 |
> |
{ |
455 |
> |
x = Width - height; |
456 |
> |
if (leftPanes != 0 && x < height) |
457 |
> |
x = height; |
458 |
> |
y = (topPanes == 0) ? 0 : height; |
459 |
> |
width = Height - (topPanes == 0 ? 0 : height) - (bottomPanes == 0 ? 0 : height); |
460 |
> |
} |
461 |
> |
else if (dockState == DockState.DockTopAutoHide && topPanes > 0) |
462 |
> |
{ |
463 |
> |
x = leftPanes == 0 ? 0 : height; |
464 |
> |
y = 0; |
465 |
> |
width = Width - (leftPanes == 0 ? 0 : height) - (rightPanes == 0 ? 0 : height); |
466 |
> |
} |
467 |
> |
else if (dockState == DockState.DockBottomAutoHide && bottomPanes > 0) |
468 |
> |
{ |
469 |
> |
x = leftPanes == 0 ? 0 : height; |
470 |
> |
y = Height - height; |
471 |
> |
if (topPanes != 0 && y < height) |
472 |
> |
y = height; |
473 |
> |
width = Width - (leftPanes == 0 ? 0 : height) - (rightPanes == 0 ? 0 : height); |
474 |
> |
} |
475 |
> |
else |
476 |
> |
return Rectangle.Empty; |
477 |
> |
|
478 |
> |
if (!transformed) |
479 |
> |
return new Rectangle(x, y, width, height); |
480 |
> |
else |
481 |
> |
return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height)); |
482 |
|
} |
483 |
< |
else if (dockState == DockState.DockBottomAutoHide && bottomPanes > 0) |
483 |
> |
catch (Exception) |
484 |
|
{ |
485 |
< |
x = leftPanes == 0 ? 0 : height; |
426 |
< |
y = Height - height; |
427 |
< |
if (topPanes != 0 && y < height) |
428 |
< |
y = height; |
429 |
< |
width = Width - (leftPanes == 0 ? 0 : height) - (rightPanes == 0 ? 0 : height); |
485 |
> |
throw; |
486 |
|
} |
431 |
– |
else |
432 |
– |
return Rectangle.Empty; |
433 |
– |
|
434 |
– |
if (!transformed) |
435 |
– |
return new Rectangle(x, y, width, height); |
436 |
– |
else |
437 |
– |
return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height)); |
487 |
|
} |
488 |
|
|
489 |
|
private Rectangle GetTabRectangle(TabVS2005 tab) |
493 |
|
|
494 |
|
private Rectangle GetTabRectangle(TabVS2005 tab, bool transformed) |
495 |
|
{ |
496 |
< |
DockState dockState = tab.Content.DockHandler.DockState; |
497 |
< |
Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); |
496 |
> |
try |
497 |
> |
{ |
498 |
> |
DockState dockState = tab.Content.DockHandler.DockState; |
499 |
> |
Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); |
500 |
> |
|
501 |
> |
if (rectTabStrip.IsEmpty) |
502 |
> |
return Rectangle.Empty; |
503 |
|
|
504 |
< |
if (rectTabStrip.IsEmpty) |
505 |
< |
return Rectangle.Empty; |
504 |
> |
int x = tab.TabX; |
505 |
> |
int y = rectTabStrip.Y + |
506 |
> |
(dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide ? |
507 |
> |
0 : TabGapTop); |
508 |
> |
int width = tab.TabWidth; |
509 |
> |
int height = rectTabStrip.Height - TabGapTop; |
510 |
|
|
511 |
< |
int x = tab.TabX; |
512 |
< |
int y = rectTabStrip.Y + |
513 |
< |
(dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide ? |
514 |
< |
0 : TabGapTop); |
515 |
< |
int width = tab.TabWidth; |
516 |
< |
int height = rectTabStrip.Height - TabGapTop; |
517 |
< |
|
518 |
< |
if (!transformed) |
519 |
< |
return new Rectangle(x, y, width, height); |
462 |
< |
else |
463 |
< |
return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height)); |
511 |
> |
if (!transformed) |
512 |
> |
return new Rectangle(x, y, width, height); |
513 |
> |
else |
514 |
> |
return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height)); |
515 |
> |
} |
516 |
> |
catch (Exception) |
517 |
> |
{ |
518 |
> |
throw; |
519 |
> |
} |
520 |
|
} |
521 |
|
|
522 |
|
private Rectangle GetTransformedRectangle(DockState dockState, Rectangle rect) |
523 |
|
{ |
524 |
< |
if (dockState != DockState.DockLeftAutoHide && dockState != DockState.DockRightAutoHide) |
525 |
< |
return rect; |
524 |
> |
try |
525 |
> |
{ |
526 |
> |
if (dockState != DockState.DockLeftAutoHide && dockState != DockState.DockRightAutoHide) |
527 |
> |
return rect; |
528 |
|
|
529 |
< |
PointF[] pts = new PointF[1]; |
530 |
< |
// the center of the rectangle |
531 |
< |
pts[0].X = (float)rect.X + (float)rect.Width / 2; |
532 |
< |
pts[0].Y = (float)rect.Y + (float)rect.Height / 2; |
533 |
< |
Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); |
534 |
< |
Matrix matrix = new Matrix(); |
535 |
< |
matrix.RotateAt(90, new PointF((float)rectTabStrip.X + (float)rectTabStrip.Height / 2, |
536 |
< |
(float)rectTabStrip.Y + (float)rectTabStrip.Height / 2)); |
537 |
< |
matrix.TransformPoints(pts); |
538 |
< |
|
539 |
< |
return new Rectangle((int)(pts[0].X - (float)rect.Height / 2 + .5F), |
540 |
< |
(int)(pts[0].Y - (float)rect.Width / 2 + .5F), |
541 |
< |
rect.Height, rect.Width); |
529 |
> |
PointF[] pts = new PointF[1]; |
530 |
> |
// the center of the rectangle |
531 |
> |
pts[0].X = (float)rect.X + (float)rect.Width / 2; |
532 |
> |
pts[0].Y = (float)rect.Y + (float)rect.Height / 2; |
533 |
> |
Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState); |
534 |
> |
Matrix matrix = new Matrix(); |
535 |
> |
matrix.RotateAt(90, new PointF((float)rectTabStrip.X + (float)rectTabStrip.Height / 2, |
536 |
> |
(float)rectTabStrip.Y + (float)rectTabStrip.Height / 2)); |
537 |
> |
matrix.TransformPoints(pts); |
538 |
> |
|
539 |
> |
return new Rectangle((int)(pts[0].X - (float)rect.Height / 2 + .5F), |
540 |
> |
(int)(pts[0].Y - (float)rect.Width / 2 + .5F), |
541 |
> |
rect.Height, rect.Width); |
542 |
> |
} |
543 |
> |
catch (Exception) |
544 |
> |
{ |
545 |
> |
throw; |
546 |
> |
} |
547 |
|
} |
548 |
|
|
549 |
|
protected override IDockContent HitTest(Point ptMouse) |
550 |
|
{ |
551 |
< |
foreach (DockState state in DockStates) |
551 |
> |
try |
552 |
|
{ |
553 |
< |
Rectangle rectTabStrip = GetLogicalTabStripRectangle(state, true); |
491 |
< |
if (!rectTabStrip.Contains(ptMouse)) |
492 |
< |
continue; |
493 |
< |
|
494 |
< |
foreach (Pane pane in GetPanes(state)) |
553 |
> |
foreach (DockState state in DockStates) |
554 |
|
{ |
555 |
< |
foreach (TabVS2005 tab in pane.AutoHideTabs) |
555 |
> |
Rectangle rectTabStrip = GetLogicalTabStripRectangle(state, true); |
556 |
> |
if (!rectTabStrip.Contains(ptMouse)) |
557 |
> |
continue; |
558 |
> |
|
559 |
> |
foreach (Pane pane in GetPanes(state)) |
560 |
|
{ |
561 |
< |
GraphicsPath path = GetTabOutline(tab, true, true); |
562 |
< |
if (path.IsVisible(ptMouse)) |
563 |
< |
return tab.Content; |
561 |
> |
foreach (TabVS2005 tab in pane.AutoHideTabs) |
562 |
> |
{ |
563 |
> |
GraphicsPath path = GetTabOutline(tab, true, true); |
564 |
> |
if (path.IsVisible(ptMouse)) |
565 |
> |
return tab.Content; |
566 |
> |
} |
567 |
|
} |
568 |
|
} |
503 |
– |
} |
569 |
|
|
570 |
< |
return null; |
570 |
> |
return null; |
571 |
> |
} |
572 |
> |
catch (Exception) |
573 |
> |
{ |
574 |
> |
throw; |
575 |
> |
} |
576 |
|
} |
577 |
|
|
578 |
|
protected internal override int MeasureHeight() |