Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / Util / ColorComboBox.cs / 1 / ColorComboBox.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- // ColorComboBox.cs // // 12/22/98: Created: [....] // namespace System.Web.UI.Design.Util { using System.Runtime.Serialization.Formatters; using System.Diagnostics; using System; using Microsoft.Win32; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Globalization; ////// /// Standard combobox with standard sixteen colors in dropdown and a Color /// property /// [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)] internal sealed class ColorComboBox : ComboBox { private static readonly string[] COLOR_VALUES = new string[] { "Aqua", "Black", "Blue", "Fuchsia", "Gray", "Green", "Lime", "Maroon", "Navy", "Olive", "Purple", "Red", "Silver", "Teal", "White", "Yellow" }; ////// /// Creates a new ColorComboBox /// public ColorComboBox() : base() { } ////// /// public string Color { get { int index = SelectedIndex; if (index != -1) return COLOR_VALUES[index]; else return Text.Trim(); } set { SelectedIndex = -1; Text = String.Empty; if (value == null) { return; } string temp = value.Trim(); if (temp.Length != 0) { for (int i = 0; i < COLOR_VALUES.Length; i++) { if (String.Compare(COLOR_VALUES[i], temp, StringComparison.OrdinalIgnoreCase) == 0) { temp = COLOR_VALUES[i]; break; } } this.Text = temp; } } } ////// /// protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); if (!DesignMode && !RecreatingHandle) { Items.Clear(); Items.AddRange(COLOR_VALUES); } } } } // 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
- WebBaseEventKeyComparer.cs
- DataObjectPastingEventArgs.cs
- RectangleHotSpot.cs
- CodeStatementCollection.cs
- SamlAuthenticationClaimResource.cs
- IDReferencePropertyAttribute.cs
- ToolboxSnapDragDropEventArgs.cs
- StreamResourceInfo.cs
- IISMapPath.cs
- CharacterString.cs
- CompilerState.cs
- TextBox.cs
- ModifierKeysValueSerializer.cs
- MetadataArtifactLoaderCompositeResource.cs
- InputReferenceExpression.cs
- ReachIDocumentPaginatorSerializerAsync.cs
- TemplateComponentConnector.cs
- SoundPlayer.cs
- XmlAggregates.cs
- XmlSerializerVersionAttribute.cs
- Helpers.cs
- PipeException.cs
- COM2IDispatchConverter.cs
- ButtonBaseAdapter.cs
- BaseProcessor.cs
- WebServiceResponse.cs
- WriteTimeStream.cs
- XPathParser.cs
- ElementAtQueryOperator.cs
- FontFamily.cs
- SystemIPInterfaceProperties.cs
- Peer.cs
- CompoundFileDeflateTransform.cs
- RepeatBehavior.cs
- WSTransactionSection.cs
- MessageSmuggler.cs
- DateTimeFormatInfo.cs
- UrlRoutingModule.cs
- COM2PictureConverter.cs
- ToolboxComponentsCreatingEventArgs.cs
- BinaryConverter.cs
- ParameterCollection.cs
- X500Name.cs
- SafeFileMappingHandle.cs
- TextDecorationCollectionConverter.cs
- XmlRawWriter.cs
- ValidationResult.cs
- DefaultAssemblyResolver.cs
- Ops.cs
- FullTrustAssembly.cs
- SamlAuthenticationStatement.cs
- TimelineGroup.cs
- StyleCollection.cs
- XmlEventCache.cs
- WebPartActionVerb.cs
- GridToolTip.cs
- WindowsListViewItem.cs
- AnimationStorage.cs
- Int32RectConverter.cs
- Brush.cs
- GridToolTip.cs
- StylusShape.cs
- PointAnimationUsingPath.cs
- LogicalTreeHelper.cs
- RuntimeHandles.cs
- Table.cs
- MouseCaptureWithinProperty.cs
- WindowsListViewGroupHelper.cs
- keycontainerpermission.cs
- ClientOptions.cs
- VirtualPathProvider.cs
- VisualTreeUtils.cs
- WebPartChrome.cs
- SafeRightsManagementSessionHandle.cs
- XmlDocument.cs
- TypeHelpers.cs
- InstancePersistenceEvent.cs
- RegexStringValidator.cs
- SettingsContext.cs
- RetrieveVirtualItemEventArgs.cs
- ChildChangedEventArgs.cs
- HtmlInputCheckBox.cs
- ExceptionUtil.cs
- IsolatedStorageException.cs
- ActivityStateQuery.cs
- CorePropertiesFilter.cs
- ZipArchive.cs
- HttpPostedFile.cs
- DBSchemaRow.cs
- NativeWindow.cs
- ToolStripDropDownMenu.cs
- DocumentXPathNavigator.cs
- XmlCountingReader.cs
- ToolBar.cs
- GridEntryCollection.cs
- ResourceDictionary.cs
- RectangleF.cs
- RelatedPropertyManager.cs
- InfoCardXmlSerializer.cs
- _FtpDataStream.cs