Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / TreeViewDesigner.cs / 1 / TreeViewDesigner.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.Design.TreeViewDesigner..ctor()")] namespace System.Windows.Forms.Design { using System.Diagnostics; using System; using System.Design; using System.Drawing; using System.Windows.Forms; using Microsoft.Win32; using System.ComponentModel.Design; using System.ComponentModel; ////// /// This is the designer for tree view controls. It inherits /// from the base control designer and adds live hit testing /// capabilites for the tree view control. /// internal class TreeViewDesigner : ControlDesigner { private NativeMethods.TV_HITTESTINFO tvhit = new NativeMethods.TV_HITTESTINFO(); private DesignerActionListCollection _actionLists; private TreeView treeView = null; public TreeViewDesigner() { AutoResizeHandles = true; } ////// Disposes of this object. /// protected override void Dispose(bool disposing) { if (disposing) { if (treeView != null) { treeView.AfterExpand -= new System.Windows.Forms.TreeViewEventHandler(TreeViewInvalidate); treeView.AfterCollapse -= new System.Windows.Forms.TreeViewEventHandler(TreeViewInvalidate); treeView = null; } } base.Dispose(disposing); } ////// /// protected override bool GetHitTest(Point point) { point = Control.PointToClient(point); tvhit.pt_x = point.X; tvhit.pt_y = point.Y; NativeMethods.SendMessage(Control.Handle, NativeMethods.TVM_HITTEST, 0, tvhit); if (tvhit.flags == NativeMethods.TVHT_ONITEMBUTTON) return true; return false; } public override void Initialize(IComponent component) { base.Initialize(component); treeView = component as TreeView; Debug.Assert(treeView != null, "TreeView is null in TreeViewDesigner"); if (treeView != null) { treeView.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(TreeViewInvalidate); treeView.AfterCollapse += new System.Windows.Forms.TreeViewEventHandler(TreeViewInvalidate); } } private void TreeViewInvalidate(object sender, TreeViewEventArgs e) { if (treeView != null) { treeView.Invalidate(); } } public override DesignerActionListCollection ActionLists { get { if (_actionLists == null) { _actionLists = new DesignerActionListCollection(); _actionLists.Add(new TreeViewActionList(this)); } return _actionLists; } } } internal class TreeViewActionList : DesignerActionList { private TreeViewDesigner _designer; public TreeViewActionList(TreeViewDesigner designer) : base(designer.Component) { _designer = designer; } public void InvokeNodesDialog() { EditorServiceContext.EditValue(_designer, Component, "Nodes"); } public ImageList ImageList { get { return ((TreeView)Component).ImageList; } set { TypeDescriptor.GetProperties(Component)["ImageList"].SetValue(Component, value); } } public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionItemCollection items = new DesignerActionItemCollection(); items.Add(new DesignerActionMethodItem(this, "InvokeNodesDialog", SR.GetString(SR.InvokeNodesDialogDisplayName), SR.GetString(SR.PropertiesCategoryName), SR.GetString(SR.InvokeNodesDialogDescription), true)); items.Add(new DesignerActionPropertyItem("ImageList", SR.GetString(SR.ImageListDisplayName), SR.GetString(SR.PropertiesCategoryName), SR.GetString(SR.ImageListDescription))); return items; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.Allows your component to support a design time user interface. A TabStrip /// control, for example, has a design time user interface that allows the user /// to click the tabs to change tabs. To implement this, TabStrip returns /// true whenever the given point is within its tabs. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XPathSingletonIterator.cs
- QilSortKey.cs
- FileVersionInfo.cs
- RegisteredArrayDeclaration.cs
- Stroke.cs
- AddDataControlFieldDialog.cs
- QilInvokeEarlyBound.cs
- ProfileGroupSettingsCollection.cs
- QuadraticEase.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- HScrollBar.cs
- AddingNewEventArgs.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- ResetableIterator.cs
- WorkflowMarkupElementEventArgs.cs
- ManifestSignedXml.cs
- DataRowCollection.cs
- MasterPageCodeDomTreeGenerator.cs
- CheckBoxList.cs
- CollectionChangeEventArgs.cs
- HttpListener.cs
- WebSysDisplayNameAttribute.cs
- StateManagedCollection.cs
- HwndHost.cs
- ObjectFullSpanRewriter.cs
- ProgressBarBrushConverter.cs
- ThemeInfoAttribute.cs
- PrinterSettings.cs
- StateManagedCollection.cs
- _SpnDictionary.cs
- XamlReaderConstants.cs
- XmlSerializerAssemblyAttribute.cs
- RemoteWebConfigurationHost.cs
- SubclassTypeValidator.cs
- HelpEvent.cs
- ItemCheckEvent.cs
- KnownBoxes.cs
- EpmSourcePathSegment.cs
- ColumnTypeConverter.cs
- FixedFindEngine.cs
- WebEvents.cs
- RuleSetDialog.Designer.cs
- DataTablePropertyDescriptor.cs
- ResourceReader.cs
- ByteAnimationUsingKeyFrames.cs
- LayoutInformation.cs
- AuthenticationConfig.cs
- DbConnectionOptions.cs
- _AutoWebProxyScriptEngine.cs
- HasCopySemanticsAttribute.cs
- ConfigXmlSignificantWhitespace.cs
- DbReferenceCollection.cs
- SingleAnimation.cs
- QueryConverter.cs
- ReadOnlyObservableCollection.cs
- CriticalHandle.cs
- PartitionResolver.cs
- InfoCardArgumentException.cs
- ConsumerConnectionPoint.cs
- EntityProviderFactory.cs
- ModelServiceImpl.cs
- ScrollViewer.cs
- RangeContentEnumerator.cs
- SuppressIldasmAttribute.cs
- RelationshipWrapper.cs
- HtmlTitle.cs
- Update.cs
- DataGridViewColumnCollectionEditor.cs
- SqlBooleanMismatchVisitor.cs
- DrawListViewSubItemEventArgs.cs
- NumericUpDownAccelerationCollection.cs
- Stylesheet.cs
- LazyLoadBehavior.cs
- WebServiceErrorEvent.cs
- XmlKeywords.cs
- TextServicesProperty.cs
- ConfigurationFileMap.cs
- DuplicateWaitObjectException.cs
- RIPEMD160Managed.cs
- ContentDisposition.cs
- EventProviderClassic.cs
- SystemIPGlobalStatistics.cs
- SimplePropertyEntry.cs
- MailSettingsSection.cs
- GeometryHitTestResult.cs
- PlatformNotSupportedException.cs
- BaseParser.cs
- RectAnimationUsingKeyFrames.cs
- RowType.cs
- DataReaderContainer.cs
- ThemeDirectoryCompiler.cs
- ExpressionEditorAttribute.cs
- BitmapEffectGroup.cs
- SplitContainer.cs
- ToolStripItemTextRenderEventArgs.cs
- IndexedString.cs
- SelectedCellsChangedEventArgs.cs
- DriveNotFoundException.cs
- BindingExpressionBase.cs
- FixedTextSelectionProcessor.cs