Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / ButtonInternal / RadioButtonPopupAdapter.cs / 1305376 / 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
- BrowserCapabilitiesFactoryBase.cs
- ActiveDocumentEvent.cs
- ImageBrush.cs
- TrackingDataItem.cs
- PolyQuadraticBezierSegment.cs
- ELinqQueryState.cs
- GroupBoxRenderer.cs
- ExtenderControl.cs
- QilPatternVisitor.cs
- XmlSchemaSimpleContentRestriction.cs
- CodeDelegateInvokeExpression.cs
- GroupQuery.cs
- WebConfigurationHostFileChange.cs
- BufferedReadStream.cs
- _CookieModule.cs
- ISFTagAndGuidCache.cs
- ClientUtils.cs
- Attributes.cs
- ModelTreeEnumerator.cs
- DataGridViewCellStyle.cs
- XslCompiledTransform.cs
- UrlMapping.cs
- Brushes.cs
- OleDbParameterCollection.cs
- Camera.cs
- DesigntimeLicenseContext.cs
- StringSorter.cs
- XmlLinkedNode.cs
- DeviceContext2.cs
- CheckBoxAutomationPeer.cs
- EarlyBoundInfo.cs
- TextHidden.cs
- Model3DCollection.cs
- CSharpCodeProvider.cs
- ServiceInstallComponent.cs
- Menu.cs
- StorageConditionPropertyMapping.cs
- FormattedText.cs
- SchemaName.cs
- PerformanceCounterLib.cs
- KeyFrames.cs
- XmlWrappingReader.cs
- ResourceManager.cs
- ToolStripLocationCancelEventArgs.cs
- XmlHierarchicalEnumerable.cs
- DesignerAutoFormatStyle.cs
- SolidColorBrush.cs
- COM2EnumConverter.cs
- SystemColors.cs
- MsmqBindingMonitor.cs
- GregorianCalendar.cs
- ListManagerBindingsCollection.cs
- PrivilegeNotHeldException.cs
- ScriptManagerProxy.cs
- ParallelRangeManager.cs
- MemberRelationshipService.cs
- PrintPageEvent.cs
- ForeignKeyConstraint.cs
- AccessViolationException.cs
- OleDbFactory.cs
- ProxyManager.cs
- DoWorkEventArgs.cs
- TypeNameConverter.cs
- MemberDescriptor.cs
- SiteMapPath.cs
- OdbcConnectionHandle.cs
- EventLogEntry.cs
- SafeEventLogWriteHandle.cs
- ModuleBuilder.cs
- TableAutomationPeer.cs
- AssemblyAttributes.cs
- NetworkStream.cs
- ExternalException.cs
- QueryStringHandler.cs
- RowParagraph.cs
- BamlResourceContent.cs
- Style.cs
- HMACSHA256.cs
- _SingleItemRequestCache.cs
- Interlocked.cs
- XmlAtomErrorReader.cs
- AssociationType.cs
- EllipseGeometry.cs
- StructuredType.cs
- BinHexEncoder.cs
- DocumentReference.cs
- InputLanguageProfileNotifySink.cs
- UriParserTemplates.cs
- ExtenderProvidedPropertyAttribute.cs
- SmiSettersStream.cs
- ScrollableControl.cs
- EventSinkHelperWriter.cs
- ConfigXmlText.cs
- EventMappingSettingsCollection.cs
- EnterpriseServicesHelper.cs
- DocumentXPathNavigator.cs
- ComponentEditorPage.cs
- MobileUITypeEditor.cs
- JapaneseLunisolarCalendar.cs
- PersonalizationAdministration.cs