download ComboBoxRenderer.cs
Language: C#
Copyright: (c) 2006 Novell, Inc.
LOC: 84
Project Info
mcs
Server: Mono
Type: svn
...Forms\System.Windows.Forms\
   AccessibleEvents.cs
   AccessibleNavigation.cs
   AccessibleObject.cs
   AccessibleRole.cs
   AccessibleSelection.cs
   AccessibleStates.cs
   AmbientProperties.cs
   AnchorStyles.cs
   Appearance.cs
   Application.cs
   ApplicationContext.cs
   ArrangeDirection.cs
   ArrangeStartingPosition.cs
   ArrowDirection.cs
   AsyncMethodData.cs
   AsyncMethodResult.cs
   AutoCompleteMode.cs
   AutoCompleteSource.cs
   AutoScaleMode.cs
   AutoSizeMode.cs
   AutoValidate.cs
   AxHost.cs
   BaseCollection.cs
   BatteryChargeStatus.cs
   Binding.cs
   BindingCompleteContext.cs
   ...ingCompleteEventArgs.cs
   ...CompleteEventHandler.cs
   BindingCompleteState.cs
   BindingContext.cs
   BindingManagerBase.cs
   ...erDataErrorEventArgs.cs
   ...ataErrorEventHandler.cs
   BindingMemberInfo.cs
   BindingsCollection.cs
   BootMode.cs
   Border3DSide.cs
   Border3DStyle.cs
   BorderStyle.cs
   BoundsSpecified.cs
   Button.cs
   ButtonBase.cs
   ButtonBorderStyle.cs
   ButtonRenderer.cs
   ButtonState.cs
   ...irtualItemsEventArgs.cs
   ...ualItemsEventHandler.cs
   CaptionButton.cs
   CategoryGridEntry.cs
   CharacterCasing.cs
   CheckBox.cs
   CheckBoxRenderer.cs
   CheckedListBox.cs
   CheckState.cs
   Clipboard.cs
   CloseReason.cs
   ColorDepth.cs
   ColorDialog.cs
   ColumnClickEventArgs.cs
   ColumnClickEventHandler.cs
   ColumnHeader.cs
   ...eaderAutoResizeStyle.cs
   ColumnHeaderStyle.cs
   ...mnReorderedEventArgs.cs
   ...eorderedEventHandler.cs
   ColumnStyle.cs
   ...idthChangedEventArgs.cs
   ...hChangedEventHandler.cs
   ...dthChangingEventArgs.cs
   ...ChangingEventHandler.cs
   ComboBox.cs
   ComboBoxRenderer.cs
   ComboBoxStyle.cs
   CommonDialog.cs
   ComponentModel.cs
   ContainerControl.cs
   ...entsResizedEventArgs.cs
   ...sResizedEventHandler.cs
   ContextMenu.cs
   Control.cs
   ...olBindingsCollection.cs
   ControlEventArgs.cs
   ControlEventHandler.cs
   ControlPaint.cs
   ControlStyles.cs
   ControlUpdateMode.cs
   ConvertEventArgs.cs
   ConvertEventHandler.cs
   CreateParams.cs
   CurrencyManager.cs
   Cursor.cs
   CursorConverter.cs
   Cursors.cs
   DataFormats.cs
   DataGrid.cs
   DataGridBoolColumn.cs
   DataGridCell.cs
   DataGridColumnStyle.cs
   DataGridLineStyle.cs
   ...ParentRowsLabelStyle.cs
   ...mnWidthTypeConverter.cs
   DataGridTableStyle.cs
   DataGridTextBox.cs
   DataGridTextBoxColumn.cs
   DataGridView.cs
   ...wAdvancedBorderStyle.cs
   ...ancedCellBorderStyle.cs
   ...ewAutoSizeColumnMode.cs
   ...eColumnModeEventArgs.cs
   ...lumnModeEventHandler.cs
   ...wAutoSizeColumnsMode.cs
   ...ColumnsModeEventArgs.cs
   ...umnsModeEventHandler.cs
   ...utoSizeModeEventArgs.cs
   ...SizeModeEventHandler.cs
   ...dViewAutoSizeRowMode.cs
   ...ViewAutoSizeRowsMode.cs
   DataGridViewBand.cs
   ...ingCompleteEventArgs.cs
   ...CompleteEventHandler.cs
   DataGridViewButtonCell.cs
   ...GridViewButtonColumn.cs
   DataGridViewCell.cs
   ...dViewCellBorderStyle.cs
   ...wCellCancelEventArgs.cs
   ...llCancelEventHandler.cs
   ...idViewCellCollection.cs
   ...StripNeededEventArgs.cs
   ...ipNeededEventHandler.cs
   ...rTextNeededEventArgs.cs
   ...xtNeededEventHandler.cs
   ...ridViewCellEventArgs.cs
   ...ViewCellEventHandler.cs
   ...lFormattingEventArgs.cs
   ...rmattingEventHandler.cs
   ...ewCellMouseEventArgs.cs
   ...ellMouseEventHandler.cs
   ...ellPaintingEventArgs.cs
   ...PaintingEventHandler.cs
   ...CellParsingEventArgs.cs
   ...lParsingEventHandler.cs
   ...tateChangedEventArgs.cs
   ...eChangedEventHandler.cs
   DataGridViewCellStyle.cs
   ...tentChangedEventArgs.cs
   ...tChangedEventHandler.cs
   ...ewCellStyleConverter.cs
   ...dViewCellStyleScopes.cs
   ...pTextNeededEventArgs.cs
   ...xtNeededEventHandler.cs
   ...lValidatingEventArgs.cs
   ...lidatingEventHandler.cs
   ...ewCellValueEventArgs.cs
   ...ellValueEventHandler.cs
   ...GridViewCheckBoxCell.cs
   ...idViewCheckBoxColumn.cs
   ...iewClipboardCopyMode.cs
   DataGridViewColumn.cs
   ...ViewColumnCollection.cs
   ...TimeVisibleAttribute.cs
   ...DoubleClickEventArgs.cs
   ...bleClickEventHandler.cs
   ...dViewColumnEventArgs.cs
   ...ewColumnEventHandler.cs
   ...ViewColumnHeaderCell.cs
   ...eadersHeightSizeMode.cs
   ...idViewColumnSortMode.cs
   ...tateChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...GridViewComboBoxCell.cs
   ...idViewComboBoxColumn.cs
   ...ComboBoxDisplayStyle.cs
   ...mboBoxEditingControl.cs
   ...ViewContentAlignment.cs
   ...iewDataErrorContexts.cs
   ...ewDataErrorEventArgs.cs
   ...ataErrorEventHandler.cs
   ...trolShowingEventArgs.cs
   ...lShowingEventHandler.cs
   DataGridViewEditMode.cs
   DataGridViewElement.cs
   ...ridViewElementStates.cs
   ...iewHeaderBorderStyle.cs
   DataGridViewHeaderCell.cs
   DataGridViewHitTestType.cs
   DataGridViewImageCell.cs
   ...dViewImageCellLayout.cs
   DataGridViewImageColumn.cs
   DataGridViewPaintParts.cs
   DataGridViewRow.cs
   ...ewRowCancelEventArgs.cs
   ...owCancelEventHandler.cs
   ...ridViewRowCollection.cs
   ...StripNeededEventArgs.cs
   ...ipNeededEventHandler.cs
   ...DoubleClickEventArgs.cs
   ...bleClickEventHandler.cs
   ...rTextNeededEventArgs.cs
   ...xtNeededEventHandler.cs
   ...GridViewRowEventArgs.cs
   ...dViewRowEventHandler.cs
   ...ridViewRowHeaderCell.cs
   ...HeadersWidthSizeMode.cs
   ...tInfoNeededEventArgs.cs
   ...foNeededEventHandler.cs
   ...tInfoPushedEventArgs.cs
   ...foPushedEventHandler.cs
   ...owPostPaintEventArgs.cs
   ...ostPaintEventHandler.cs
   ...RowPrePaintEventArgs.cs
   ...PrePaintEventHandler.cs
   ...ewRowsAddedEventArgs.cs
   ...owsAddedEventHandler.cs
   ...RowsDeletedEventArgs.cs
   ...RowsRemovedEventArgs.cs
   ...sRemovedEventHandler.cs
   ...tateChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...lectedCellCollection.cs
   ...ctedColumnCollection.cs
   ...electedRowCollection.cs
   ...ridViewSelectionMode.cs
   ...SortCompareEventArgs.cs
   ...tCompareEventHandler.cs
   DataGridViewTextBoxCell.cs
   ...ridViewTextBoxColumn.cs
   ...extBoxEditingControl.cs
   ...iewTopLeftHeaderCell.cs
   DataGridViewTriState.cs
   DataObject.cs
   DataSourceUpdateMode.cs
   DateBoldEventArgs.cs
   DateBoldEventHandler.cs
   DateRangeEventArgs.cs
   DateRangeEventHandler.cs
   DateTimePicker.cs
   DateTimePickerFormat.cs
   Day.cs
   DialogResult.cs
   DockingBehavior.cs
   DockStyle.cs
   DomainUpDown.cs
   DragAction.cs
   DragDropEffects.cs
   DragEventArgs.cs
   DragEventHandler.cs
   DrawItemEventArgs.cs
   DrawItemEventHandler.cs
   DrawItemState.cs
   DrawMode.cs
   ErrorBlinkStyle.cs
   ErrorIconAlignment.cs
   ErrorProvider.cs
   FeatureSupport.cs
   FileDialog.cs
   FixedPanel.cs
   FixedSizeTextBox.cs
   FlatStyle.cs
   FlowDirection.cs
   FolderBrowserDialog.cs
   FontDialog.cs
   Form.cs
   FormBorderStyle.cs
   FormClosedEventArgs.cs
   FormClosedEventHandler.cs
   FormClosingEventArgs.cs
   FormClosingEventHandler.cs
   FormStartPosition.cs
   FormWindowState.cs
   FrameStyle.cs
   GetChildAtPointSkip.cs
   GiveFeedbackEventArgs.cs
   ...FeedbackEventHandler.cs
   ...lumnStylesCollection.cs
   GridEntry.cs
   GridItem.cs
   GridItemCollection.cs
   GridItemType.cs
   GridTablesFactory.cs
   ...ableStylesCollection.cs
   GroupBox.cs
   GroupBoxRenderer.cs
   HandledMouseEventArgs.cs
   Help.cs
   HelpEventArgs.cs
   HelpEventHandler.cs
   HelpNavigator.cs
   HelpProvider.cs
   HorizontalAlignment.cs
   HScrollBar.cs
   ...InsertionOrientation.cs
   Hwnd.cs
   IButtonControl.cs
   ICommandExecutor.cs
   ...ponentEditorPageSite.cs
   IContainerControl.cs
   ...gNotificationService.cs
   IDataGridEditingService.cs
   ...aGridViewEditingCell.cs
   ...idViewEditingControl.cs
   IDataObject.cs
   IDropTarget.cs
   IFeatureSupport.cs
   IFileReaderService.cs
   ImageIndexConverter.cs
   ImageLayout.cs
   ImageList.cs
   ImageListConverter.cs
   ImageListStreamer.cs
   ImeMode.cs
   IMessageFilter.cs
   ImplicitHScrollBar.cs
   ImplicitVScrollBar.cs
   InputLanguage.cs
   ...uageChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...ageChangingEventArgs.cs
   ...ChangingEventHandler.cs
   InputLanguageCollection.cs
   InsertKeyMode.cs
   InternalWindowManager.cs
   InvalidateEventArgs.cs
   InvalidateEventHandler.cs
   IRootGridEntry.cs
   ItemActivation.cs
   ItemBoundsPortion.cs
   ItemChangedEventArgs.cs
   ItemChangedEventHandler.cs
   ItemCheckedEventArgs.cs
   ItemCheckedEventHandler.cs
   ItemCheckEventArgs.cs
   ItemCheckEventHandler.cs
   ItemDragEventArgs.cs
   ItemDragEventHandler.cs
   IWin32Window.cs
   IWindowTarget.cs
   KeyboardLayouts.cs
   KeyEventArgs.cs
   KeyEventHandler.cs
   KeyPressEventArgs.cs
   KeyPressEventHandler.cs
   Keys.cs
   KeysConverter.cs
   Label.cs
   LabelEditEventArgs.cs
   LabelEditEventHandler.cs
   LabelEditTextBox.cs
   LayoutEngine.cs
   LayoutEventArgs.cs
   LayoutEventHandler.cs
   LayoutSettings.cs
   LeftRightAlignment.cs
   LibSupport.cs
   LinkArea.cs
   LinkBehavior.cs
   LinkClickedEventArgs.cs
   LinkClickedEventHandler.cs
   LinkLabel.cs
   ...LinkClickedEventArgs.cs
   ...kClickedEventHandler.cs
   LinkState.cs
   ListBindingConverter.cs
   ListBox.cs
   ListControl.cs
   ...trolConvertEventArgs.cs
   ...lConvertEventHandler.cs
   ListView.cs
   ListViewAlignment.cs
   ...ViewHitTestLocations.cs
   ListViewItem.cs
   ListViewItemConverter.cs
   ...mMouseHoverEventArgs.cs
   ...useHoverEventHandler.cs
   ...tionChangedEventArgs.cs
   ...nChangedEventHandler.cs
   ListViewItemStates.cs
   ...angeChangedEventArgs.cs
   ...eChangedEventHandler.cs
   MainMenu.cs
   MaskFormat.cs
   ...putRejectedEventArgs.cs
   ...RejectedEventHandler.cs
   MdiChildContext.cs
   MdiClient.cs
   MdiLayout.cs
   MdiWindowManager.cs
   MeasureItemEventArgs.cs
   MeasureItemEventHandler.cs
   Menu.cs
   MenuAPI.cs
   MenuGlyph.cs
   MenuItem.cs
   MenuMerge.cs
   MenuStrip.cs
   MergeAction.cs
   Message.cs
   MessageBox.cs
   MessageBoxButtons.cs
   MessageBoxDefaultButton.cs
   MessageBoxIcon.cs
   MessageBoxOptions.cs
   MethodInvoker.cs
   Mime.cs
   MimeIcon.cs
   MonthCalendar.cs
   MouseButtons.cs
   MouseEventArgs.cs
   MouseEventHandler.cs
   MWFCategoryAttribute.cs
   MWFDescriptionAttribute.cs
   NativeWindow.cs
   NavigateEventArgs.cs
   NavigateEventHandler.cs
   NodeLabelEditEventArgs.cs
   ...abelEditEventHandler.cs
   NotifyIcon.cs
   NumericUpDown.cs
   OpacityConverter.cs
   OpenFileDialog.cs
   OpenTreeNodeEnumerator.cs
   Orientation.cs
   OSFeature.cs
   OSXStructs.cs
   OwnerDrawPropertyBag.cs
   Padding.cs
   PageSetupDialog.cs
   PaintEventArgs.cs
   PaintEventHandler.cs
   Panel.cs
   PictureBox.cs
   PictureBoxSizeMode.cs
   PopupEventArgs.cs
   PopupEventHandler.cs
   PowerLineStatus.cs
   PowerState.cs
   PreProcessControlState.cs
   PreviewKeyDownEventArgs.cs
   ...wKeyDownEventHandler.cs
   ...llerWithStatusDialog.cs
   PrintDialog.cs
   PrintPreviewControl.cs
   PrintPreviewDialog.cs
   ProfessionalColors.cs
   ProfessionalColorTable.cs
   ProgressBar.cs
   ProgressBarRenderer.cs
   ProgressBarStyle.cs
   PropertiesTab.cs
   PropertyGrid.cs
   PropertyGridCommands.cs
   PropertyGridEntry.cs
   PropertyGridTextBox.cs
   PropertyGridView.cs
   PropertyManager.cs
   PropertySort.cs
   ...yTabChangedEventArgs.cs
   ...bChangedEventHandler.cs
   ...alueChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...ibilityHelpEventArgs.cs
   ...lityHelpEventHandler.cs
   ...ontinueDragEventArgs.cs
   ...inueDragEventHandler.cs
   QuestionEventArgs.cs
   QuestionEventHandler.cs
   RadioButton.cs
   RadioButtonRenderer.cs
   RelatedCurrencyManager.cs
   RelatedPropertyManager.cs
   ...VirtualItemEventArgs.cs
   ...tualItemEventHandler.cs
   RichTextBox.cs
   RichTextBoxFinds.cs
   ...xtBoxLanguageOptions.cs
   RichTextBoxScrollBars.cs
   ...oxSelectionAttribute.cs
   ...extBoxSelectionTypes.cs
   RichTextBoxStreamType.cs
   ...tBoxWordPunctuations.cs
   RightToLeft.cs
   RowStyle.cs
   SaveFileDialog.cs
   Screen.cs
   ScreenOrientation.cs
   ScrollableControl.cs
   ScrollBar.cs
   ScrollBarRenderer.cs
   ScrollBars.cs
   ScrollButton.cs
   ScrollEventArgs.cs
   ScrollEventHandler.cs
   ScrollEventType.cs
   ScrollOrientation.cs
   SearchDirectionHint.cs
   ...VirtualItemEventArgs.cs
   ...tualItemEventHandler.cs
   SecurityIDType.cs
   ...ItemChangedEventArgs.cs
   ...mChangedEventHandler.cs
   SelectionMode.cs
   SelectionRange.cs
   SelectionRangeConverter.cs
   SendKeys.cs
   Shortcut.cs
   SizeGrip.cs
   SizeGripStyle.cs
   SizeType.cs
   SortOrder.cs
   Splitter.cs
   SplitterCancelEventArgs.cs
   ...erCancelEventHandler.cs
   SplitterEventArgs.cs
   SplitterEventHandler.cs
   StatusBar.cs
   ...BarDrawItemEventArgs.cs
   ...DrawItemEventHandler.cs
   StatusBarPanel.cs
   StatusBarPanelAutoSize.cs
   ...sBarPanelBorderStyle.cs
   ...rPanelClickEventArgs.cs
   ...nelClickEventHandler.cs
   StatusBarPanelStyle.cs
   StructFormat.cs
   SWF.csproj.user
   SystemInformation.cs
   SystemParameter.cs
   TabAlignment.cs
   TabAppearance.cs
   TabControl.cs
   TabControlAction.cs
   ...ntrolCancelEventArgs.cs
   ...olCancelEventHandler.cs
   TabControlEventArgs.cs
   TabControlEventHandler.cs
   TabDrawMode.cs
   TableLayout.cs
   ...utCellPaintEventArgs.cs
   ...ellPaintEventHandler.cs
   TableLayoutPanel.cs
   ...PanelCellBorderStyle.cs
   ...LayoutPanelGrowStyle.cs
   TableLayoutSettings.cs
   TabPage.cs
   TabRenderer.cs
   TabSizeMode.cs
   TextBox.cs
   TextBoxBase.cs
   TextBoxRenderer.cs
   TextControl.cs
   TextDataFormat.cs
   TextFormatFlags.cs
   TextImageRelation.cs
   TextRenderer.cs
   Theme.cs
   ThemeClearlooks.cs
   ThemeEngine.cs
   ThemeGtk.cs
   ThemeNice.cs
   ThemeWin32Classic.cs
   ThreadExceptionDialog.cs
   TickStyle.cs
   Timer.cs
   ToolBar.cs
   ToolBarAppearance.cs
   ToolBarButton.cs
   ...ButtonClickEventArgs.cs
   ...tonClickEventHandler.cs
   ToolBarButtonStyle.cs
   ToolBarTextAlign.cs
   ToolStrip.cs
   ...pDownClosedEventArgs.cs
   ...wnClosedEventHandler.cs
   ...pDropDownCloseReason.cs
   ...DownClosingEventArgs.cs
   ...nClosingEventHandler.cs
   ...ripDropDownDirection.cs
   ToolStripDropDownItem.cs
   ...tripGripDisplayStyle.cs
   ToolStripGripStyle.cs
   ToolStripItem.cs
   ToolStripItemAlignment.cs
   ...tripItemDisplayStyle.cs
   ...tripItemImageScaling.cs
   ToolStripItemOverflow.cs
   ToolStripItemPlacement.cs
   ToolStripLayoutStyle.cs
   ...ripManagerRenderMode.cs
   ToolStripMenuItem.cs
   ToolStripRenderMode.cs
   ...atusLabelBorderSides.cs
   ToolStripTextDirection.cs
   ToolTip.cs
   ToolTipIcon.cs
   TrackBar.cs
   TrackBarRenderer.cs
   TreeNode.cs
   TreeNodeCollection.cs
   TreeNodeConverter.cs
   ...eMouseClickEventArgs.cs
   ...useClickEventHandler.cs
   ...eMouseHoverEventArgs.cs
   ...useHoverEventHandler.cs
   TreeNodeStates.cs
   TreeView.cs
   TreeViewAction.cs
   TreeViewCancelEventArgs.cs
   ...ewCancelEventHandler.cs
   TreeViewDrawMode.cs
   TreeViewEventArgs.cs
   TreeViewEventHandler.cs
   ...ViewHitTestLocations.cs
   ...wImageIndexConverter.cs
   TypeValidationEventArgs.cs
   ...lidationEventHandler.cs
   UICues.cs
   UICuesEventArgs.cs
   UICuesEventHandler.cs
   UnhandledExceptionMode.cs
   UpDownBase.cs
   UpDownEventArgs.cs
   UpDownEventHandler.cs
   UserControl.cs
   ValidationConstraints.cs
   View.cs
   VScrollBar.cs
   ...ntCompletedEventArgs.cs
   ...ompletedEventHandler.cs
   ...owserEncryptionLevel.cs
   ...erNavigatedEventArgs.cs
   ...avigatedEventHandler.cs
   ...rNavigatingEventArgs.cs
   ...vigatingEventHandler.cs
   ...ressChangedEventArgs.cs
   ...sChangedEventHandler.cs
   WebBrowserReadyState.cs
   WebBrowserRefreshOption.cs
   Win32DnD.cs
   X11DesktopColors.cs
   X11Dnd.cs
   X11Keyboard.cs
   X11Structs.cs
   XEventQueue.cs
   XplatUI.cs
   XplatUIDriver.cs
   XplatUIOSX.cs
   XplatUIStructs.cs
   XplatUIWin32.cs
   XplatUIX11.cs
   XplatUIX11GTK.cs

