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
- RenderOptions.cs
- DataErrorValidationRule.cs
- AttachInfo.cs
- TextHidden.cs
- SemanticBasicElement.cs
- Configuration.cs
- IdentityReference.cs
- PerspectiveCamera.cs
- ReferentialConstraint.cs
- OdbcDataAdapter.cs
- MeasurementDCInfo.cs
- Emitter.cs
- Guid.cs
- XmlSchemaSimpleContentRestriction.cs
- TextContainerHelper.cs
- ExternalCalls.cs
- HeaderPanel.cs
- CanonicalFormWriter.cs
- BaseTemplatedMobileComponentEditor.cs
- RotateTransform.cs
- RC2CryptoServiceProvider.cs
- MimeImporter.cs
- MappingSource.cs
- ObjectTag.cs
- UIElementIsland.cs
- FloatAverageAggregationOperator.cs
- RemoteWebConfigurationHostStream.cs
- RowVisual.cs
- EventTrigger.cs
- InnerItemCollectionView.cs
- HostingEnvironmentSection.cs
- XmlSchemaChoice.cs
- EventLogger.cs
- ProfileProvider.cs
- MouseEventArgs.cs
- SynchronizedPool.cs
- SchemaConstraints.cs
- RenderData.cs
- MSAAEventDispatcher.cs
- SqlDataSourceCommandParser.cs
- PeerInvitationResponse.cs
- Publisher.cs
- GetPolicyDetailsRequest.cs
- PieceNameHelper.cs
- odbcmetadatafactory.cs
- IdentifierService.cs
- Baml2006ReaderContext.cs
- FaultContext.cs
- ListViewInsertedEventArgs.cs
- InkCollectionBehavior.cs
- ParserExtension.cs
- Base64Stream.cs
- BufferedGraphicsManager.cs
- CapabilitiesSection.cs
- Int16Converter.cs
- TabControlAutomationPeer.cs
- ByteStack.cs
- ParseElementCollection.cs
- HotSpotCollection.cs
- ImageBrush.cs
- WindowsListViewGroup.cs
- CorrelationExtension.cs
- ProfileSettings.cs
- DataGridItemCollection.cs
- EdmPropertyAttribute.cs
- GeneralTransformGroup.cs
- ACE.cs
- QilFunction.cs
- NavigationProperty.cs
- GlobalizationSection.cs
- XmlKeywords.cs
- EtwTrace.cs
- FormDesigner.cs
- EditorPartChrome.cs
- ToolBarButtonDesigner.cs
- WebPartHelpVerb.cs
- LinkedResource.cs
- MenuItemBinding.cs
- RegexGroup.cs
- SmtpTransport.cs
- FunctionDescription.cs
- ImageButton.cs
- HealthMonitoringSection.cs
- IteratorFilter.cs
- CommonBehaviorsSection.cs
- HtmlMeta.cs
- CompilationSection.cs
- RenderData.cs
- DataControlPagerLinkButton.cs
- HtmlUtf8RawTextWriter.cs
- TreeNodeClickEventArgs.cs
- RefType.cs
- XmlNodeChangedEventManager.cs
- EntityUtil.cs
- BindUriHelper.cs
- RenderDataDrawingContext.cs
- DataStorage.cs
- MultiDataTrigger.cs
- ChannelDemuxer.cs
- RecognizedPhrase.cs