Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / RichTextBoxDesigner.cs / 1 / RichTextBoxDesigner.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.Design.RichTextBoxDesigner..ctor()")]
namespace System.Windows.Forms.Design {
using Microsoft.Win32;
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Design;
using System.Diagnostics;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
///
///
/// The RichTextBoxDesigner provides rich designtime behavior for the
/// RichTextBox control.
///
internal class RichTextBoxDesigner : TextBoxBaseDesigner {
private DesignerActionListCollection _actionLists;
///
/// Called when the designer is intialized. This allows the designer to provide some
/// meaningful default values in the control. The default implementation of this
/// sets the control's text to its name.
///
public override void InitializeNewComponent(IDictionary defaultValues) {
base.InitializeNewComponent(defaultValues);
// Disable DragDrop at design time.
//
Control control = Control;
if (control != null && control.Handle != IntPtr.Zero) {
NativeMethods.RevokeDragDrop(control.Handle);
// DragAcceptFiles(control.Handle, false);
}
}
public override DesignerActionListCollection ActionLists {
get {
if (_actionLists == null) {
_actionLists = new DesignerActionListCollection();
_actionLists.Add(new RichTextBoxActionList(this));
}
return _actionLists;
}
}
///
///
/// 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;
// Handle shadowed properties
//
string[] shadowProps = new string[] {
"Text"
};
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(RichTextBoxDesigner), prop, empty);
}
}
}
///
/// Accessor for Text. We need to replace "\r\n" with "\n" in the designer before deciding whether
/// the old value & new value match.
///
private string Text
{
get
{
return Control.Text;
}
set
{
string oldText = Control.Text;
if (value != null)
{
value = value.Replace("\r\n", "\n");
}
if (oldText != value) {
Control.Text = value;
}
}
}
}
internal class RichTextBoxActionList : DesignerActionList {
private RichTextBoxDesigner _designer;
public RichTextBoxActionList(RichTextBoxDesigner designer) : base(designer.Component) {
_designer = designer;
}
public void EditLines() {
EditorServiceContext.EditValue(_designer, Component, "Lines");
}
public override DesignerActionItemCollection GetSortedActionItems() {
DesignerActionItemCollection items = new DesignerActionItemCollection();
items.Add(new DesignerActionMethodItem(this, "EditLines", SR.GetString(SR.EditLinesDisplayName), SR.GetString(SR.LinksCategoryName), SR.GetString(SR.EditLinesDescription), true));
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
- ExpressionPrefixAttribute.cs
- Underline.cs
- SoapEnvelopeProcessingElement.cs
- TypeDescriptionProvider.cs
- CompilerGeneratedAttribute.cs
- SrgsToken.cs
- MessagePartDescriptionCollection.cs
- EventListener.cs
- SessionIDManager.cs
- ListViewPagedDataSource.cs
- RadioButtonList.cs
- OracleDataReader.cs
- SqlInternalConnectionTds.cs
- TextureBrush.cs
- AnnotationStore.cs
- ToolStripMenuItemCodeDomSerializer.cs
- LocalizedNameDescriptionPair.cs
- PersistenceMetadataNamespace.cs
- DataGridRelationshipRow.cs
- DataSet.cs
- ManifestResourceInfo.cs
- ReadOnlyHierarchicalDataSourceView.cs
- QueryStringParameter.cs
- AbandonedMutexException.cs
- AutoResetEvent.cs
- PageCopyCount.cs
- MruCache.cs
- TemplateGroupCollection.cs
- TaiwanCalendar.cs
- TreeViewImageGenerator.cs
- WindowsStartMenu.cs
- FocusChangedEventArgs.cs
- DoubleAnimationBase.cs
- FormViewInsertedEventArgs.cs
- BadImageFormatException.cs
- _ConnectionGroup.cs
- HostedHttpContext.cs
- InkSerializer.cs
- ApplicationSettingsBase.cs
- ResolvedKeyFrameEntry.cs
- shaperfactory.cs
- ToolStripPanel.cs
- Line.cs
- StringConverter.cs
- WebRequest.cs
- IteratorDescriptor.cs
- Positioning.cs
- ListViewHitTestInfo.cs
- ChangeProcessor.cs
- NullableBoolConverter.cs
- EncodingInfo.cs
- ModelUtilities.cs
- UrlAuthorizationModule.cs
- QuaternionAnimationUsingKeyFrames.cs
- BuildManagerHost.cs
- Style.cs
- XpsInterleavingPolicy.cs
- SmiMetaDataProperty.cs
- FormsAuthenticationConfiguration.cs
- SecureUICommand.cs
- LineSegment.cs
- MissingMemberException.cs
- ImageAnimator.cs
- UserControlFileEditor.cs
- IsolatedStorageFilePermission.cs
- ImageCodecInfo.cs
- AutomationElementIdentifiers.cs
- String.cs
- ResourceManager.cs
- TextTreeDeleteContentUndoUnit.cs
- WpfKnownType.cs
- HttpCookie.cs
- CancelEventArgs.cs
- PerfCounters.cs
- ProtectedConfigurationProviderCollection.cs
- XMLSchema.cs
- HandlerBase.cs
- AdornerLayer.cs
- SqlProvider.cs
- DataControlFieldTypeEditor.cs
- LayoutUtils.cs
- ToolStripPanelSelectionGlyph.cs
- Point.cs
- ViewStateException.cs
- Brush.cs
- BuildProviderAppliesToAttribute.cs
- QilInvoke.cs
- Button.cs
- cookieexception.cs
- WindowManager.cs
- ResourceIDHelper.cs
- ExceptionCollection.cs
- UnaryNode.cs
- BatchParser.cs
- Lease.cs
- ResourceSet.cs
- UnmanagedHandle.cs
- TrustManagerPromptUI.cs
- xsdvalidator.cs
- RealProxy.cs