Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / TextBoxDesigner.cs / 1 / TextBoxDesigner.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.Design.TextBoxDesigner..ctor()")] namespace System.Windows.Forms.Design { using System; using System.Design; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Windows.Forms.Design.Behavior; using System.Diagnostics; ////// /// internal class TextBoxDesigner : TextBoxBaseDesigner { private DesignerActionListCollection _actionLists; public override DesignerActionListCollection ActionLists { get { if (_actionLists == null) { _actionLists = new DesignerActionListCollection(); _actionLists.Add(new TextBoxActionList(this)); } return _actionLists; } } ////// Provides a designer for TextBox. ////// Allows a designer to filter the set of properties /// the component it is designing will expose through the /// TypeDescriptor object. This method is called /// immediately before its corresponding "Post" method. /// If you are overriding this method you should call /// the base implementation before you perform your own /// filtering. /// protected override void PreFilterProperties(IDictionary properties) { base.PreFilterProperties(properties); PropertyDescriptor prop; string[] shadowProps = new string[] { "PasswordChar" }; Attribute[] empty = new Attribute[0]; for (int i = 0; i < shadowProps.Length; i++) { prop = (PropertyDescriptor)properties[shadowProps[i]]; if (prop != null) { properties[shadowProps[i]] = TypeDescriptor.CreateProperty(typeof(TextBoxDesigner), prop, empty); } } } ////// Shadows the PasswordChar. UseSystemPasswordChar overrides PasswordChar so independent on the value /// of PasswordChar it will return the systemp password char. However, the value of PasswordChar is /// cached so if UseSystemPasswordChar is reset at design time the PasswordChar value can be restored. /// So in the case both properties are set, we need to serialize the real PasswordChar value as well. /// /// Note: This code was copied from MaskedTextBoxDesigner, if fixing a bug here it is probable that the /// same bug needs to be fixed there. /// private char PasswordChar { get { TextBox tb = this.Control as TextBox; Debug.Assert(tb != null, "Designed control is not a TextBox."); if (tb.UseSystemPasswordChar) { tb.UseSystemPasswordChar = false; char pwdChar = tb.PasswordChar; tb.UseSystemPasswordChar = true; return pwdChar; } else { return tb.PasswordChar; } } set { TextBox tb = this.Control as TextBox; Debug.Assert(tb != null, "Designed control is not a TextBox."); tb.PasswordChar = value; } } } internal class TextBoxActionList : DesignerActionList { public TextBoxActionList(TextBoxDesigner designer) : base(designer.Component) { } public bool Multiline { get { return ((TextBox)Component).Multiline; } set { TypeDescriptor.GetProperties(Component)["Multiline"].SetValue(Component, value); } } public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionItemCollection items = new DesignerActionItemCollection(); items.Add(new DesignerActionPropertyItem("Multiline", SR.GetString(SR.MultiLineDisplayName), SR.GetString(SR.PropertiesCategoryName), SR.GetString(SR.MultiLineDescription))); return items; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GPRECT.cs
- WindowsGrip.cs
- ItemCheckEvent.cs
- StringValueSerializer.cs
- BitmapDecoder.cs
- CSharpCodeProvider.cs
- FormsAuthenticationEventArgs.cs
- RangeValueProviderWrapper.cs
- JsonObjectDataContract.cs
- EventLogger.cs
- CodeBlockBuilder.cs
- EncodingDataItem.cs
- TextWriterEngine.cs
- Attributes.cs
- ClusterRegistryConfigurationProvider.cs
- IxmlLineInfo.cs
- Deflater.cs
- TableAutomationPeer.cs
- Configuration.cs
- AssemblyGen.cs
- tooltip.cs
- FixedSOMPageConstructor.cs
- XmlSchemaSet.cs
- TrackPoint.cs
- DnsPermission.cs
- CompositeFontInfo.cs
- ObjectSecurity.cs
- DependencyPropertyKey.cs
- RTLAwareMessageBox.cs
- SkipQueryOptionExpression.cs
- ServiceModelConfigurationSectionCollection.cs
- StaticFileHandler.cs
- Sentence.cs
- SamlAuthenticationStatement.cs
- AddDataControlFieldDialog.cs
- XmlCompatibilityReader.cs
- ColorAnimation.cs
- WebPartTracker.cs
- Html32TextWriter.cs
- CopyAttributesAction.cs
- RtfNavigator.cs
- UnmanagedBitmapWrapper.cs
- XmlBoundElement.cs
- PropertyPathConverter.cs
- DbCommandTree.cs
- JapaneseCalendar.cs
- RootBrowserWindowAutomationPeer.cs
- TextChangedEventArgs.cs
- TrueReadOnlyCollection.cs
- hresults.cs
- SqlDataSourceView.cs
- ComboBox.cs
- CompilationUtil.cs
- DataGridViewDataConnection.cs
- ProjectionPlan.cs
- PriorityRange.cs
- CorrelationManager.cs
- GradientSpreadMethodValidation.cs
- NativeMethods.cs
- UnsafeNativeMethods.cs
- XmlSchemaAttribute.cs
- MULTI_QI.cs
- OutputCacheSettingsSection.cs
- WebPartDeleteVerb.cs
- Baml2006KnownTypes.cs
- UnauthorizedWebPart.cs
- SkipQueryOptionExpression.cs
- WinFormsSpinner.cs
- InterleavedZipPartStream.cs
- EntitySqlQueryBuilder.cs
- RuleSetDialog.cs
- OletxCommittableTransaction.cs
- SiteMapNodeItem.cs
- SchemaElementLookUpTableEnumerator.cs
- EventItfInfo.cs
- InputProcessorProfilesLoader.cs
- SmtpDigestAuthenticationModule.cs
- NameService.cs
- IndexedGlyphRun.cs
- BoolExpressionVisitors.cs
- DayRenderEvent.cs
- DeflateEmulationStream.cs
- SQlBooleanStorage.cs
- BuiltInExpr.cs
- DSASignatureDeformatter.cs
- ToolStripOverflow.cs
- InkSerializer.cs
- UnsafeNativeMethods.cs
- EventWaitHandleSecurity.cs
- TypedReference.cs
- safex509handles.cs
- MarkupExtensionReturnTypeAttribute.cs
- Compiler.cs
- EffectiveValueEntry.cs
- IApplicationTrustManager.cs
- UrlRoutingModule.cs
- HScrollBar.cs
- InputLanguageCollection.cs
- UriTemplateMatch.cs
- CategoryEditor.cs