PropertyGrid.cs 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437
  1. // Permission is hereby granted, free of charge, to any person obtaining
  2. // a copy of this software and associated documentation files (the
  3. // "Software"), to deal in the Software without restriction, including
  4. // without limitation the rights to use, copy, modify, merge, publish,
  5. // distribute, sublicense, and/or sell copies of the Software, and to
  6. // permit persons to whom the Software is furnished to do so, subject to
  7. // the following conditions:
  8. //
  9. // The above copyright notice and this permission notice shall be
  10. // included in all copies or substantial portions of the Software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  16. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  17. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  18. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. //
  20. // Copyright (c) 2004-2008 Novell, Inc.
  21. //
  22. // Authors:
  23. // Jonathan Chambers (jonathan.chambers@ansys.com)
  24. // Ivan N. Zlatev (contact@i-nz.net)
  25. //
  26. // NOT COMPLETE
  27. using System.Collections;
  28. using System.Collections.Generic;
  29. using System.ComponentModel;
  30. using System.Drawing;
  31. using System.Linq;
  32. using System.Reflection;
  33. using System.Windows.Forms.Design;
  34. using System.Windows.Forms.PropertyGridInternal;
  35. using System.Xml.Linq;
  36. namespace System.Windows.Forms
  37. {
  38. public class PropertyGrid : UserControl
  39. {
  40. #region Private Members
  41. private const string UNCATEGORIZED_CATEGORY_LABEL = "Misc";
  42. private AttributeCollection browsable_attributes = null;
  43. private Color line_color;
  44. private PropertySort property_sort;
  45. private PropertyTabCollection property_tabs;
  46. private GridEntry selected_grid_item;
  47. private GridEntry root_grid_item;
  48. private object[] selected_objects;
  49. private Hashtable collapsed_categories;
  50. private PropertyTab properties_tab;
  51. private PropertyTab selected_tab;
  52. private ImageList toolbar_imagelist;
  53. private Image categorized_image;
  54. private Image alphabetical_image;
  55. private PropertyToolBarButton categorized_toolbarbutton;
  56. private PropertyToolBarButton alphabetic_toolbarbutton;
  57. private PropertyToolBarSeparator separator_toolbarbutton;
  58. private bool events_tab_visible;
  59. private PropertyToolBar toolbar;
  60. private PropertyGridView property_grid_view;
  61. private Splitter splitter;
  62. private Panel help_panel;
  63. private Label help_title_label;
  64. private Label help_description_label;
  65. private Color category_fore_color;
  66. #endregion // Private Members
  67. #region Contructors
  68. public PropertyGrid()
  69. {
  70. selected_objects = new object[0];
  71. collapsed_categories = new Hashtable();
  72. property_tabs = new PropertyTabCollection(this);
  73. line_color = Drawing.SystemColors.ControlLight;
  74. category_fore_color = Drawing.SystemColors.ControlText;
  75. property_sort = PropertySort.CategorizedAlphabetical;
  76. property_grid_view = new PropertyGridView(this);
  77. property_grid_view.BackColor = System.Drawing.SystemColors.Window;
  78. property_grid_view.Padding = new Padding(1);
  79. property_grid_view.Dock = DockStyle.Fill;
  80. splitter = new Splitter();
  81. splitter.Dock = DockStyle.Bottom;
  82. splitter.Height = _dpi(3);
  83. help_panel = new Panel();
  84. help_panel.Dock = DockStyle.Bottom;
  85. help_panel.Height = _dpi(50);
  86. help_panel.BackColor = Drawing.SystemColors.Control;
  87. help_title_label = new Label();
  88. help_title_label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
  89. help_title_label.Name = "help_title_label";
  90. help_title_label.Font = new Font(this.Font, Drawing.FontStyle.Bold);
  91. help_title_label.Location = new Drawing.Point(2, 2);
  92. help_title_label.Height = 17;
  93. help_title_label.Width = help_panel.Width - 4;
  94. help_description_label = new Label();
  95. help_description_label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
  96. help_description_label.AutoSize = false;
  97. help_description_label.Font = this.Font;
  98. help_description_label.Location = new Drawing.Point(2, help_title_label.Top + help_title_label.Height);
  99. help_description_label.Width = help_panel.Width - 4;
  100. help_description_label.Height = help_panel.Height - help_description_label.Top - 2;
  101. help_panel.Controls.Add(help_description_label);
  102. help_panel.Controls.Add(help_title_label);
  103. help_panel.Paint += new PaintEventHandler(help_panel_Paint);
  104. toolbar = new PropertyToolBar();
  105. categorized_toolbarbutton = new PropertyToolBarButton();
  106. categorized_toolbarbutton.Pushed = true;
  107. alphabetic_toolbarbutton = new PropertyToolBarButton();
  108. separator_toolbarbutton = new PropertyToolBarSeparator();
  109. categorized_image = ResourceLoader.GetBitmap("categorized.png");
  110. alphabetical_image = ResourceLoader.GetBitmap("alphabetical.png");
  111. toolbar_imagelist = new ImageList();
  112. toolbar_imagelist.ColorDepth = ColorDepth.Depth32Bit;
  113. toolbar_imagelist.ImageSize = new System.Drawing.Size(16, 16);
  114. toolbar.Dock = DockStyle.Top;
  115. toolbar.AutoSize = false;
  116. toolbar.ImageList = toolbar_imagelist;
  117. toolbar.Size = new System.Drawing.Size(256, 27);
  118. toolbar.TabIndex = 0;
  119. toolbar.Items.AddRange(new ToolStripItem[] {categorized_toolbarbutton,
  120. alphabetic_toolbarbutton});
  121. categorized_toolbarbutton.Click += new EventHandler(toolbarbutton_clicked);
  122. alphabetic_toolbarbutton.Click += new EventHandler(toolbarbutton_clicked);
  123. categorized_toolbarbutton.ToolTipText = "Categorized";
  124. alphabetic_toolbarbutton.ToolTipText = "Alphabetic";
  125. properties_tab = CreatePropertyTab(this.DefaultTabType);
  126. selected_tab = properties_tab;
  127. RefreshToolbar(property_tabs);
  128. this.Controls.Add(property_grid_view);// helper);
  129. this.Controls.Add(toolbar);
  130. this.Controls.Add(splitter);
  131. this.Controls.Add(help_panel);
  132. this.Name = "PropertyGrid";
  133. this.Size = new System.Drawing.Size(256, 400);
  134. this.BorderStyle = BorderStyle.FixedSingle;
  135. }
  136. #endregion // Constructors
  137. #region Public Instance Properties
  138. [Browsable(false)]
  139. [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
  140. [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
  141. public AttributeCollection BrowsableAttributes
  142. {
  143. get
  144. {
  145. if (browsable_attributes == null)
  146. {
  147. browsable_attributes = new AttributeCollection(new Attribute[] {
  148. BrowsableAttribute.Yes });
  149. }
  150. return browsable_attributes;
  151. }
  152. set
  153. {
  154. if (browsable_attributes == value)
  155. return;
  156. if (browsable_attributes == null || browsable_attributes.Count == 0)
  157. browsable_attributes = null;
  158. else
  159. browsable_attributes = value;
  160. }
  161. }
  162. public override Color BackColor
  163. {
  164. get
  165. {
  166. return base.BackColor;
  167. }
  168. set
  169. {
  170. base.BackColor = value;
  171. toolbar.BackColor = value;
  172. Refresh();
  173. }
  174. }
  175. [Browsable(false)]
  176. [EditorBrowsable(EditorBrowsableState.Never)]
  177. public override Image BackgroundImage
  178. {
  179. get
  180. {
  181. return base.BackgroundImage;
  182. }
  183. set
  184. {
  185. base.BackgroundImage = value;
  186. }
  187. }
  188. [EditorBrowsable(EditorBrowsableState.Never)]
  189. [Browsable(false)]
  190. public override ImageLayout BackgroundImageLayout
  191. {
  192. get { return base.BackgroundImageLayout; }
  193. set { base.BackgroundImageLayout = value; }
  194. }
  195. [DefaultValue(typeof(Color), "ControlText")]
  196. public Color CategoryForeColor
  197. {
  198. get
  199. {
  200. return category_fore_color;
  201. }
  202. set
  203. {
  204. if (category_fore_color != value)
  205. {
  206. category_fore_color = value;
  207. Invalidate();
  208. }
  209. }
  210. }
  211. [Browsable(false)]
  212. [EditorBrowsable(EditorBrowsableState.Never)]
  213. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  214. public new Control.ControlCollection Controls
  215. {
  216. get
  217. {
  218. return base.Controls;
  219. }
  220. }
  221. [Browsable(false)]
  222. [EditorBrowsable(EditorBrowsableState.Never)]
  223. public override Color ForeColor
  224. {
  225. get
  226. {
  227. return base.ForeColor;
  228. }
  229. set
  230. {
  231. base.ForeColor = value;
  232. }
  233. }
  234. public Color SplitterBackColor
  235. {
  236. get => splitter.BackColor;
  237. set => splitter.BackColor = value;
  238. }
  239. [DefaultValue("Color [Control]")]
  240. public Color HelpBackColor
  241. {
  242. get
  243. {
  244. return help_panel.BackColor;
  245. }
  246. set
  247. {
  248. help_panel.BackColor = value;
  249. splitter.BackColor = value;
  250. }
  251. }
  252. [DefaultValue("Color [ControlText]")]
  253. public Color HelpForeColor
  254. {
  255. get
  256. {
  257. return help_panel.ForeColor;
  258. }
  259. set
  260. {
  261. help_panel.ForeColor = value;
  262. }
  263. }
  264. [DefaultValue(true)]
  265. [Localizable(true)]
  266. public virtual bool HelpVisible
  267. {
  268. get
  269. {
  270. return help_panel.Visible;
  271. }
  272. set
  273. {
  274. splitter.Visible = value;
  275. help_panel.Visible = value;
  276. }
  277. }
  278. [DefaultValue("Color [InactiveBorder]")]
  279. public Color LineColor
  280. {
  281. get
  282. {
  283. return line_color;
  284. }
  285. set
  286. {
  287. if (line_color == value)
  288. {
  289. return;
  290. }
  291. line_color = value;
  292. }
  293. }
  294. [EditorBrowsable(EditorBrowsableState.Never)]
  295. [Browsable(false)]
  296. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  297. public new Padding Padding
  298. {
  299. get { return base.Padding; }
  300. set { base.Padding = value; }
  301. }
  302. [DefaultValue(PropertySort.CategorizedAlphabetical)]
  303. public PropertySort PropertySort
  304. {
  305. get
  306. {
  307. return property_sort;
  308. }
  309. set
  310. {
  311. if (!Enum.IsDefined(typeof(PropertySort), value))
  312. throw new InvalidEnumArgumentException("value", (int)value, typeof(PropertySort));
  313. if (property_sort == value)
  314. return;
  315. // we do not need to update the the grid items and fire
  316. // a PropertySortChanged event when switching between
  317. // Categorized and CateogizedAlphabetical
  318. bool needUpdate = (property_sort & PropertySort.Categorized) == 0 ||
  319. (value & PropertySort.Categorized) == 0;
  320. property_sort = value;
  321. if (needUpdate)
  322. {
  323. UpdateSortLayout(root_grid_item);
  324. // update selection
  325. if (selected_grid_item != null)
  326. {
  327. if (selected_grid_item.GridItemType == GridItemType.Category &&
  328. (value == PropertySort.Alphabetical || value == PropertySort.NoSort))
  329. SelectItemCore(null, null);
  330. else
  331. SelectItemCore(null, selected_grid_item);
  332. }
  333. property_grid_view.UpdateView();
  334. OnPropertySortChanged(EventArgs.Empty);
  335. }
  336. UpdatePropertySortButtonsState();
  337. }
  338. }
  339. [Browsable(false)]
  340. [EditorBrowsable(EditorBrowsableState.Advanced)]
  341. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  342. public PropertyTabCollection PropertyTabs
  343. {
  344. get { return property_tabs; }
  345. }
  346. [Browsable(false)]
  347. [EditorBrowsable(EditorBrowsableState.Advanced)]
  348. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  349. public GridItem SelectedGridItem
  350. {
  351. get { return selected_grid_item; }
  352. set
  353. {
  354. if (value == null)
  355. throw new ArgumentException("GridItem specified to PropertyGrid.SelectedGridItem must be a valid GridItem.");
  356. if (value != selected_grid_item)
  357. {
  358. GridEntry oldItem = selected_grid_item;
  359. SelectItemCore(oldItem, (GridEntry)value);
  360. OnSelectedGridItemChanged(new SelectedGridItemChangedEventArgs(oldItem, value));
  361. }
  362. }
  363. }
  364. internal GridItem RootGridItem
  365. {
  366. get { return root_grid_item; }
  367. }
  368. private void UpdateHelp(GridItem item)
  369. {
  370. if (item == null)
  371. {
  372. help_title_label.Text = string.Empty;
  373. help_description_label.Text = string.Empty;
  374. }
  375. else
  376. {
  377. help_title_label.Text = item.Label;
  378. if (item.PropertyDescriptor != null)
  379. this.help_description_label.Text = item.PropertyDescriptor.Description;
  380. }
  381. }
  382. private void SelectItemCore(GridEntry oldItem, GridEntry item)
  383. {
  384. UpdateHelp(item);
  385. selected_grid_item = item;
  386. property_grid_view.SelectItem(oldItem, item);
  387. }
  388. internal void OnPropertyValueChangedInternal(GridItem item, object property_value)
  389. {
  390. property_grid_view.UpdateView();
  391. OnPropertyValueChanged(new PropertyValueChangedEventArgs(item, property_value));
  392. }
  393. internal void OnExpandItem(GridEntry item)
  394. {
  395. property_grid_view.ExpandItem(item);
  396. OnExpandedItemChanged(EventArgs.Empty);
  397. }
  398. internal void OnCollapseItem(GridEntry item)
  399. {
  400. property_grid_view.CollapseItem(item);
  401. OnExpandedItemChanged(EventArgs.Empty);
  402. }
  403. internal DialogResult ShowError(string text)
  404. {
  405. return this.ShowError(text, MessageBoxButtons.OK);
  406. }
  407. internal DialogResult ShowError(string text, MessageBoxButtons buttons)
  408. {
  409. if (text == null)
  410. throw new ArgumentNullException("text");
  411. return MessageBox.Show(text, "Properties Window", buttons, MessageBoxIcon.Exclamation);
  412. }
  413. public object SelectedObject
  414. {
  415. get
  416. {
  417. if (selected_objects.Length > 0)
  418. return selected_objects[0];
  419. return null;
  420. }
  421. set
  422. {
  423. if (selected_objects != null && selected_objects.Length == 1 && selected_objects[0] == value)
  424. return;
  425. if (value == null)
  426. SelectedObjects = new object[0];
  427. else
  428. SelectedObjects = new object[] { value };
  429. }
  430. }
  431. [Browsable(false)]
  432. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  433. public object[] SelectedObjects
  434. {
  435. get
  436. {
  437. return selected_objects;
  438. }
  439. set
  440. {
  441. var old_item = GetItemPath(selected_grid_item);
  442. GetCollapsedCategories(root_grid_item);
  443. root_grid_item = null;
  444. SelectItemCore(null, null); // unselect current item in the view
  445. if (value != null)
  446. {
  447. for (int i = 0; i < value.Length; i++)
  448. {
  449. if (value[i] == null)
  450. throw new ArgumentException(String.Format("Item {0} in the objs array is null.", i));
  451. }
  452. selected_objects = value;
  453. }
  454. else
  455. {
  456. selected_objects = new object[0];
  457. }
  458. ShowEventsButton(false);
  459. PopulateGrid(selected_objects);
  460. RefreshTabs(PropertyTabScope.Component);
  461. if (root_grid_item != null)
  462. {
  463. CollapseCategories(root_grid_item);
  464. var new_item = FindItem(old_item);
  465. SelectItemCore(null, new_item ?? GetDefaultPropertyItem(root_grid_item, selected_tab));
  466. }
  467. property_grid_view.UpdateView();
  468. OnSelectedObjectsChanged(EventArgs.Empty);
  469. }
  470. }
  471. [Browsable(false)]
  472. [EditorBrowsable(EditorBrowsableState.Advanced)]
  473. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  474. public PropertyTab SelectedTab
  475. {
  476. get { return selected_tab; }
  477. }
  478. [Browsable(false)]
  479. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  480. public override string Text
  481. {
  482. get { return base.Text; }
  483. set { base.Text = value; }
  484. }
  485. [DefaultValue(true)]
  486. public virtual bool ToolbarVisible
  487. {
  488. get { return toolbar.Visible; }
  489. set
  490. {
  491. if (toolbar.Visible == value)
  492. {
  493. return;
  494. }
  495. toolbar.Visible = value;
  496. }
  497. }
  498. protected ToolStripRenderer ToolStripRenderer
  499. {
  500. get
  501. {
  502. if (toolbar != null)
  503. {
  504. return toolbar.Renderer;
  505. }
  506. return null;
  507. }
  508. set
  509. {
  510. if (toolbar != null)
  511. {
  512. toolbar.Renderer = value;
  513. }
  514. }
  515. }
  516. [DefaultValue("Color [Window]")]
  517. public Color ViewBackColor
  518. {
  519. get { return property_grid_view.BackColor; }
  520. set
  521. {
  522. if (property_grid_view.BackColor == value)
  523. {
  524. return;
  525. }
  526. property_grid_view.BackColor = value;
  527. }
  528. }
  529. [DefaultValue("Color [WindowText]")]
  530. public Color ViewForeColor
  531. {
  532. get { return property_grid_view.ForeColor; }
  533. set
  534. {
  535. if (property_grid_view.ForeColor == value)
  536. {
  537. return;
  538. }
  539. property_grid_view.ForeColor = value;
  540. }
  541. }
  542. public bool UseCompatibleTextRendering { get; set; }
  543. public Drawing.Color CommandsActiveLinkColor { get; set; }
  544. public Drawing.Color CommandsDisabledLinkColor { get; set; }
  545. public Drawing.Color CommandsLinkColor { get; set; }
  546. #endregion // Public Instance Properties
  547. #region Protected Instance Properties
  548. [Browsable(false)]
  549. [EditorBrowsable(EditorBrowsableState.Advanced)]
  550. [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
  551. protected virtual Type DefaultTabType
  552. {
  553. get { return typeof(PropertiesTab); }
  554. }
  555. #endregion // Protected Instance Properties
  556. #region Public Instance Methods
  557. protected override void Dispose(bool disposing)
  558. {
  559. base.Dispose(disposing);
  560. }
  561. public void CollapseAllGridItems()
  562. {
  563. GridEntry category = FindCategoryItem(selected_grid_item);
  564. if (category != null)
  565. SelectedGridItem = category;
  566. CollapseItemRecursive(root_grid_item);
  567. property_grid_view.UpdateView();
  568. }
  569. private void CollapseItemRecursive(GridItem item)
  570. {
  571. if (item == null)
  572. return;
  573. foreach (GridItem child in item.GridItems)
  574. {
  575. CollapseItemRecursive(child);
  576. if (child.Expandable)
  577. child.Expanded = false;
  578. }
  579. }
  580. private GridEntry FindCategoryItem(GridEntry entry)
  581. {
  582. if (entry == null || (property_sort != PropertySort.Categorized &&
  583. property_sort != PropertySort.CategorizedAlphabetical))
  584. return null;
  585. if (entry.GridItemType == GridItemType.Category)
  586. return entry;
  587. GridEntry category = null;
  588. GridItem current = entry;
  589. while (category == null)
  590. {
  591. if (current.Parent != null && current.Parent.GridItemType == GridItemType.Category)
  592. category = (GridEntry)current.Parent;
  593. current = current.Parent;
  594. if (current == null)
  595. break;
  596. }
  597. return category;
  598. }
  599. public void ExpandAllGridItems()
  600. {
  601. ExpandItemRecursive(root_grid_item);
  602. property_grid_view.UpdateView();
  603. }
  604. private void ExpandItemRecursive(GridItem item)
  605. {
  606. if (item == null)
  607. return;
  608. foreach (GridItem child in item.GridItems)
  609. {
  610. ExpandItemRecursive(child);
  611. if (child.Expandable)
  612. child.Expanded = true;
  613. }
  614. }
  615. public override void Refresh()
  616. {
  617. base.Refresh();
  618. // force a full reload here
  619. SelectedObjects = SelectedObjects;
  620. }
  621. private void toolbar_Clicked(PropertyToolBarButton button)
  622. {
  623. if (button == null)
  624. return;
  625. if (button == alphabetic_toolbarbutton)
  626. {
  627. this.PropertySort = PropertySort.Alphabetical;
  628. alphabetic_toolbarbutton.Pushed = true;
  629. categorized_toolbarbutton.Pushed = false;
  630. }
  631. else if (button == categorized_toolbarbutton)
  632. {
  633. this.PropertySort = PropertySort.CategorizedAlphabetical;
  634. categorized_toolbarbutton.Pushed = true;
  635. alphabetic_toolbarbutton.Pushed = false;
  636. }
  637. else
  638. {
  639. if (button.Enabled)
  640. SelectPropertyTab(button.PropertyTab);
  641. }
  642. }
  643. private void toolbarbutton_clicked(object o, EventArgs args)
  644. {
  645. toolbar_Clicked(o as PropertyToolBarButton);
  646. }
  647. private void SelectPropertyTab(PropertyTab propertyTab)
  648. {
  649. if (propertyTab != null && selected_tab != propertyTab)
  650. {
  651. foreach (object toolbarItem in toolbar.Items)
  652. {
  653. PropertyToolBarButton button = toolbarItem as PropertyToolBarButton;
  654. if (button != null && button.PropertyTab != null)
  655. {
  656. if (button.PropertyTab == selected_tab)
  657. button.Pushed = false;
  658. else if (button.PropertyTab == propertyTab)
  659. button.Pushed = true;
  660. }
  661. }
  662. selected_tab = propertyTab;
  663. PopulateGrid(selected_objects);
  664. SelectItemCore(null, GetDefaultPropertyItem(root_grid_item, selected_tab));
  665. property_grid_view.UpdateView();
  666. }
  667. }
  668. private void UpdatePropertySortButtonsState()
  669. {
  670. if (property_sort == PropertySort.NoSort)
  671. {
  672. alphabetic_toolbarbutton.Pushed = false;
  673. categorized_toolbarbutton.Pushed = false;
  674. }
  675. else if (property_sort == PropertySort.Alphabetical)
  676. {
  677. alphabetic_toolbarbutton.Pushed = true;
  678. categorized_toolbarbutton.Pushed = false;
  679. }
  680. else if (property_sort == PropertySort.Categorized ||
  681. property_sort == PropertySort.CategorizedAlphabetical)
  682. {
  683. alphabetic_toolbarbutton.Pushed = false;
  684. categorized_toolbarbutton.Pushed = true;
  685. }
  686. }
  687. protected void ShowEventsButton(bool value)
  688. {
  689. value = value && property_tabs.Contains(typeof(EventsTab));
  690. if (events_tab_visible != value)
  691. {
  692. events_tab_visible = value;
  693. RefreshTabs(PropertyTabScope.Component);
  694. }
  695. }
  696. public void RefreshTabs(PropertyTabScope tabScope)
  697. {
  698. property_tabs.Clear(tabScope);
  699. if (selected_objects != null)
  700. {
  701. Type[] tabTypes = null;
  702. PropertyTabScope[] tabScopes = null;
  703. if (events_tab_visible && property_tabs.Contains(typeof(EventsTab)))
  704. property_tabs.InsertTab(0, properties_tab, PropertyTabScope.Component);
  705. GetMergedPropertyTabs(selected_objects, out tabTypes, out tabScopes);
  706. if (tabTypes != null && tabScopes != null && tabTypes.Length > 0)
  707. {
  708. bool selectedTabPreserved = false;
  709. for (int i = 0; i < tabTypes.Length; i++)
  710. {
  711. property_tabs.AddTabType(tabTypes[i], tabScopes[i]);
  712. if (tabTypes[i] == selected_tab.GetType())
  713. selectedTabPreserved = true;
  714. }
  715. if (!selectedTabPreserved)
  716. SelectPropertyTab(properties_tab);
  717. }
  718. }
  719. else
  720. {
  721. SelectPropertyTab(properties_tab);
  722. }
  723. //RefreshToolbar(property_tabs);
  724. }
  725. private void RefreshToolbar(PropertyTabCollection tabs)
  726. {
  727. EnsurePropertiesTab();
  728. toolbar.SuspendLayout();
  729. toolbar.Items.Clear();
  730. toolbar_imagelist.Images.Clear();
  731. int imageIndex = 0;
  732. toolbar.Items.Add(categorized_toolbarbutton);
  733. toolbar_imagelist.Images.Add(categorized_image);
  734. categorized_toolbarbutton.ImageIndex = imageIndex;
  735. imageIndex++;
  736. toolbar.Items.Add(alphabetic_toolbarbutton);
  737. toolbar_imagelist.Images.Add(alphabetical_image);
  738. alphabetic_toolbarbutton.ImageIndex = imageIndex;
  739. imageIndex++;
  740. toolbar.Items.Add(separator_toolbarbutton);
  741. if (tabs != null && tabs.Count > 0)
  742. {
  743. foreach (PropertyTab tab in tabs)
  744. {
  745. PropertyToolBarButton button = new PropertyToolBarButton(tab);
  746. button.ToolTipText = tab.TabName;
  747. button.Click += new EventHandler(toolbarbutton_clicked);
  748. toolbar.Items.Add(button);
  749. if (tab.Bitmap != null)
  750. {
  751. tab.Bitmap.MakeTransparent();
  752. toolbar_imagelist.Images.Add(tab.Bitmap);
  753. button.ImageIndex = imageIndex;
  754. imageIndex++;
  755. }
  756. if (tab == selected_tab)
  757. button.Pushed = true;
  758. }
  759. toolbar.Items.Add(new PropertyToolBarSeparator());
  760. }
  761. toolbar.ResumeLayout();
  762. }
  763. private void EnsurePropertiesTab()
  764. {
  765. if (property_tabs == null)
  766. return;
  767. if (property_tabs.Count > 0 && !property_tabs.Contains(this.DefaultTabType))
  768. property_tabs.InsertTab(0, properties_tab, PropertyTabScope.Component);
  769. }
  770. private void GetMergedPropertyTabs(object[] objects, out Type[] tabTypes, out PropertyTabScope[] tabScopes)
  771. {
  772. tabTypes = null;
  773. tabScopes = null;
  774. if (objects == null || objects.Length == 0)
  775. return;
  776. ArrayList intersection = null;
  777. ArrayList scopes = new ArrayList();
  778. for (int i = 0; i < objects.Length; i++)
  779. {
  780. if (objects[i] == null)
  781. continue;
  782. PropertyTabAttribute tabAttribute = (PropertyTabAttribute)TypeDescriptor.GetAttributes(objects[i])[typeof(PropertyTabAttribute)];
  783. if (tabAttribute == null || tabAttribute.TabClasses == null || tabAttribute.TabClasses.Length == 0)
  784. return;
  785. ArrayList new_intersection = new ArrayList();
  786. scopes.Clear();
  787. IList currentIntersection = (i == 0 ? (IList)tabAttribute.TabClasses : (IList)intersection);
  788. for (int j = 0; j < currentIntersection.Count; j++)
  789. {
  790. if ((Type)currentIntersection[j] == tabAttribute.TabClasses[j])
  791. {
  792. new_intersection.Add(tabAttribute.TabClasses[j]);
  793. scopes.Add(tabAttribute.TabScopes[j]);
  794. }
  795. }
  796. intersection = new_intersection;
  797. }
  798. tabTypes = new Type[intersection.Count];
  799. intersection.CopyTo(tabTypes);
  800. tabScopes = new PropertyTabScope[tabTypes.Length];
  801. scopes.CopyTo(tabScopes);
  802. }
  803. public void ResetSelectedProperty()
  804. {
  805. if (selected_grid_item == null)
  806. return;
  807. selected_grid_item.ResetValue();
  808. }
  809. #endregion // Public Instance Methods
  810. #region Protected Instance Methods
  811. protected virtual PropertyTab CreatePropertyTab(Type tabType)
  812. {
  813. if (!typeof(PropertyTab).IsAssignableFrom(tabType))
  814. return null;
  815. PropertyTab tab = null;
  816. ConstructorInfo ctor = tabType.GetConstructor(new Type[] { typeof(IServiceProvider) });
  817. if (ctor != null)
  818. tab = (PropertyTab)ctor.Invoke(new object[] { this.Site });
  819. else
  820. tab = (PropertyTab)Activator.CreateInstance(tabType);
  821. return tab;
  822. }
  823. protected override void OnEnabledChanged(EventArgs e)
  824. {
  825. base.OnEnabledChanged(e);
  826. }
  827. protected override void OnFontChanged(EventArgs e)
  828. {
  829. base.OnFontChanged(e);
  830. help_title_label.Font = new Font(this.Font, Drawing.FontStyle.Bold);
  831. help_title_label.Height = help_title_label.Font.Height;
  832. help_description_label.Font = this.Font;
  833. help_description_label.Location = new Drawing.Point(2, help_title_label.Top + help_title_label.Height);
  834. property_grid_view.Font = this.Font;
  835. }
  836. protected override void OnGotFocus(EventArgs e)
  837. {
  838. base.OnGotFocus(e);
  839. }
  840. protected override void OnMouseDown(MouseEventArgs me)
  841. {
  842. base.OnMouseDown(me);
  843. }
  844. protected override void OnMouseMove(MouseEventArgs me)
  845. {
  846. base.OnMouseMove(me);
  847. }
  848. protected override void OnMouseUp(MouseEventArgs me)
  849. {
  850. base.OnMouseUp(me);
  851. }
  852. protected void OnNotifyPropertyValueUIItemsChanged(object sender, EventArgs e)
  853. {
  854. property_grid_view.UpdateView();
  855. }
  856. protected override void OnPaint(PaintEventArgs pevent)
  857. {
  858. pevent.Graphics.FillRectangle(ResPool.GetSolidBrush(BackColor), pevent.ClipRectangle);
  859. base.OnPaint(pevent);
  860. }
  861. protected virtual void OnPropertySortChanged(EventArgs e) => PropertySortChanged?.Invoke(this, e);
  862. protected virtual void OnPropertyTabChanged(PropertyTabChangedEventArgs e) => PropertyTabChanged?.Invoke(this, e);
  863. protected virtual void OnPropertyValueChanged(PropertyValueChangedEventArgs e) => PropertyValueChanged?.Invoke(this, e);
  864. protected virtual void OnSelectedGridItemChanged(SelectedGridItemChangedEventArgs e) => SelectedGridItemChanged?.Invoke(this, e);
  865. protected virtual void OnSelectedObjectsChanged(EventArgs e) => SelectedObjectsChanged?.Invoke(this, e);
  866. protected void OnExpandedItemChanged(EventArgs e) => ExpandedItemChanged?.Invoke(this, e);
  867. #endregion
  868. #region Events
  869. public event EventHandler PropertySortChanged;
  870. public event PropertyTabChangedEventHandler PropertyTabChanged;
  871. public event PropertyValueChangedEventHandler PropertyValueChanged;
  872. public event SelectedGridItemChangedEventHandler SelectedGridItemChanged;
  873. public event EventHandler SelectedObjectsChanged;
  874. internal event EventHandler ExpandedItemChanged;
  875. #endregion
  876. #region PropertyTabCollection Class
  877. public class PropertyTabCollection : ICollection, IEnumerable
  878. {
  879. ArrayList property_tabs;
  880. ArrayList property_tabs_scopes;
  881. PropertyGrid property_grid;
  882. internal PropertyTabCollection(PropertyGrid propertyGrid)
  883. {
  884. property_grid = propertyGrid;
  885. property_tabs = new ArrayList();
  886. property_tabs_scopes = new ArrayList();
  887. }
  888. public PropertyTab this[int index]
  889. {
  890. get { return (PropertyTab)property_tabs[index]; }
  891. }
  892. bool ICollection.IsSynchronized
  893. {
  894. get { return property_tabs.IsSynchronized; }
  895. }
  896. void ICollection.CopyTo(Array dest, int index)
  897. {
  898. property_tabs.CopyTo(dest, index);
  899. }
  900. object ICollection.SyncRoot
  901. {
  902. get { return property_tabs.SyncRoot; }
  903. }
  904. public IEnumerator GetEnumerator()
  905. {
  906. return property_tabs.GetEnumerator();
  907. }
  908. public int Count
  909. {
  910. get { return property_tabs.Count; }
  911. }
  912. public void AddTabType(Type propertyTabType)
  913. {
  914. AddTabType(propertyTabType, PropertyTabScope.Global);
  915. }
  916. public void AddTabType(Type propertyTabType, PropertyTabScope tabScope)
  917. {
  918. if (propertyTabType == null)
  919. throw new ArgumentNullException("propertyTabType");
  920. // Avoid duplicates
  921. if (this.Contains(propertyTabType))
  922. return;
  923. PropertyTab tab = property_grid.CreatePropertyTab(propertyTabType);
  924. if (tab != null)
  925. {
  926. property_tabs.Add(tab);
  927. property_tabs_scopes.Add(tabScope);
  928. }
  929. property_grid.RefreshToolbar(this);
  930. }
  931. internal PropertyTabScope GetTabScope(PropertyTab tab)
  932. {
  933. if (tab == null)
  934. throw new ArgumentNullException("tab");
  935. int index = property_tabs.IndexOf(tab);
  936. if (index != -1)
  937. return (PropertyTabScope)property_tabs_scopes[index];
  938. return PropertyTabScope.Global;
  939. }
  940. internal void InsertTab(int index, PropertyTab propertyTab, PropertyTabScope tabScope)
  941. {
  942. if (propertyTab == null)
  943. throw new ArgumentNullException("propertyTab");
  944. if (!this.Contains(propertyTab.GetType()))
  945. {
  946. property_tabs.Insert(index, propertyTab);
  947. property_tabs_scopes.Insert(index, tabScope);
  948. }
  949. }
  950. internal bool Contains(Type propertyType)
  951. {
  952. if (propertyType == null)
  953. throw new ArgumentNullException("propertyType");
  954. foreach (PropertyTab t in property_tabs)
  955. {
  956. if (t.GetType() == propertyType)
  957. return true;
  958. }
  959. return false;
  960. }
  961. internal PropertyTab this[Type tabType]
  962. {
  963. get
  964. {
  965. foreach (PropertyTab tab in property_tabs)
  966. {
  967. if (tabType == tab.GetType())
  968. return tab;
  969. }
  970. return null;
  971. }
  972. }
  973. public void Clear(PropertyTabScope tabScope)
  974. {
  975. ArrayList toRemove = new ArrayList();
  976. for (int i = 0; i < property_tabs_scopes.Count; i++)
  977. {
  978. if ((PropertyTabScope)property_tabs_scopes[i] == tabScope)
  979. toRemove.Add(i);
  980. }
  981. foreach (int indexToRemove in toRemove)
  982. {
  983. if (property_tabs.Count > indexToRemove)
  984. property_tabs.RemoveAt(indexToRemove);
  985. if (property_tabs_scopes.Count > indexToRemove)
  986. property_tabs_scopes.RemoveAt(indexToRemove);
  987. }
  988. property_grid.RefreshToolbar(this);
  989. }
  990. public void RemoveTabType(Type propertyTabType)
  991. {
  992. if (propertyTabType == null)
  993. throw new ArgumentNullException("propertyTabType");
  994. ArrayList toRemove = new ArrayList();
  995. for (int i = 0; i < property_tabs.Count; i++)
  996. {
  997. if (property_tabs[i].GetType() == propertyTabType)
  998. toRemove.Add(i);
  999. }
  1000. foreach (int indexToRemove in toRemove)
  1001. {
  1002. property_tabs.RemoveAt(indexToRemove);
  1003. property_tabs_scopes.RemoveAt(indexToRemove);
  1004. }
  1005. property_grid.RefreshToolbar(this);
  1006. }
  1007. }
  1008. #endregion // PropertyTabCollection Class
  1009. #region Private Helper Methods
  1010. private GridItem FindFirstPropertyItem(GridItem root)
  1011. {
  1012. if (root.GridItemType == GridItemType.Property)
  1013. return root;
  1014. foreach (GridItem item in root.GridItems)
  1015. {
  1016. GridItem subitem = FindFirstPropertyItem(item);
  1017. if (subitem != null)
  1018. return subitem;
  1019. }
  1020. return null;
  1021. }
  1022. private GridEntry GetDefaultPropertyItem(GridEntry rootItem, PropertyTab propertyTab)
  1023. {
  1024. if (rootItem == null || rootItem.GridItems.Count == 0 || propertyTab == null)
  1025. return null;
  1026. object[] propertyOwners = rootItem.Values;
  1027. if (propertyOwners == null || propertyOwners.Length == 0 || propertyOwners[0] == null)
  1028. return null;
  1029. GridItem defaultSelected = null;
  1030. if (propertyOwners.Length > 1)
  1031. defaultSelected = rootItem.GridItems[0];
  1032. else
  1033. {
  1034. PropertyDescriptor defaultProperty = propertyTab.GetDefaultProperty(propertyOwners[0]);
  1035. if (defaultProperty != null)
  1036. defaultSelected = FindItem(defaultProperty.Name, rootItem);
  1037. if (defaultSelected == null)
  1038. defaultSelected = FindFirstPropertyItem(rootItem);
  1039. }
  1040. return defaultSelected as GridEntry;
  1041. }
  1042. private GridEntry FindItem(string path)
  1043. {
  1044. string[] names = path.Split(new char[] { '.' });
  1045. GridEntry item = root_grid_item;
  1046. for (int i = 0; i < names.Length; i++)
  1047. {
  1048. item = FindItem(names[i], item);
  1049. if (item == null)
  1050. return null;
  1051. if (i != names.Length - 1 && item.Expandable)
  1052. item.Expanded = true;
  1053. }
  1054. return item;
  1055. }
  1056. private string GetItemPath(GridItem item)
  1057. {
  1058. string path = "";
  1059. while (item != null && item != root_grid_item)
  1060. {
  1061. if (item is not CategoryGridEntry)
  1062. path = item.Label + (path == "" ? "" : "." + path);
  1063. item = item.Parent;
  1064. }
  1065. return path;
  1066. }
  1067. private GridEntry FindItem(string name, GridEntry rootItem)
  1068. {
  1069. if (rootItem == null || name == null)
  1070. return null;
  1071. if (property_sort == PropertySort.Alphabetical || property_sort == PropertySort.NoSort || rootItem != root_grid_item)
  1072. {
  1073. foreach (GridItem item in rootItem.GridItems)
  1074. {
  1075. if (item.Label == name)
  1076. {
  1077. return (GridEntry)item;
  1078. }
  1079. }
  1080. }
  1081. else if (property_sort == PropertySort.Categorized ||
  1082. property_sort == PropertySort.CategorizedAlphabetical)
  1083. {
  1084. foreach (GridItem categoryItem in rootItem.GridItems)
  1085. {
  1086. foreach (GridItem item in categoryItem.GridItems)
  1087. {
  1088. if (item.Label == name)
  1089. {
  1090. return (GridEntry)item;
  1091. }
  1092. }
  1093. }
  1094. }
  1095. return null;
  1096. }
  1097. private void GetCollapsedCategories(GridEntry rootItem)
  1098. {
  1099. if ((property_sort == PropertySort.Categorized || property_sort == PropertySort.CategorizedAlphabetical) && rootItem != null)
  1100. {
  1101. foreach (GridItem categoryItem in rootItem.GridItems)
  1102. {
  1103. if (categoryItem.Expanded)
  1104. collapsed_categories.Remove(categoryItem.Label);
  1105. else
  1106. collapsed_categories[categoryItem.Label] = null;
  1107. }
  1108. }
  1109. }
  1110. private void CollapseCategories(GridEntry rootItem)
  1111. {
  1112. if (property_sort == PropertySort.Categorized || property_sort == PropertySort.CategorizedAlphabetical && rootItem != null)
  1113. {
  1114. foreach (GridItem categoryItem in rootItem.GridItems)
  1115. {
  1116. if (collapsed_categories.Contains(categoryItem.Label))
  1117. categoryItem.Expanded = false;
  1118. }
  1119. }
  1120. }
  1121. private void PopulateGrid(object[] objects)
  1122. {
  1123. if (objects.Length > 0)
  1124. {
  1125. root_grid_item = new RootGridEntry(this, objects);
  1126. root_grid_item.Expanded = true;
  1127. UpdateSortLayout(root_grid_item);
  1128. }
  1129. else
  1130. {
  1131. root_grid_item = null;
  1132. }
  1133. }
  1134. private void UpdateSortLayout(GridEntry rootItem)
  1135. {
  1136. if (rootItem == null)
  1137. return;
  1138. GridItemCollection reordered = new GridItemCollection();
  1139. if (property_sort == PropertySort.Alphabetical || property_sort == PropertySort.NoSort)
  1140. {
  1141. alphabetic_toolbarbutton.Pushed = true;
  1142. categorized_toolbarbutton.Pushed = false;
  1143. foreach (GridItem item in rootItem.GridItems)
  1144. {
  1145. if (item.GridItemType == GridItemType.Category)
  1146. {
  1147. foreach (GridItem categoryChild in item.GridItems)
  1148. {
  1149. reordered.Add(categoryChild);
  1150. ((GridEntry)categoryChild).SetParent(rootItem);
  1151. }
  1152. }
  1153. else
  1154. {
  1155. reordered.Add(item);
  1156. }
  1157. }
  1158. }
  1159. else if (property_sort == PropertySort.Categorized ||
  1160. property_sort == PropertySort.CategorizedAlphabetical)
  1161. {
  1162. alphabetic_toolbarbutton.Pushed = false;
  1163. categorized_toolbarbutton.Pushed = true;
  1164. GridItemCollection categories = new GridItemCollection();
  1165. foreach (GridItem item in rootItem.GridItems)
  1166. {
  1167. if (item.GridItemType == GridItemType.Category)
  1168. {
  1169. categories.Add(item);
  1170. continue;
  1171. }
  1172. string categoryName = item.PropertyDescriptor.Category;
  1173. if (categoryName == null)
  1174. categoryName = UNCATEGORIZED_CATEGORY_LABEL;
  1175. GridItem category_item = rootItem.GridItems[categoryName];
  1176. if (category_item == null || !(category_item is CategoryGridEntry))
  1177. category_item = categories[categoryName];
  1178. if (category_item == null)
  1179. {
  1180. // Create category grid items if they already don't
  1181. category_item = new CategoryGridEntry(this, categoryName, rootItem);
  1182. category_item.Expanded = true;
  1183. categories.Add(category_item);
  1184. }
  1185. category_item.GridItems.Add(item);
  1186. ((GridEntry)item).SetParent(category_item);
  1187. }
  1188. reordered.AddRange(categories);
  1189. }
  1190. rootItem.GridItems.Clear();
  1191. rootItem.GridItems.AddRange(reordered);
  1192. }
  1193. private void help_panel_Paint(object sender, PaintEventArgs e)
  1194. {
  1195. e.Graphics.FillRectangle(ResPool.GetSolidBrush(help_panel.BackColor), help_panel.ClientRectangle);
  1196. if (BorderStyle != BorderStyle.None)
  1197. this.DrawVisualStyleBorder(e.Graphics, new Rectangle(0, 0, help_panel.Width - 1, help_panel.Height - 1));
  1198. }
  1199. #endregion // Private Helper Methods
  1200. #region Internal helper classes
  1201. private class PropertyToolBarSeparator : ToolStripSeparator
  1202. {
  1203. public PropertyToolBarSeparator()
  1204. {
  1205. }
  1206. }
  1207. private class PropertyToolBarButton : ToolStripButton
  1208. {
  1209. private PropertyTab property_tab;
  1210. public PropertyToolBarButton()
  1211. {
  1212. CheckOnClick = true;
  1213. }
  1214. public PropertyToolBarButton(PropertyTab propertyTab) : this()
  1215. {
  1216. if (propertyTab == null)
  1217. throw new ArgumentNullException("propertyTab");
  1218. property_tab = propertyTab;
  1219. }
  1220. public PropertyTab PropertyTab
  1221. {
  1222. get { return property_tab; }
  1223. }
  1224. public bool Pushed
  1225. {
  1226. get { return base.Checked; }
  1227. set { base.Checked = value; }
  1228. }
  1229. }
  1230. internal class PropertyToolBar : ToolStrip
  1231. {
  1232. public PropertyToolBar()
  1233. {
  1234. SetStyle(ControlStyles.ResizeRedraw, true);
  1235. GripStyle = ToolStripGripStyle.Hidden;
  1236. }
  1237. }
  1238. #endregion
  1239. }
  1240. }