PageRenderTime 52ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/WabbitStudio/Branches/Wabbitcode/WinFormsUI/Docking/VS2005DockPaneStrip.cs

#
C# | 1526 lines | 1265 code | 213 blank | 48 comment | 193 complexity | dd38ce480155b2f95ad1358b0dfa2ca2 MD5 | raw file
Possible License(s): BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. using System;
  2. using System.Drawing;
  3. using System.Drawing.Drawing2D;
  4. using System.Windows.Forms;
  5. using System.ComponentModel;
  6. namespace WeifenLuo.WinFormsUI.Docking
  7. {
  8. internal class VS2005DockPaneStrip : DockPaneStripBase
  9. {
  10. private class TabVS2005 : Tab
  11. {
  12. public TabVS2005(IDockContent content)
  13. : base(content)
  14. {
  15. }
  16. private int m_tabX;
  17. public int TabX
  18. {
  19. get { return m_tabX; }
  20. set { m_tabX = value; }
  21. }
  22. private int m_tabWidth;
  23. public int TabWidth
  24. {
  25. get { return m_tabWidth; }
  26. set { m_tabWidth = value; }
  27. }
  28. private int m_maxWidth;
  29. public int MaxWidth
  30. {
  31. get { return m_maxWidth; }
  32. set { m_maxWidth = value; }
  33. }
  34. private bool m_flag;
  35. protected internal bool Flag
  36. {
  37. get { return m_flag; }
  38. set { m_flag = value; }
  39. }
  40. }
  41. protected internal override DockPaneStripBase.Tab CreateTab(IDockContent content)
  42. {
  43. return new TabVS2005(content);
  44. }
  45. private sealed class InertButton : InertButtonBase
  46. {
  47. private Bitmap m_image0, m_image1;
  48. public InertButton(Bitmap image0, Bitmap image1)
  49. : base()
  50. {
  51. m_image0 = image0;
  52. m_image1 = image1;
  53. }
  54. private int m_imageCategory = 0;
  55. public int ImageCategory
  56. {
  57. get { return m_imageCategory; }
  58. set
  59. {
  60. if (m_imageCategory == value)
  61. return;
  62. m_imageCategory = value;
  63. Invalidate();
  64. }
  65. }
  66. public override Bitmap Image
  67. {
  68. get { return ImageCategory == 0 ? m_image0 : m_image1; }
  69. }
  70. }
  71. #region Constants
  72. private const int _ToolWindowStripGapTop = 0;
  73. private const int _ToolWindowStripGapBottom = 1;
  74. private const int _ToolWindowStripGapLeft = 0;
  75. private const int _ToolWindowStripGapRight = 0;
  76. private const int _ToolWindowImageHeight = 16;
  77. private const int _ToolWindowImageWidth = 16;
  78. private const int _ToolWindowImageGapTop = 3;
  79. private const int _ToolWindowImageGapBottom = 1;
  80. private const int _ToolWindowImageGapLeft = 2;
  81. private const int _ToolWindowImageGapRight = 0;
  82. private const int _ToolWindowTextGapRight = 3;
  83. private const int _ToolWindowTabSeperatorGapTop = 3;
  84. private const int _ToolWindowTabSeperatorGapBottom = 3;
  85. private const int _DocumentStripGapTop = 0;
  86. private const int _DocumentStripGapBottom = 1;
  87. private const int _DocumentTabMaxWidth = 200;
  88. private const int _DocumentButtonGapTop = 4;
  89. private const int _DocumentButtonGapBottom = 4;
  90. private const int _DocumentButtonGapBetween = 0;
  91. private const int _DocumentButtonGapRight = 3;
  92. private const int _DocumentTabGapTop = 3;
  93. private const int _DocumentTabGapLeft = 3;
  94. private const int _DocumentTabGapRight = 3;
  95. private const int _DocumentIconGapBottom = 2;
  96. private const int _DocumentIconGapLeft = 8;
  97. private const int _DocumentIconGapRight = 0;
  98. private const int _DocumentIconHeight = 16;
  99. private const int _DocumentIconWidth = 16;
  100. private const int _DocumentTextGapRight = 3;
  101. #endregion
  102. #region Members
  103. private ContextMenuStrip m_selectMenu;
  104. private static Bitmap m_imageButtonClose;
  105. private InertButton m_buttonClose;
  106. private static Bitmap m_imageButtonWindowList;
  107. private static Bitmap m_imageButtonWindowListOverflow;
  108. private InertButton m_buttonWindowList;
  109. private IContainer m_components;
  110. private ToolTip m_toolTip;
  111. private Font m_font;
  112. private Font m_boldFont;
  113. private int m_startDisplayingTab = 0;
  114. private int m_endDisplayingTab = 0;
  115. private int m_firstDisplayingTab = 0;
  116. private bool m_documentTabsOverflow = false;
  117. private static string m_toolTipSelect;
  118. private static string m_toolTipClose;
  119. private bool m_closeButtonVisible = false;
  120. private int _selectMenuMargin = 5;
  121. #endregion
  122. #region Properties
  123. private Rectangle TabStripRectangle
  124. {
  125. get
  126. {
  127. if (Appearance == DockPane.AppearanceStyle.Document)
  128. return TabStripRectangle_Document;
  129. else
  130. return TabStripRectangle_ToolWindow;
  131. }
  132. }
  133. private Rectangle TabStripRectangle_ToolWindow
  134. {
  135. get
  136. {
  137. Rectangle rect = ClientRectangle;
  138. return new Rectangle(rect.X, rect.Top + ToolWindowStripGapTop, rect.Width, rect.Height - ToolWindowStripGapTop - ToolWindowStripGapBottom);
  139. }
  140. }
  141. private Rectangle TabStripRectangle_Document
  142. {
  143. get
  144. {
  145. Rectangle rect = ClientRectangle;
  146. return new Rectangle(rect.X, rect.Top + DocumentStripGapTop, rect.Width, rect.Height - DocumentStripGapTop - ToolWindowStripGapBottom);
  147. }
  148. }
  149. private Rectangle TabsRectangle
  150. {
  151. get
  152. {
  153. if (Appearance == DockPane.AppearanceStyle.ToolWindow)
  154. return TabStripRectangle;
  155. Rectangle rectWindow = TabStripRectangle;
  156. int x = rectWindow.X;
  157. int y = rectWindow.Y;
  158. int width = rectWindow.Width;
  159. int height = rectWindow.Height;
  160. x += DocumentTabGapLeft;
  161. width -= DocumentTabGapLeft +
  162. DocumentTabGapRight +
  163. DocumentButtonGapRight +
  164. ButtonClose.Width +
  165. ButtonWindowList.Width +
  166. 2 * DocumentButtonGapBetween;
  167. return new Rectangle(x, y, width, height);
  168. }
  169. }
  170. private ContextMenuStrip SelectMenu
  171. {
  172. get { return m_selectMenu; }
  173. }
  174. public int SelectMenuMargin
  175. {
  176. get { return _selectMenuMargin; }
  177. set { _selectMenuMargin = value; }
  178. }
  179. private static Bitmap ImageButtonClose
  180. {
  181. get
  182. {
  183. if (m_imageButtonClose == null)
  184. m_imageButtonClose = Resources.DockPane_Close;
  185. return m_imageButtonClose;
  186. }
  187. }
  188. private InertButton ButtonClose
  189. {
  190. get
  191. {
  192. if (m_buttonClose == null)
  193. {
  194. m_buttonClose = new InertButton(ImageButtonClose, ImageButtonClose);
  195. m_toolTip.SetToolTip(m_buttonClose, ToolTipClose);
  196. m_buttonClose.Click += new EventHandler(Close_Click);
  197. Controls.Add(m_buttonClose);
  198. }
  199. return m_buttonClose;
  200. }
  201. }
  202. private static Bitmap ImageButtonWindowList
  203. {
  204. get
  205. {
  206. if (m_imageButtonWindowList == null)
  207. m_imageButtonWindowList = Resources.DockPane_Option;
  208. return m_imageButtonWindowList;
  209. }
  210. }
  211. private static Bitmap ImageButtonWindowListOverflow
  212. {
  213. get
  214. {
  215. if (m_imageButtonWindowListOverflow == null)
  216. m_imageButtonWindowListOverflow = Resources.DockPane_OptionOverflow;
  217. return m_imageButtonWindowListOverflow;
  218. }
  219. }
  220. private InertButton ButtonWindowList
  221. {
  222. get
  223. {
  224. if (m_buttonWindowList == null)
  225. {
  226. m_buttonWindowList = new InertButton(ImageButtonWindowList, ImageButtonWindowListOverflow);
  227. m_toolTip.SetToolTip(m_buttonWindowList, ToolTipSelect);
  228. m_buttonWindowList.Click += new EventHandler(WindowList_Click);
  229. Controls.Add(m_buttonWindowList);
  230. }
  231. return m_buttonWindowList;
  232. }
  233. }
  234. private static GraphicsPath GraphicsPath
  235. {
  236. get { return VS2005AutoHideStrip.GraphicsPath; }
  237. }
  238. private IContainer Components
  239. {
  240. get { return m_components; }
  241. }
  242. public Font TextFont
  243. {
  244. get { return DockPane.DockPanel.Skin.DockPaneStripSkin.TextFont; }
  245. }
  246. private Font BoldFont
  247. {
  248. get
  249. {
  250. if (IsDisposed)
  251. return null;
  252. if (m_boldFont == null)
  253. {
  254. m_font = TextFont;
  255. m_boldFont = new Font(TextFont, FontStyle.Bold);
  256. }
  257. else if (m_font != TextFont)
  258. {
  259. m_boldFont.Dispose();
  260. m_font = TextFont;
  261. m_boldFont = new Font(TextFont, FontStyle.Bold);
  262. }
  263. return m_boldFont;
  264. }
  265. }
  266. private int StartDisplayingTab
  267. {
  268. get { return m_startDisplayingTab; }
  269. set
  270. {
  271. m_startDisplayingTab = value;
  272. Invalidate();
  273. }
  274. }
  275. private int EndDisplayingTab
  276. {
  277. get { return m_endDisplayingTab; }
  278. set { m_endDisplayingTab = value; }
  279. }
  280. private int FirstDisplayingTab
  281. {
  282. get { return m_firstDisplayingTab; }
  283. set { m_firstDisplayingTab = value; }
  284. }
  285. private bool DocumentTabsOverflow
  286. {
  287. set
  288. {
  289. if (m_documentTabsOverflow == value)
  290. return;
  291. m_documentTabsOverflow = value;
  292. if (value)
  293. ButtonWindowList.ImageCategory = 1;
  294. else
  295. ButtonWindowList.ImageCategory = 0;
  296. }
  297. }
  298. #region Customizable Properties
  299. private static int ToolWindowStripGapTop
  300. {
  301. get { return _ToolWindowStripGapTop; }
  302. }
  303. private static int ToolWindowStripGapBottom
  304. {
  305. get { return _ToolWindowStripGapBottom; }
  306. }
  307. private static int ToolWindowStripGapLeft
  308. {
  309. get { return _ToolWindowStripGapLeft; }
  310. }
  311. private static int ToolWindowStripGapRight
  312. {
  313. get { return _ToolWindowStripGapRight; }
  314. }
  315. private static int ToolWindowImageHeight
  316. {
  317. get { return _ToolWindowImageHeight; }
  318. }
  319. private static int ToolWindowImageWidth
  320. {
  321. get { return _ToolWindowImageWidth; }
  322. }
  323. private static int ToolWindowImageGapTop
  324. {
  325. get { return _ToolWindowImageGapTop; }
  326. }
  327. private static int ToolWindowImageGapBottom
  328. {
  329. get { return _ToolWindowImageGapBottom; }
  330. }
  331. private static int ToolWindowImageGapLeft
  332. {
  333. get { return _ToolWindowImageGapLeft; }
  334. }
  335. private static int ToolWindowImageGapRight
  336. {
  337. get { return _ToolWindowImageGapRight; }
  338. }
  339. private static int ToolWindowTextGapRight
  340. {
  341. get { return _ToolWindowTextGapRight; }
  342. }
  343. private static int ToolWindowTabSeperatorGapTop
  344. {
  345. get { return _ToolWindowTabSeperatorGapTop; }
  346. }
  347. private static int ToolWindowTabSeperatorGapBottom
  348. {
  349. get { return _ToolWindowTabSeperatorGapBottom; }
  350. }
  351. private static string ToolTipClose
  352. {
  353. get
  354. {
  355. if (m_toolTipClose == null)
  356. m_toolTipClose = Strings.DockPaneStrip_ToolTipClose;
  357. return m_toolTipClose;
  358. }
  359. }
  360. private static string ToolTipSelect
  361. {
  362. get
  363. {
  364. if (m_toolTipSelect == null)
  365. m_toolTipSelect = Strings.DockPaneStrip_ToolTipWindowList;
  366. return m_toolTipSelect;
  367. }
  368. }
  369. private TextFormatFlags ToolWindowTextFormat
  370. {
  371. get
  372. {
  373. TextFormatFlags textFormat = TextFormatFlags.EndEllipsis |
  374. TextFormatFlags.HorizontalCenter |
  375. TextFormatFlags.SingleLine |
  376. TextFormatFlags.VerticalCenter;
  377. if (RightToLeft == RightToLeft.Yes)
  378. return textFormat | TextFormatFlags.RightToLeft | TextFormatFlags.Right;
  379. else
  380. return textFormat;
  381. }
  382. }
  383. private static int DocumentStripGapTop
  384. {
  385. get { return _DocumentStripGapTop; }
  386. }
  387. private static int DocumentStripGapBottom
  388. {
  389. get { return _DocumentStripGapBottom; }
  390. }
  391. private TextFormatFlags DocumentTextFormat
  392. {
  393. get
  394. {
  395. TextFormatFlags textFormat = TextFormatFlags.EndEllipsis |
  396. TextFormatFlags.SingleLine |
  397. TextFormatFlags.VerticalCenter |
  398. TextFormatFlags.HorizontalCenter;
  399. if (RightToLeft == RightToLeft.Yes)
  400. return textFormat | TextFormatFlags.RightToLeft;
  401. else
  402. return textFormat;
  403. }
  404. }
  405. private static int DocumentTabMaxWidth
  406. {
  407. get { return _DocumentTabMaxWidth; }
  408. }
  409. private static int DocumentButtonGapTop
  410. {
  411. get { return _DocumentButtonGapTop; }
  412. }
  413. private static int DocumentButtonGapBottom
  414. {
  415. get { return _DocumentButtonGapBottom; }
  416. }
  417. private static int DocumentButtonGapBetween
  418. {
  419. get { return _DocumentButtonGapBetween; }
  420. }
  421. private static int DocumentButtonGapRight
  422. {
  423. get { return _DocumentButtonGapRight; }
  424. }
  425. private static int DocumentTabGapTop
  426. {
  427. get { return _DocumentTabGapTop; }
  428. }
  429. private static int DocumentTabGapLeft
  430. {
  431. get { return _DocumentTabGapLeft; }
  432. }
  433. private static int DocumentTabGapRight
  434. {
  435. get { return _DocumentTabGapRight; }
  436. }
  437. private static int DocumentIconGapBottom
  438. {
  439. get { return _DocumentIconGapBottom; }
  440. }
  441. private static int DocumentIconGapLeft
  442. {
  443. get { return _DocumentIconGapLeft; }
  444. }
  445. private static int DocumentIconGapRight
  446. {
  447. get { return _DocumentIconGapRight; }
  448. }
  449. private static int DocumentIconWidth
  450. {
  451. get { return _DocumentIconWidth; }
  452. }
  453. private static int DocumentIconHeight
  454. {
  455. get { return _DocumentIconHeight; }
  456. }
  457. private static int DocumentTextGapRight
  458. {
  459. get { return _DocumentTextGapRight; }
  460. }
  461. private static Pen PenToolWindowTabBorder
  462. {
  463. get { return SystemPens.GrayText; }
  464. }
  465. private static Pen PenDocumentTabActiveBorder
  466. {
  467. get { return SystemPens.ControlDarkDark; }
  468. }
  469. private static Pen PenDocumentTabInactiveBorder
  470. {
  471. get { return SystemPens.GrayText; }
  472. }
  473. #endregion
  474. #endregion
  475. public VS2005DockPaneStrip(DockPane pane)
  476. : base(pane)
  477. {
  478. SetStyle(ControlStyles.ResizeRedraw |
  479. ControlStyles.UserPaint |
  480. ControlStyles.AllPaintingInWmPaint |
  481. ControlStyles.OptimizedDoubleBuffer, true);
  482. SuspendLayout();
  483. m_components = new Container();
  484. m_toolTip = new ToolTip(Components);
  485. m_selectMenu = new ContextMenuStrip(Components);
  486. ResumeLayout();
  487. }
  488. protected override void Dispose(bool disposing)
  489. {
  490. if (disposing)
  491. {
  492. Components.Dispose();
  493. if (m_boldFont != null)
  494. {
  495. m_boldFont.Dispose();
  496. m_boldFont = null;
  497. }
  498. }
  499. base.Dispose(disposing);
  500. }
  501. protected internal override int MeasureHeight()
  502. {
  503. if (Appearance == DockPane.AppearanceStyle.ToolWindow)
  504. return MeasureHeight_ToolWindow();
  505. else
  506. return MeasureHeight_Document();
  507. }
  508. private int MeasureHeight_ToolWindow()
  509. {
  510. if (DockPane.IsAutoHide || Tabs.Count <= 1)
  511. return 0;
  512. int height = Math.Max(TextFont.Height, ToolWindowImageHeight + ToolWindowImageGapTop + ToolWindowImageGapBottom)
  513. + ToolWindowStripGapTop + ToolWindowStripGapBottom;
  514. return height;
  515. }
  516. private int MeasureHeight_Document()
  517. {
  518. int height = Math.Max(TextFont.Height + DocumentTabGapTop,
  519. ButtonClose.Height + DocumentButtonGapTop + DocumentButtonGapBottom)
  520. + DocumentStripGapBottom + DocumentStripGapTop;
  521. return height;
  522. }
  523. protected override void OnPaint(PaintEventArgs e)
  524. {
  525. Rectangle rect = TabsRectangle;
  526. if (Appearance == DockPane.AppearanceStyle.Document)
  527. {
  528. rect.X -= DocumentTabGapLeft;
  529. // Add these values back in so that the DockStrip color is drawn
  530. // beneath the close button and window list button.
  531. rect.Width += DocumentTabGapLeft +
  532. DocumentTabGapRight +
  533. DocumentButtonGapRight +
  534. ButtonClose.Width +
  535. ButtonWindowList.Width;
  536. // It is possible depending on the DockPanel DocumentStyle to have
  537. // a Document without a DockStrip.
  538. if (rect.Width > 0 && rect.Height > 0)
  539. {
  540. Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.StartColor;
  541. Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.EndColor;
  542. LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.DocumentGradient.DockStripGradient.LinearGradientMode;
  543. using (LinearGradientBrush brush = new LinearGradientBrush(rect, startColor, endColor, gradientMode))
  544. {
  545. e.Graphics.FillRectangle(brush, rect);
  546. }
  547. }
  548. }
  549. else
  550. {
  551. Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.StartColor;
  552. Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.EndColor;
  553. LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.DockStripGradient.LinearGradientMode;
  554. using (LinearGradientBrush brush = new LinearGradientBrush(rect, startColor, endColor, gradientMode))
  555. {
  556. e.Graphics.FillRectangle(brush, rect);
  557. }
  558. }
  559. base.OnPaint(e);
  560. CalculateTabs();
  561. if (Appearance == DockPane.AppearanceStyle.Document && DockPane.ActiveContent != null)
  562. {
  563. if (EnsureDocumentTabVisible(DockPane.ActiveContent, false))
  564. CalculateTabs();
  565. }
  566. DrawTabStrip(e.Graphics);
  567. }
  568. protected override void OnRefreshChanges()
  569. {
  570. SetInertButtons();
  571. Invalidate();
  572. }
  573. protected internal override GraphicsPath GetOutline(int index)
  574. {
  575. if (Appearance == DockPane.AppearanceStyle.Document)
  576. return GetOutline_Document(index);
  577. else
  578. return GetOutline_ToolWindow(index);
  579. }
  580. private GraphicsPath GetOutline_Document(int index)
  581. {
  582. Rectangle rectTab = GetTabRectangle(index);
  583. rectTab.X -= rectTab.Height / 2;
  584. rectTab.Intersect(TabsRectangle);
  585. rectTab = RectangleToScreen(DrawHelper.RtlTransform(this, rectTab));
  586. Rectangle rectPaneClient = DockPane.RectangleToScreen(DockPane.ClientRectangle);
  587. GraphicsPath path = new GraphicsPath();
  588. GraphicsPath pathTab = GetTabOutline_Document(Tabs[index], true, true, true);
  589. path.AddPath(pathTab, true);
  590. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  591. {
  592. path.AddLine(rectTab.Right, rectTab.Top, rectPaneClient.Right, rectTab.Top);
  593. path.AddLine(rectPaneClient.Right, rectTab.Top, rectPaneClient.Right, rectPaneClient.Top);
  594. path.AddLine(rectPaneClient.Right, rectPaneClient.Top, rectPaneClient.Left, rectPaneClient.Top);
  595. path.AddLine(rectPaneClient.Left, rectPaneClient.Top, rectPaneClient.Left, rectTab.Top);
  596. path.AddLine(rectPaneClient.Left, rectTab.Top, rectTab.Right, rectTab.Top);
  597. }
  598. else
  599. {
  600. path.AddLine(rectTab.Right, rectTab.Bottom, rectPaneClient.Right, rectTab.Bottom);
  601. path.AddLine(rectPaneClient.Right, rectTab.Bottom, rectPaneClient.Right, rectPaneClient.Bottom);
  602. path.AddLine(rectPaneClient.Right, rectPaneClient.Bottom, rectPaneClient.Left, rectPaneClient.Bottom);
  603. path.AddLine(rectPaneClient.Left, rectPaneClient.Bottom, rectPaneClient.Left, rectTab.Bottom);
  604. path.AddLine(rectPaneClient.Left, rectTab.Bottom, rectTab.Right, rectTab.Bottom);
  605. }
  606. return path;
  607. }
  608. private GraphicsPath GetOutline_ToolWindow(int index)
  609. {
  610. Rectangle rectTab = GetTabRectangle(index);
  611. rectTab.Intersect(TabsRectangle);
  612. rectTab = RectangleToScreen(DrawHelper.RtlTransform(this, rectTab));
  613. Rectangle rectPaneClient = DockPane.RectangleToScreen(DockPane.ClientRectangle);
  614. GraphicsPath path = new GraphicsPath();
  615. GraphicsPath pathTab = GetTabOutline(Tabs[index], true, true);
  616. path.AddPath(pathTab, true);
  617. path.AddLine(rectTab.Left, rectTab.Top, rectPaneClient.Left, rectTab.Top);
  618. path.AddLine(rectPaneClient.Left, rectTab.Top, rectPaneClient.Left, rectPaneClient.Top);
  619. path.AddLine(rectPaneClient.Left, rectPaneClient.Top, rectPaneClient.Right, rectPaneClient.Top);
  620. path.AddLine(rectPaneClient.Right, rectPaneClient.Top, rectPaneClient.Right, rectTab.Top);
  621. path.AddLine(rectPaneClient.Right, rectTab.Top, rectTab.Right, rectTab.Top);
  622. return path;
  623. }
  624. private void CalculateTabs()
  625. {
  626. if (Appearance == DockPane.AppearanceStyle.ToolWindow)
  627. CalculateTabs_ToolWindow();
  628. else
  629. CalculateTabs_Document();
  630. }
  631. private void CalculateTabs_ToolWindow()
  632. {
  633. if (Tabs.Count <= 1 || DockPane.IsAutoHide)
  634. return;
  635. Rectangle rectTabStrip = TabStripRectangle;
  636. // Calculate tab widths
  637. int countTabs = Tabs.Count;
  638. foreach (TabVS2005 tab in Tabs)
  639. {
  640. tab.MaxWidth = GetMaxTabWidth(Tabs.IndexOf(tab));
  641. tab.Flag = false;
  642. }
  643. // Set tab whose max width less than average width
  644. bool anyWidthWithinAverage = true;
  645. int totalWidth = rectTabStrip.Width - ToolWindowStripGapLeft - ToolWindowStripGapRight;
  646. int totalAllocatedWidth = 0;
  647. int averageWidth = totalWidth / countTabs;
  648. int remainedTabs = countTabs;
  649. for (anyWidthWithinAverage = true; anyWidthWithinAverage && remainedTabs > 0; )
  650. {
  651. anyWidthWithinAverage = false;
  652. foreach (TabVS2005 tab in Tabs)
  653. {
  654. if (tab.Flag)
  655. continue;
  656. if (tab.MaxWidth <= averageWidth)
  657. {
  658. tab.Flag = true;
  659. tab.TabWidth = tab.MaxWidth;
  660. totalAllocatedWidth += tab.TabWidth;
  661. anyWidthWithinAverage = true;
  662. remainedTabs--;
  663. }
  664. }
  665. if (remainedTabs != 0)
  666. averageWidth = (totalWidth - totalAllocatedWidth) / remainedTabs;
  667. }
  668. // If any tab width not set yet, set it to the average width
  669. if (remainedTabs > 0)
  670. {
  671. int roundUpWidth = (totalWidth - totalAllocatedWidth) - (averageWidth * remainedTabs);
  672. foreach (TabVS2005 tab in Tabs)
  673. {
  674. if (tab.Flag)
  675. continue;
  676. tab.Flag = true;
  677. if (roundUpWidth > 0)
  678. {
  679. tab.TabWidth = averageWidth + 1;
  680. roundUpWidth--;
  681. }
  682. else
  683. tab.TabWidth = averageWidth;
  684. }
  685. }
  686. // Set the X position of the tabs
  687. int x = rectTabStrip.X + ToolWindowStripGapLeft;
  688. foreach (TabVS2005 tab in Tabs)
  689. {
  690. tab.TabX = x;
  691. x += tab.TabWidth;
  692. }
  693. }
  694. private bool CalculateDocumentTab(Rectangle rectTabStrip, ref int x, int index)
  695. {
  696. bool overflow = false;
  697. TabVS2005 tab = Tabs[index] as TabVS2005;
  698. tab.MaxWidth = GetMaxTabWidth(index);
  699. int width = Math.Min(tab.MaxWidth, DocumentTabMaxWidth);
  700. if (x + width < rectTabStrip.Right || index == StartDisplayingTab)
  701. {
  702. tab.TabX = x;
  703. tab.TabWidth = width;
  704. EndDisplayingTab = index;
  705. }
  706. else
  707. {
  708. tab.TabX = 0;
  709. tab.TabWidth = 0;
  710. overflow = true;
  711. }
  712. x += width;
  713. return overflow;
  714. }
  715. /// <summary>
  716. /// Calculate which tabs are displayed and in what order.
  717. /// </summary>
  718. private void CalculateTabs_Document()
  719. {
  720. if (m_startDisplayingTab >= Tabs.Count)
  721. m_startDisplayingTab = 0;
  722. Rectangle rectTabStrip = TabsRectangle;
  723. int x = rectTabStrip.X + rectTabStrip.Height / 2;
  724. bool overflow = false;
  725. // Originally all new documents that were considered overflow
  726. // (not enough pane strip space to show all tabs) were added to
  727. // the far left (assuming not right to left) and the tabs on the
  728. // right were dropped from view. If StartDisplayingTab is not 0
  729. // then we are dealing with making sure a specific tab is kept in focus.
  730. if (m_startDisplayingTab > 0)
  731. {
  732. int tempX = x;
  733. TabVS2005 tab = Tabs[m_startDisplayingTab] as TabVS2005;
  734. tab.MaxWidth = GetMaxTabWidth(m_startDisplayingTab);
  735. // Add the active tab and tabs to the left
  736. for (int i = StartDisplayingTab; i >= 0; i--)
  737. CalculateDocumentTab(rectTabStrip, ref tempX, i);
  738. // Store which tab is the first one displayed so that it
  739. // will be drawn correctly (without part of the tab cut off)
  740. FirstDisplayingTab = EndDisplayingTab;
  741. tempX = x; // Reset X location because we are starting over
  742. // Start with the first tab displayed - name is a little misleading.
  743. // Loop through each tab and set its location. If there is not enough
  744. // room for all of them overflow will be returned.
  745. for (int i = EndDisplayingTab; i < Tabs.Count; i++)
  746. overflow = CalculateDocumentTab(rectTabStrip, ref tempX, i);
  747. // If not all tabs are shown then we have an overflow.
  748. if (FirstDisplayingTab != 0)
  749. overflow = true;
  750. }
  751. else
  752. {
  753. for (int i = StartDisplayingTab; i < Tabs.Count; i++)
  754. overflow = CalculateDocumentTab(rectTabStrip, ref x, i);
  755. for (int i = 0; i < StartDisplayingTab; i++)
  756. overflow = CalculateDocumentTab(rectTabStrip, ref x, i);
  757. FirstDisplayingTab = StartDisplayingTab;
  758. }
  759. if (!overflow)
  760. {
  761. m_startDisplayingTab = 0;
  762. FirstDisplayingTab = 0;
  763. x = rectTabStrip.X + rectTabStrip.Height / 2;
  764. foreach (TabVS2005 tab in Tabs)
  765. {
  766. tab.TabX = x;
  767. x += tab.TabWidth;
  768. }
  769. }
  770. DocumentTabsOverflow = overflow;
  771. }
  772. protected internal override void EnsureTabVisible(IDockContent content)
  773. {
  774. if (Appearance != DockPane.AppearanceStyle.Document || !Tabs.Contains(content))
  775. return;
  776. CalculateTabs();
  777. EnsureDocumentTabVisible(content, true);
  778. }
  779. private bool EnsureDocumentTabVisible(IDockContent content, bool repaint)
  780. {
  781. int index = Tabs.IndexOf(content);
  782. TabVS2005 tab = Tabs[index] as TabVS2005;
  783. if (tab.TabWidth != 0)
  784. return false;
  785. StartDisplayingTab = index;
  786. if (repaint)
  787. Invalidate();
  788. return true;
  789. }
  790. private int GetMaxTabWidth(int index)
  791. {
  792. if (Appearance == DockPane.AppearanceStyle.ToolWindow)
  793. return GetMaxTabWidth_ToolWindow(index);
  794. else
  795. return GetMaxTabWidth_Document(index);
  796. }
  797. private int GetMaxTabWidth_ToolWindow(int index)
  798. {
  799. IDockContent content = Tabs[index].Content;
  800. Size sizeString = TextRenderer.MeasureText(content.DockHandler.TabText, TextFont);
  801. return ToolWindowImageWidth + sizeString.Width + ToolWindowImageGapLeft
  802. + ToolWindowImageGapRight + ToolWindowTextGapRight;
  803. }
  804. private int GetMaxTabWidth_Document(int index)
  805. {
  806. IDockContent content = Tabs[index].Content;
  807. int height = GetTabRectangle_Document(index).Height;
  808. Size sizeText = TextRenderer.MeasureText(content.DockHandler.TabText, BoldFont, new Size(DocumentTabMaxWidth, height), DocumentTextFormat);
  809. if (DockPane.DockPanel.ShowDocumentIcon)
  810. return sizeText.Width + DocumentIconWidth + DocumentIconGapLeft + DocumentIconGapRight + DocumentTextGapRight;
  811. else
  812. return sizeText.Width + DocumentIconGapLeft + DocumentTextGapRight;
  813. }
  814. private void DrawTabStrip(Graphics g)
  815. {
  816. if (Appearance == DockPane.AppearanceStyle.Document)
  817. DrawTabStrip_Document(g);
  818. else
  819. DrawTabStrip_ToolWindow(g);
  820. }
  821. private void DrawTabStrip_Document(Graphics g)
  822. {
  823. int count = Tabs.Count;
  824. if (count == 0)
  825. return;
  826. Rectangle rectTabStrip = TabStripRectangle;
  827. // Draw the tabs
  828. Rectangle rectTabOnly = TabsRectangle;
  829. Rectangle rectTab = Rectangle.Empty;
  830. TabVS2005 tabActive = null;
  831. g.SetClip(DrawHelper.RtlTransform(this, rectTabOnly));
  832. for (int i = 0; i < count; i++)
  833. {
  834. rectTab = GetTabRectangle(i);
  835. if (Tabs[i].Content == DockPane.ActiveContent)
  836. {
  837. tabActive = Tabs[i] as TabVS2005;
  838. continue;
  839. }
  840. if (rectTab.IntersectsWith(rectTabOnly))
  841. DrawTab(g, Tabs[i] as TabVS2005, rectTab);
  842. }
  843. g.SetClip(rectTabStrip);
  844. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  845. g.DrawLine(PenDocumentTabActiveBorder, rectTabStrip.Left, rectTabStrip.Top + 1,
  846. rectTabStrip.Right, rectTabStrip.Top + 1);
  847. else
  848. g.DrawLine(PenDocumentTabActiveBorder, rectTabStrip.Left, rectTabStrip.Bottom - 1,
  849. rectTabStrip.Right, rectTabStrip.Bottom - 1);
  850. g.SetClip(DrawHelper.RtlTransform(this, rectTabOnly));
  851. if (tabActive != null)
  852. {
  853. rectTab = GetTabRectangle(Tabs.IndexOf(tabActive));
  854. if (rectTab.IntersectsWith(rectTabOnly))
  855. {
  856. rectTab.Intersect(rectTabOnly);
  857. DrawTab(g, tabActive, rectTab);
  858. }
  859. }
  860. }
  861. private void DrawTabStrip_ToolWindow(Graphics g)
  862. {
  863. Rectangle rectTabStrip = TabStripRectangle;
  864. g.DrawLine(PenToolWindowTabBorder, rectTabStrip.Left, rectTabStrip.Top,
  865. rectTabStrip.Right, rectTabStrip.Top);
  866. for (int i = 0; i < Tabs.Count; i++)
  867. DrawTab(g, Tabs[i] as TabVS2005, GetTabRectangle(i));
  868. }
  869. private Rectangle GetTabRectangle(int index)
  870. {
  871. if (Appearance == DockPane.AppearanceStyle.ToolWindow)
  872. return GetTabRectangle_ToolWindow(index);
  873. else
  874. return GetTabRectangle_Document(index);
  875. }
  876. private Rectangle GetTabRectangle_ToolWindow(int index)
  877. {
  878. Rectangle rectTabStrip = TabStripRectangle;
  879. TabVS2005 tab = (TabVS2005)(Tabs[index]);
  880. return new Rectangle(tab.TabX, rectTabStrip.Y, tab.TabWidth, rectTabStrip.Height);
  881. }
  882. private Rectangle GetTabRectangle_Document(int index)
  883. {
  884. Rectangle rectTabStrip = TabStripRectangle;
  885. TabVS2005 tab = (TabVS2005)Tabs[index];
  886. Rectangle rect = new Rectangle();
  887. rect.X = tab.TabX;
  888. rect.Width = tab.TabWidth;
  889. rect.Height = rectTabStrip.Height - DocumentTabGapTop;
  890. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  891. rect.Y = rectTabStrip.Y + DocumentStripGapBottom;
  892. else
  893. rect.Y = rectTabStrip.Y + DocumentTabGapTop;
  894. return rect;
  895. }
  896. private void DrawTab(Graphics g, TabVS2005 tab, Rectangle rect)
  897. {
  898. if (Appearance == DockPane.AppearanceStyle.ToolWindow)
  899. DrawTab_ToolWindow(g, tab, rect);
  900. else
  901. DrawTab_Document(g, tab, rect);
  902. }
  903. private GraphicsPath GetTabOutline(Tab tab, bool rtlTransform, bool toScreen)
  904. {
  905. if (Appearance == DockPane.AppearanceStyle.ToolWindow)
  906. return GetTabOutline_ToolWindow(tab, rtlTransform, toScreen);
  907. else
  908. return GetTabOutline_Document(tab, rtlTransform, toScreen, false);
  909. }
  910. private GraphicsPath GetTabOutline_ToolWindow(Tab tab, bool rtlTransform, bool toScreen)
  911. {
  912. Rectangle rect = GetTabRectangle(Tabs.IndexOf(tab));
  913. if (rtlTransform)
  914. rect = DrawHelper.RtlTransform(this, rect);
  915. if (toScreen)
  916. rect = RectangleToScreen(rect);
  917. DrawHelper.GetRoundedCornerTab(GraphicsPath, rect, false);
  918. return GraphicsPath;
  919. }
  920. private GraphicsPath GetTabOutline_Document(Tab tab, bool rtlTransform, bool toScreen, bool full)
  921. {
  922. int curveSize = 6;
  923. GraphicsPath.Reset();
  924. Rectangle rect = GetTabRectangle(Tabs.IndexOf(tab));
  925. // Shorten TabOutline so it doesn't get overdrawn by icons next to it
  926. rect.Intersect(TabsRectangle);
  927. rect.Width--;
  928. if (rtlTransform)
  929. rect = DrawHelper.RtlTransform(this, rect);
  930. if (toScreen)
  931. rect = RectangleToScreen(rect);
  932. // Draws the full angle piece for active content (or first tab)
  933. if (tab.Content == DockPane.ActiveContent || full || Tabs.IndexOf(tab) == FirstDisplayingTab)
  934. {
  935. if (RightToLeft == RightToLeft.Yes)
  936. {
  937. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  938. {
  939. // For some reason the next line draws a line that is not hidden like it is when drawing the tab strip on top.
  940. // It is not needed so it has been commented out.
  941. //GraphicsPath.AddLine(rect.Right, rect.Bottom, rect.Right + rect.Height / 2, rect.Bottom);
  942. GraphicsPath.AddLine(rect.Right + rect.Height / 2, rect.Top, rect.Right - rect.Height / 2 + curveSize / 2, rect.Bottom - curveSize / 2);
  943. }
  944. else
  945. {
  946. GraphicsPath.AddLine(rect.Right, rect.Bottom, rect.Right + rect.Height / 2, rect.Bottom);
  947. GraphicsPath.AddLine(rect.Right + rect.Height / 2, rect.Bottom, rect.Right - rect.Height / 2 + curveSize / 2, rect.Top + curveSize / 2);
  948. }
  949. }
  950. else
  951. {
  952. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  953. {
  954. // For some reason the next line draws a line that is not hidden like it is when drawing the tab strip on top.
  955. // It is not needed so it has been commented out.
  956. //GraphicsPath.AddLine(rect.Left, rect.Top, rect.Left - rect.Height / 2, rect.Top);
  957. GraphicsPath.AddLine(rect.Left - rect.Height / 2, rect.Top, rect.Left + rect.Height / 2 - curveSize / 2, rect.Bottom - curveSize / 2);
  958. }
  959. else
  960. {
  961. GraphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left - rect.Height / 2, rect.Bottom);
  962. GraphicsPath.AddLine(rect.Left - rect.Height / 2, rect.Bottom, rect.Left + rect.Height / 2 - curveSize / 2, rect.Top + curveSize / 2);
  963. }
  964. }
  965. }
  966. // Draws the partial angle for non-active content
  967. else
  968. {
  969. if (RightToLeft == RightToLeft.Yes)
  970. {
  971. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  972. {
  973. GraphicsPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Top + rect.Height / 2);
  974. GraphicsPath.AddLine(rect.Right, rect.Top + rect.Height / 2, rect.Right - rect.Height / 2 + curveSize / 2, rect.Bottom - curveSize / 2);
  975. }
  976. else
  977. {
  978. GraphicsPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Bottom - rect.Height / 2);
  979. GraphicsPath.AddLine(rect.Right, rect.Bottom - rect.Height / 2, rect.Right - rect.Height / 2 + curveSize / 2, rect.Top + curveSize / 2);
  980. }
  981. }
  982. else
  983. {
  984. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  985. {
  986. GraphicsPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Top + rect.Height / 2);
  987. GraphicsPath.AddLine(rect.Left, rect.Top + rect.Height / 2, rect.Left + rect.Height / 2 - curveSize / 2, rect.Bottom - curveSize / 2);
  988. }
  989. else
  990. {
  991. GraphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Bottom - rect.Height / 2);
  992. GraphicsPath.AddLine(rect.Left, rect.Bottom - rect.Height / 2, rect.Left + rect.Height / 2 - curveSize / 2, rect.Top + curveSize / 2);
  993. }
  994. }
  995. }
  996. if (RightToLeft == RightToLeft.Yes)
  997. {
  998. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  999. {
  1000. // Draws the bottom horizontal line (short side)
  1001. GraphicsPath.AddLine(rect.Right - rect.Height / 2 - curveSize / 2, rect.Bottom, rect.Left + curveSize / 2, rect.Bottom);
  1002. // Drawing the rounded corner is not necessary. The path is automatically connected
  1003. //GraphicsPath.AddArc(new Rectangle(rect.Left, rect.Top, curveSize, curveSize), 180, 90);
  1004. }
  1005. else
  1006. {
  1007. // Draws the bottom horizontal line (short side)
  1008. GraphicsPath.AddLine(rect.Right - rect.Height / 2 - curveSize / 2, rect.Top, rect.Left + curveSize / 2, rect.Top);
  1009. GraphicsPath.AddArc(new Rectangle(rect.Left, rect.Top, curveSize, curveSize), 180, 90);
  1010. }
  1011. }
  1012. else
  1013. {
  1014. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  1015. {
  1016. // Draws the bottom horizontal line (short side)
  1017. GraphicsPath.AddLine(rect.Left + rect.Height / 2 + curveSize / 2, rect.Bottom, rect.Right - curveSize / 2, rect.Bottom);
  1018. // Drawing the rounded corner is not necessary. The path is automatically connected
  1019. //GraphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Bottom, curveSize, curveSize), 90, -90);
  1020. }
  1021. else
  1022. {
  1023. // Draws the top horizontal line (short side)
  1024. GraphicsPath.AddLine(rect.Left + rect.Height / 2 + curveSize / 2, rect.Top, rect.Right - curveSize / 2, rect.Top);
  1025. // Draws the rounded corner oppposite the angled side
  1026. GraphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Top, curveSize, curveSize), -90, 90);
  1027. }
  1028. }
  1029. if (Tabs.IndexOf(tab) != EndDisplayingTab &&
  1030. (Tabs.IndexOf(tab) != Tabs.Count - 1 && Tabs[Tabs.IndexOf(tab) + 1].Content == DockPane.ActiveContent)
  1031. && !full)
  1032. {
  1033. if (RightToLeft == RightToLeft.Yes)
  1034. {
  1035. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  1036. {
  1037. GraphicsPath.AddLine(rect.Left, rect.Bottom - curveSize / 2, rect.Left, rect.Bottom - rect.Height / 2);
  1038. GraphicsPath.AddLine(rect.Left, rect.Bottom - rect.Height / 2, rect.Left + rect.Height / 2, rect.Top);
  1039. }
  1040. else
  1041. {
  1042. GraphicsPath.AddLine(rect.Left, rect.Top + curveSize / 2, rect.Left, rect.Top + rect.Height / 2);
  1043. GraphicsPath.AddLine(rect.Left, rect.Top + rect.Height / 2, rect.Left + rect.Height / 2, rect.Bottom);
  1044. }
  1045. }
  1046. else
  1047. {
  1048. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  1049. {
  1050. GraphicsPath.AddLine(rect.Right, rect.Bottom - curveSize / 2, rect.Right, rect.Bottom - rect.Height / 2);
  1051. GraphicsPath.AddLine(rect.Right, rect.Bottom - rect.Height / 2, rect.Right - rect.Height / 2, rect.Top);
  1052. }
  1053. else
  1054. {
  1055. GraphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Top + rect.Height / 2);
  1056. GraphicsPath.AddLine(rect.Right, rect.Top + rect.Height / 2, rect.Right - rect.Height / 2, rect.Bottom);
  1057. }
  1058. }
  1059. }
  1060. else
  1061. {
  1062. // Draw the vertical line opposite the angled side
  1063. if (RightToLeft == RightToLeft.Yes)
  1064. {
  1065. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  1066. GraphicsPath.AddLine(rect.Left, rect.Bottom - curveSize / 2, rect.Left, rect.Top);
  1067. else
  1068. GraphicsPath.AddLine(rect.Left, rect.Top + curveSize / 2, rect.Left, rect.Bottom);
  1069. }
  1070. else
  1071. {
  1072. if (DockPane.DockPanel.DocumentTabStripLocation == DocumentTabStripLocation.Bottom)
  1073. GraphicsPath.AddLine(rect.Right, rect.Bottom - curveSize / 2, rect.Right, rect.Top);
  1074. else
  1075. GraphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Bottom);
  1076. }
  1077. }
  1078. return GraphicsPath;
  1079. }
  1080. private void DrawTab_ToolWindow(Graphics g, TabVS2005 tab, Rectangle rect)
  1081. {
  1082. Rectangle rectIcon = new Rectangle(
  1083. rect.X + ToolWindowImageGapLeft,
  1084. rect.Y + rect.Height - 1 - ToolWindowImageGapBottom - ToolWindowImageHeight,
  1085. ToolWindowImageWidth, ToolWindowImageHeight);
  1086. Rectangle rectText = rectIcon;
  1087. rectText.X += rectIcon.Width + ToolWindowImageGapRight;
  1088. rectText.Width = rect.Width - rectIcon.Width - ToolWindowImageGapLeft -
  1089. ToolWindowImageGapRight - ToolWindowTextGapRight;
  1090. Rectangle rectTab = DrawHelper.RtlTransform(this, rect);
  1091. rectText = DrawHelper.RtlTransform(this, rectText);
  1092. rectIcon = DrawHelper.RtlTransform(this, rectIcon);
  1093. GraphicsPath path = GetTabOutline(tab, true, false);
  1094. if (DockPane.ActiveContent == tab.Content)
  1095. {
  1096. Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.StartColor;
  1097. Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.EndColor;
  1098. LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.LinearGradientMode;
  1099. g.FillPath(new LinearGradientBrush(rectTab, startColor, endColor, gradientMode), path);
  1100. g.DrawPath(PenToolWindowTabBorder, path);
  1101. Color textColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.TextColor;
  1102. TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, textColor, ToolWindowTextFormat);
  1103. }
  1104. else
  1105. {
  1106. Color startColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.StartColor;
  1107. Color endColor = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.EndColor;
  1108. LinearGradientMode gradientMode = DockPane.DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.LinearGradientMode;
  1109. g.FillPath(new LinearGradientBrush(rectTab, startColor, endColor, gradientMode), path);
  1110. if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(tab) + 1)
  1111. {
  1112. Point pt1 = new

Large files files are truncated, but you can click here to view the full file