Code:
/ FX-1434 / FX-1434 / 1.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
- EmptyControlCollection.cs
- SystemWebCachingSectionGroup.cs
- TypeDelegator.cs
- DataGridItem.cs
- PropertyMap.cs
- MemberHolder.cs
- DataGridViewComboBoxColumnDesigner.cs
- SqlTypesSchemaImporter.cs
- Line.cs
- GZipDecoder.cs
- UnSafeCharBuffer.cs
- basecomparevalidator.cs
- SQLResource.cs
- ExclusiveTcpListener.cs
- WindowsScrollBar.cs
- storepermissionattribute.cs
- RawAppCommandInputReport.cs
- RefreshResponseInfo.cs
- ImageClickEventArgs.cs
- XmlDataImplementation.cs
- DropShadowBitmapEffect.cs
- Array.cs
- CombinedGeometry.cs
- Registry.cs
- Tuple.cs
- C14NUtil.cs
- DataServiceQueryOfT.cs
- TrackBarRenderer.cs
- BamlReader.cs
- StateRuntime.cs
- GroupBoxRenderer.cs
- OdbcConnectionPoolProviderInfo.cs
- QilInvokeEarlyBound.cs
- SizeFConverter.cs
- RoutedEvent.cs
- CryptoStream.cs
- MsdtcClusterUtils.cs
- GeometryValueSerializer.cs
- ThreadStateException.cs
- TCEAdapterGenerator.cs
- CachingHintValidation.cs
- WebPartAddingEventArgs.cs
- WebException.cs
- PanelDesigner.cs
- XmlEntityReference.cs
- BufferedOutputAsyncStream.cs
- PrintPageEvent.cs
- Thickness.cs
- CryptoStream.cs
- GridViewUpdateEventArgs.cs
- TextTreeFixupNode.cs
- ResolveNameEventArgs.cs
- WebReferencesBuildProvider.cs
- EntityWrapperFactory.cs
- ListViewInsertEventArgs.cs
- TableParaClient.cs
- HttpRequestWrapper.cs
- AsyncDataRequest.cs
- SecurityPermission.cs
- UriExt.cs
- MetadataArtifactLoaderCompositeResource.cs
- StylusPointProperties.cs
- BitmapEncoder.cs
- StylusPlugInCollection.cs
- MergablePropertyAttribute.cs
- UIElementCollection.cs
- SchemaObjectWriter.cs
- SqlLiftIndependentRowExpressions.cs
- latinshape.cs
- IDReferencePropertyAttribute.cs
- Unit.cs
- SqlDataSourceSelectingEventArgs.cs
- PageCatalogPart.cs
- DbXmlEnabledProviderManifest.cs
- ScriptServiceAttribute.cs
- SimplePropertyEntry.cs
- querybuilder.cs
- EastAsianLunisolarCalendar.cs
- XPathSelfQuery.cs
- XmlNodeList.cs
- WebResourceAttribute.cs
- DurableErrorHandler.cs
- ElementHostPropertyMap.cs
- XmlRootAttribute.cs
- GridErrorDlg.cs
- DBSchemaTable.cs
- DuplicateDetector.cs
- Privilege.cs
- IxmlLineInfo.cs
- AppearanceEditorPart.cs
- OpenFileDialog.cs
- HttpCookie.cs
- XmlSchemaSimpleTypeList.cs
- WebPartCatalogCloseVerb.cs
- XmlSchemaExporter.cs
- RuntimeWrappedException.cs
- FlatButtonAppearance.cs
- ContentPropertyAttribute.cs
- CurrentTimeZone.cs
- GCHandleCookieTable.cs