Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / WinForms / Managed / System / WinForms / ButtonInternal / RadioButtonPopupAdapter.cs / 1 / RadioButtonPopupAdapter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.ButtonInternal { using System; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing.Text; using System.Windows.Forms; internal class RadioButtonPopupAdapter : RadioButtonFlatAdapter { internal RadioButtonPopupAdapter(ButtonBase control) : base(control) {} internal override void PaintUp(PaintEventArgs e, CheckState state) { System.Drawing.Graphics g = e.Graphics; if (Control.Appearance == Appearance.Button) { ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control); adapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintPopupRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBackgroundFlat(e, layout.checkBounds, colors.buttonShadow, colors.options.highContrast ? colors.buttonFace : colors.highlight, true); DrawCheckOnly(e, layout, colors.windowText, colors.highlight, true); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { System.Drawing.Graphics g = e.Graphics; if (Control.Appearance == Appearance.Button) { ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control); adapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintPopupRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBackground3DLite(e, layout.checkBounds, colors.windowText, colors.options.highContrast ? colors.buttonFace : colors.highlight, colors, true); DrawCheckOnly(e, layout, colors.windowText, colors.highlight, true); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintDown(PaintEventArgs e, CheckState state) { System.Drawing.Graphics g = e.Graphics; if (Control.Appearance == Appearance.Button) { ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control); adapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintPopupRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBackground3DLite(e, layout.checkBounds, colors.windowText, colors.highlight, colors, true); DrawCheckOnly(e, layout, colors.buttonShadow, colors.highlight, true); PaintField(e, layout, colors, colors.windowText, true); } } #region Layout protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonPopupAdapter(Control); } protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = base.Layout(e); if (!Control.MouseIsDown && !Control.MouseIsOver) { layout.shadowedText = true; } return layout; } #endregion } } // 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
- XmlQueryCardinality.cs
- CompressEmulationStream.cs
- HyperLinkField.cs
- GlyphInfoList.cs
- TreeViewHitTestInfo.cs
- FontCacheLogic.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- HttpServerVarsCollection.cs
- FileNotFoundException.cs
- ScrollViewerAutomationPeer.cs
- DocumentGridPage.cs
- Helpers.cs
- ISAPIApplicationHost.cs
- BookmarkUndoUnit.cs
- FixedDocumentSequencePaginator.cs
- DispatcherOperation.cs
- ArgumentValue.cs
- XmlNamespaceManager.cs
- PerformanceCounterManager.cs
- DebugTracing.cs
- SqlXmlStorage.cs
- ServicePoint.cs
- MaskedTextProvider.cs
- SupportingTokenAuthenticatorSpecification.cs
- DiscardableAttribute.cs
- LinkButton.cs
- InputMethodStateTypeInfo.cs
- NullableDecimalMinMaxAggregationOperator.cs
- SecurityTokenSpecification.cs
- ProfileManager.cs
- LoadGrammarCompletedEventArgs.cs
- WebPartConnectionsCancelEventArgs.cs
- SynchronizationLockException.cs
- Point3DCollection.cs
- PrintControllerWithStatusDialog.cs
- Unit.cs
- RequestBringIntoViewEventArgs.cs
- SupportingTokenParameters.cs
- InfoCardUIAgent.cs
- SiteMapNodeItemEventArgs.cs
- RegistryPermission.cs
- Vertex.cs
- BinaryKeyIdentifierClause.cs
- ColumnWidthChangingEvent.cs
- SymbolPair.cs
- DbCommandTree.cs
- SqlXml.cs
- WrapPanel.cs
- CssStyleCollection.cs
- Rules.cs
- EpmContentDeSerializerBase.cs
- LingerOption.cs
- RoutedCommand.cs
- Margins.cs
- SynchronizationScope.cs
- TemplateNodeContextMenu.cs
- Int32EqualityComparer.cs
- SettingsPropertyWrongTypeException.cs
- WebBrowserSiteBase.cs
- Lazy.cs
- Effect.cs
- CreateUserWizardStep.cs
- CreateUserWizardStep.cs
- XmlCountingReader.cs
- ProcessProtocolHandler.cs
- FileRecordSequence.cs
- DesignBindingPicker.cs
- LocalizableAttribute.cs
- ValidationHelpers.cs
- DockPanel.cs
- PrintDocument.cs
- PixelFormatConverter.cs
- URLMembershipCondition.cs
- DBConnectionString.cs
- FixedDocumentPaginator.cs
- SectionUpdates.cs
- Speller.cs
- BitmapEffectState.cs
- WCFBuildProvider.cs
- MaskedTextBox.cs
- AttachedPropertiesService.cs
- AutoCompleteStringCollection.cs
- COM2PictureConverter.cs
- Transform.cs
- BaseProcessor.cs
- WaitingCursor.cs
- ShimAsPublicXamlType.cs
- GuidelineSet.cs
- ErrorFormatter.cs
- ScrollChrome.cs
- ForEachAction.cs
- AssemblyLoader.cs
- ContractCodeDomInfo.cs
- MenuCommand.cs
- MetadataUtil.cs
- DesignerWidgets.cs
- SamlDoNotCacheCondition.cs
- ParagraphResult.cs
- UnmanagedMemoryStream.cs
- InputLanguageEventArgs.cs