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
- TdsParserHelperClasses.cs
- StructuredProperty.cs
- XmlDataImplementation.cs
- ScriptingProfileServiceSection.cs
- TextDecoration.cs
- OletxTransactionManager.cs
- StreamReader.cs
- UnsafeNativeMethods.cs
- _ListenerAsyncResult.cs
- UpnEndpointIdentityExtension.cs
- COM2FontConverter.cs
- SQLMembershipProvider.cs
- SpellerStatusTable.cs
- FormsAuthenticationConfiguration.cs
- BuilderPropertyEntry.cs
- PropertyEmitterBase.cs
- RawStylusInputCustomDataList.cs
- SymmetricAlgorithm.cs
- IPAddressCollection.cs
- ModelUIElement3D.cs
- OleAutBinder.cs
- SqlXmlStorage.cs
- TypographyProperties.cs
- WebPartZoneCollection.cs
- CurrencyManager.cs
- ResourceManagerWrapper.cs
- MenuDesigner.cs
- Timer.cs
- DescendantOverDescendantQuery.cs
- HtmlTableRowCollection.cs
- VersionPair.cs
- NotifyParentPropertyAttribute.cs
- DbConnectionStringBuilder.cs
- SecondaryIndex.cs
- CollectionBase.cs
- Block.cs
- CodeDomConfigurationHandler.cs
- LostFocusEventManager.cs
- NameValuePair.cs
- DomNameTable.cs
- IndexedGlyphRun.cs
- TransactionBridgeSection.cs
- GeneratedCodeAttribute.cs
- SecureEnvironment.cs
- DataGridViewHeaderCell.cs
- PeerNameRegistration.cs
- FrameworkTemplate.cs
- IdleTimeoutMonitor.cs
- SamlAuthorizationDecisionStatement.cs
- WorkflowEnvironment.cs
- XamlToRtfParser.cs
- FieldDescriptor.cs
- ExpressionBuilderContext.cs
- DurableEnlistmentState.cs
- Classification.cs
- KnownTypes.cs
- Ops.cs
- ToolBarTray.cs
- DataTemplate.cs
- TypeSource.cs
- ReflectionServiceProvider.cs
- ITextView.cs
- BufferedStream2.cs
- EntitySetRetriever.cs
- RtfNavigator.cs
- MarshalByValueComponent.cs
- BrushValueSerializer.cs
- FloaterBaseParagraph.cs
- TryCatch.cs
- BufferedGraphicsManager.cs
- SortFieldComparer.cs
- RegexCompiler.cs
- XhtmlBasicLabelAdapter.cs
- ApplyImportsAction.cs
- SeparatorAutomationPeer.cs
- AsyncCodeActivity.cs
- IgnoreSection.cs
- FileVersionInfo.cs
- ObjectTag.cs
- ImageListDesigner.cs
- CacheForPrimitiveTypes.cs
- DataGridViewCellLinkedList.cs
- Win32.cs
- WinCategoryAttribute.cs
- WebPartTracker.cs
- ProxyGenerator.cs
- WebPartZoneBaseDesigner.cs
- SmtpTransport.cs
- DocumentViewerConstants.cs
- CacheHelper.cs
- ObjectSelectorEditor.cs
- X509CertificateRecipientClientCredential.cs
- SamlConditions.cs
- DictionaryContent.cs
- COM2ColorConverter.cs
- wgx_sdk_version.cs
- InitializationEventAttribute.cs
- UnsafeNativeMethods.cs
- HttpCachePolicy.cs
- RightsManagementEncryptedStream.cs