//
// ComboBoxRenderer.cs
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc.
//
// Authors:
//	Jonathan Pobst (monkey@jpobst.com)
//

#if NET_2_0
using System.Drawing;
using System.Windows.Forms.VisualStyles;

namespace System.Windows.Forms
{
	public sealed class ComboBoxRenderer
	{
		#region Private Constructor
		private ComboBoxRenderer () { }
		#endregion

		#region Public Static Methods
		public static void DrawDropDownButton (Graphics g, Rectangle bounds, ComboBoxState state)
		{
			if (!IsSupported)
				throw new InvalidOperationException ();

			GetComboRenderer (state).DrawBackground (g, bounds);
		}

		public static void DrawTextBox (Graphics g, Rectangle bounds, string comboBoxText, Font font, Rectangle textBounds, TextFormatFlags flags, ComboBoxState state)
		{
			if (!IsSupported)
				throw new InvalidOperationException ();

			GetTextBoxRenderer (state).DrawBackground (g, bounds);

			if (textBounds == Rectangle.Empty)
				textBounds = new Rectangle (bounds.Left + 3, bounds.Top, bounds.Width - 4, bounds.Height);

			if (comboBoxText != String.Empty)
				if (state == ComboBoxState.Disabled)
					TextRenderer.DrawText (g, comboBoxText, font, textBounds, SystemColors.GrayText, flags);
				else
					TextRenderer.DrawText (g, comboBoxText, font, textBounds, SystemColors.ControlText, flags);
		}

