Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // //----------------------------------------------------------------------------- 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Triangle.cs
- IResourceProvider.cs
- _NtlmClient.cs
- CorrelationValidator.cs
- GridItem.cs
- LocationSectionRecord.cs
- ScriptReferenceBase.cs
- TripleDESCryptoServiceProvider.cs
- MembershipSection.cs
- StringHandle.cs
- DataGridViewTopRowAccessibleObject.cs
- Panel.cs
- TextCompositionEventArgs.cs
- ComEventsHelper.cs
- MarkupObject.cs
- ServicePoint.cs
- Positioning.cs
- Inline.cs
- DisplayMemberTemplateSelector.cs
- X500Name.cs
- DocumentPageViewAutomationPeer.cs
- RouteUrlExpressionBuilder.cs
- ToolStripSettings.cs
- MetadataProperty.cs
- HandledEventArgs.cs
- Memoizer.cs
- QuaternionRotation3D.cs
- DiscoveryClientDuplexChannel.cs
- URL.cs
- StrongName.cs
- WinEventHandler.cs
- DataSourceControl.cs
- PauseStoryboard.cs
- QueryComponents.cs
- MetadataSerializer.cs
- remotingproxy.cs
- GCHandleCookieTable.cs
- UpdatableGenericsFeature.cs
- GridViewColumnHeaderAutomationPeer.cs
- MultiAsyncResult.cs
- DataListItem.cs
- CounterCreationDataCollection.cs
- AssemblyGen.cs
- Logging.cs
- MatchNoneMessageFilter.cs
- FlowDocumentView.cs
- WebPartEditorOkVerb.cs
- FixUpCollection.cs
- NumericUpDown.cs
- IDataContractSurrogate.cs
- DataGrid.cs
- QueryOptionExpression.cs
- MouseActionConverter.cs
- PropertyChangedEventArgs.cs
- ComplexLine.cs
- SqlCacheDependency.cs
- WebSysDescriptionAttribute.cs
- AnnotationDocumentPaginator.cs
- ReferencedAssembly.cs
- UnitySerializationHolder.cs
- NamespaceDisplay.xaml.cs
- DocobjHost.cs
- DataServiceEntityAttribute.cs
- CachedFontFamily.cs
- HMACSHA1.cs
- ConfigurationStrings.cs
- XmlAnyElementAttribute.cs
- CodeExpressionCollection.cs
- GridSplitterAutomationPeer.cs
- OleDbPermission.cs
- ApplicationInfo.cs
- BinHexEncoder.cs
- PrintPageEvent.cs
- CodePrimitiveExpression.cs
- TrackingMemoryStreamFactory.cs
- GcSettings.cs
- BinaryFormatterSinks.cs
- SelectionProcessor.cs
- TextProperties.cs
- selecteditemcollection.cs
- WindowsRebar.cs
- PropertyNames.cs
- ApplicationHost.cs
- DependencySource.cs
- CornerRadiusConverter.cs
- AuthenticationSection.cs
- _SslSessionsCache.cs
- PermissionToken.cs
- DataStreams.cs
- TabletDevice.cs
- InputLanguage.cs
- CurrentTimeZone.cs
- FormatterServices.cs
- CDSsyncETWBCLProvider.cs
- ClientSession.cs
- DbDataSourceEnumerator.cs
- IgnorePropertiesAttribute.cs
- RegexCode.cs
- PatternMatchRules.cs
- DNS.cs