Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CommonUI / System / Drawing / Design / UITypeEditor.cs / 1 / UITypeEditor.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.Drawing.Design {
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Collections;
using Microsoft.Win32;
using System.ComponentModel.Design;
using System.Drawing;
using System.Collections.Generic;
using System.Collections.ObjectModel;
///
///
/// Provides a base class for editors
/// that may provide users with a user interface to visually edit
/// the values of the supported type or types.
///
[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")]
[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
public class UITypeEditor {
///
///
/// In this static constructor we provide default UITypeEditors to
/// the TypeDescriptor.
///
static UITypeEditor() {
Hashtable intrinsicEditors = new Hashtable();
// Our set of intrinsic editors.
intrinsicEditors[typeof(DateTime)] = "System.ComponentModel.Design.DateTimeEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(Array)] = "System.ComponentModel.Design.ArrayEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(IList)] = "System.ComponentModel.Design.CollectionEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(ICollection)] = "System.ComponentModel.Design.CollectionEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(byte[])] = "System.ComponentModel.Design.BinaryEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(System.IO.Stream)] = "System.ComponentModel.Design.BinaryEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(string[])] = "System.Windows.Forms.Design.StringArrayEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(Collection)] = "System.Windows.Forms.Design.StringCollectionEditor, " + AssemblyRef.SystemDesign;
// Add our intrinsic editors to TypeDescriptor.
//
TypeDescriptor.AddEditorTable(typeof(UITypeEditor), intrinsicEditors);
}
///
///
///
/// Initializes
/// a new instance of the class.
///
///
public UITypeEditor() {
}
///
///
///
/// Determines if drop-down editors should be resizable by the user.
///
///
public virtual bool IsDropDownResizable {
get {
return false;
}
}
///
///
/// Edits the specified value using the editor style
/// provided by .
///
public object EditValue(IServiceProvider provider, object value) {
return EditValue(null, provider, value);
}
///
///
/// Edits the specified object's value using the editor style
/// provided by .
///
public virtual object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) {
return value;
}
///
///
///
/// Gets the
/// of the Edit method.
///
///
public UITypeEditorEditStyle GetEditStyle() {
return GetEditStyle(null);
}
///
///
/// Gets a value indicating whether this editor supports painting a representation
/// of an object's value.
///
public bool GetPaintValueSupported() {
return GetPaintValueSupported(null);
}
///
///
/// Gets a value indicating whether the specified context supports painting a representation
/// of an object's value.
///
public virtual bool GetPaintValueSupported(ITypeDescriptorContext context) {
return false;
}
///
///
///
/// Gets the editing style of the Edit method.
///
///
public virtual UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) {
return UITypeEditorEditStyle.None;
}
///
///
/// Paints a representative value of the specified object to the
/// specified canvas.
///
public void PaintValue(object value, Graphics canvas, Rectangle rectangle) {
PaintValue(new PaintValueEventArgs(null, value, canvas, rectangle));
}
///
///
/// Paints a representative value of the specified object to the
/// provided canvas.
///
[SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
public virtual void PaintValue(PaintValueEventArgs e) {
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.Drawing.Design {
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Collections;
using Microsoft.Win32;
using System.ComponentModel.Design;
using System.Drawing;
using System.Collections.Generic;
using System.Collections.ObjectModel;
///
///
/// Provides a base class for editors
/// that may provide users with a user interface to visually edit
/// the values of the supported type or types.
///
[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")]
[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
public class UITypeEditor {
///
///
/// In this static constructor we provide default UITypeEditors to
/// the TypeDescriptor.
///
static UITypeEditor() {
Hashtable intrinsicEditors = new Hashtable();
// Our set of intrinsic editors.
intrinsicEditors[typeof(DateTime)] = "System.ComponentModel.Design.DateTimeEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(Array)] = "System.ComponentModel.Design.ArrayEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(IList)] = "System.ComponentModel.Design.CollectionEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(ICollection)] = "System.ComponentModel.Design.CollectionEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(byte[])] = "System.ComponentModel.Design.BinaryEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(System.IO.Stream)] = "System.ComponentModel.Design.BinaryEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(string[])] = "System.Windows.Forms.Design.StringArrayEditor, " + AssemblyRef.SystemDesign;
intrinsicEditors[typeof(Collection)] = "System.Windows.Forms.Design.StringCollectionEditor, " + AssemblyRef.SystemDesign;
// Add our intrinsic editors to TypeDescriptor.
//
TypeDescriptor.AddEditorTable(typeof(UITypeEditor), intrinsicEditors);
}
///
///
///
/// Initializes
/// a new instance of the class.
///
///
public UITypeEditor() {
}
///
///
///
/// Determines if drop-down editors should be resizable by the user.
///
///
public virtual bool IsDropDownResizable {
get {
return false;
}
}
///
///
/// Edits the specified value using the editor style
/// provided by .
///
public object EditValue(IServiceProvider provider, object value) {
return EditValue(null, provider, value);
}
///
///
/// Edits the specified object's value using the editor style
/// provided by .
///
public virtual object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) {
return value;
}
///
///
///
/// Gets the
/// of the Edit method.
///
///
public UITypeEditorEditStyle GetEditStyle() {
return GetEditStyle(null);
}
///
///
/// Gets a value indicating whether this editor supports painting a representation
/// of an object's value.
///
public bool GetPaintValueSupported() {
return GetPaintValueSupported(null);
}
///
///
/// Gets a value indicating whether the specified context supports painting a representation
/// of an object's value.
///
public virtual bool GetPaintValueSupported(ITypeDescriptorContext context) {
return false;
}
///
///
///
/// Gets the editing style of the Edit method.
///
///
public virtual UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) {
return UITypeEditorEditStyle.None;
}
///
///
/// Paints a representative value of the specified object to the
/// specified canvas.
///
public void PaintValue(object value, Graphics canvas, Rectangle rectangle) {
PaintValue(new PaintValueEventArgs(null, value, canvas, rectangle));
}
///
///
/// Paints a representative value of the specified object to the
/// provided canvas.
///
[SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
public virtual void PaintValue(PaintValueEventArgs e) {
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlDataSourceStatusEventArgs.cs
- ItemCheckEvent.cs
- BaseParaClient.cs
- DocumentViewerBase.cs
- ConcurrencyBehavior.cs
- QilGeneratorEnv.cs
- DataGridViewRowsAddedEventArgs.cs
- EndpointIdentityExtension.cs
- WebServiceParameterData.cs
- MultiDataTrigger.cs
- TabControlAutomationPeer.cs
- PinnedBufferMemoryStream.cs
- SharedUtils.cs
- SafeTimerHandle.cs
- DataBindingsDialog.cs
- Version.cs
- MonitorWrapper.cs
- Stackframe.cs
- DSACryptoServiceProvider.cs
- SlipBehavior.cs
- DesignerMetadata.cs
- WebPartEventArgs.cs
- CacheDependency.cs
- MailMessage.cs
- CollectionViewProxy.cs
- FilterElement.cs
- DataGridViewColumnCollection.cs
- FragmentQuery.cs
- RandomNumberGenerator.cs
- WebSysDefaultValueAttribute.cs
- ToolStripPanelRenderEventArgs.cs
- graph.cs
- COM2PictureConverter.cs
- RuntimeConfigLKG.cs
- MarkupWriter.cs
- Transform3DGroup.cs
- MetroSerializationManager.cs
- LoadWorkflowByKeyAsyncResult.cs
- CrossContextChannel.cs
- TextServicesDisplayAttribute.cs
- Keywords.cs
- PtsPage.cs
- AttachedAnnotation.cs
- Point3DCollection.cs
- EdmError.cs
- InvalidOleVariantTypeException.cs
- SpotLight.cs
- RtType.cs
- SocketPermission.cs
- IconHelper.cs
- DataGridRow.cs
- WorkflowDefinitionDispenser.cs
- CodeExporter.cs
- DataSourceComponent.cs
- StronglyTypedResourceBuilder.cs
- QilLiteral.cs
- Parser.cs
- MethodToken.cs
- PersistChildrenAttribute.cs
- BamlRecordWriter.cs
- EntityParameterCollection.cs
- EndpointIdentityExtension.cs
- InkCanvasSelection.cs
- SecurityToken.cs
- CodeCatchClauseCollection.cs
- IntegerValidator.cs
- EventDescriptor.cs
- ChangesetResponse.cs
- TabPanel.cs
- Win32Exception.cs
- IndependentAnimationStorage.cs
- PathSegmentCollection.cs
- TargetFrameworkUtil.cs
- FloatUtil.cs
- userdatakeys.cs
- EmbossBitmapEffect.cs
- CacheMemory.cs
- ResourceExpression.cs
- DataRowComparer.cs
- EditorPartCollection.cs
- StringFormat.cs
- SystemIcons.cs
- DataServiceProviderWrapper.cs
- TreeViewAutomationPeer.cs
- UrlMapping.cs
- BindUriHelper.cs
- TableRow.cs
- ErrorFormatter.cs
- ProfileModule.cs
- _LocalDataStoreMgr.cs
- FormClosedEvent.cs
- CustomErrorsSection.cs
- BigInt.cs
- NotFiniteNumberException.cs
- CodeTypeOfExpression.cs
- Int16Converter.cs
- MetafileHeader.cs
- SQLInt64.cs
- WebPartTransformerCollection.cs