		public static void DrawTextBox (Graphics g, Rectangle bounds, ComboBoxState state)
		{
			DrawTextBox (g, bounds, String.Empty, null, Rectangle.Empty, TextFormatFlags.VerticalCenter, state);
		}

		public static void DrawTextBox (Graphics g, Rectangle bounds, string comboBoxText, Font font, ComboBoxState state)
		{
			DrawTextBox (g, bounds, comboBoxText, font, Rectangle.Empty, TextFormatFlags.VerticalCenter, state);
		}

		public static void DrawTextBox (Graphics g, Rectangle bounds, string comboBoxText, Font font, Rectangle textBounds, ComboBoxState state)
		{
			DrawTextBox (g, bounds, comboBoxText, font, textBounds, TextFormatFlags.Default, state);
		}

		public static void DrawTextBox (Graphics g, Rectangle bounds, string comboBoxText, Font font, TextFormatFlags flags, ComboBoxState state)
		{
			DrawTextBox (g, bounds, comboBoxText, font, Rectangle.Empty, flags |= TextFormatFlags.VerticalCenter, state);
		}
		#endregion

		#region Private Static Methods
		private static VisualStyleRenderer GetComboRenderer (ComboBoxState state)
		{
			switch (state) {
				case ComboBoxState.Disabled:
					return new VisualStyleRenderer (VisualStyleElement.ComboBox.DropDownButton.Disabled);
				case ComboBoxState.Hot:
					return new VisualStyleRenderer (VisualStyleElement.ComboBox.DropDownButton.Hot);
				case ComboBoxState.Normal:
				default:
					return new VisualStyleRenderer (VisualStyleElement.ComboBox.DropDownButton.Normal);
				case ComboBoxState.Pressed:
					return new VisualStyleRenderer (VisualStyleElement.ComboBox.DropDownButton.Pressed);
			}
		}

		private static VisualStyleRenderer GetTextBoxRenderer (ComboBoxState state)
		{
			switch (state) {
				case ComboBoxState.Disabled:
					return new VisualStyleRenderer (VisualStyleElement.TextBox.TextEdit.Disabled);
				case ComboBoxState.Hot:
					return new VisualStyleRenderer (VisualStyleElement.TextBox.TextEdit.Hot);
				case ComboBoxState.Normal:
				case ComboBoxState.Pressed:
				default:
					return new VisualStyleRenderer (VisualStyleElement.TextBox.TextEdit.Normal);
			}
		}
		#endregion

		#region Public Static Properties
		public static bool IsSupported {
			get { return VisualStyleInformation.IsEnabledByUser && (Application.VisualStyleState == VisualStyleState.ClientAndNonClientAreasEnabled || Application.VisualStyleState == VisualStyleState.ClientAreaEnabled); }
		}
		#endregion
	}
}
#endif

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us