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
- CheckBox.cs
- ConfigurationStrings.cs
- StrongName.cs
- DocumentViewerAutomationPeer.cs
- SecurityState.cs
- Matrix.cs
- DataError.cs
- ZipIOLocalFileDataDescriptor.cs
- RuntimeHelpers.cs
- XMLDiffLoader.cs
- SerialReceived.cs
- AutomationElementCollection.cs
- ActivityExecutionContextCollection.cs
- OutputCacheSettings.cs
- BadImageFormatException.cs
- CultureTable.cs
- TaskScheduler.cs
- SqlDelegatedTransaction.cs
- GridViewUpdatedEventArgs.cs
- GeneratedCodeAttribute.cs
- ScaleTransform3D.cs
- SqlDataSourceSelectingEventArgs.cs
- HttpListenerElement.cs
- ListViewTableRow.cs
- PagePropertiesChangingEventArgs.cs
- ColorAnimation.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- AddIn.cs
- Compiler.cs
- ServiceBehaviorAttribute.cs
- GcHandle.cs
- SchemaCreator.cs
- AssemblyBuilder.cs
- DataList.cs
- QualifiedCellIdBoolean.cs
- FragmentNavigationEventArgs.cs
- RegistryPermission.cs
- UpdatePanelTriggerCollection.cs
- DependencyObject.cs
- AccessDataSource.cs
- Italic.cs
- SqlVersion.cs
- UIntPtr.cs
- HttpProxyCredentialType.cs
- DataGridTablesFactory.cs
- AddInEnvironment.cs
- WindowCollection.cs
- SmiEventSink_DeferedProcessing.cs
- PropertySourceInfo.cs
- HttpsTransportElement.cs
- WindowsStartMenu.cs
- ZipIOLocalFileBlock.cs
- RelationshipNavigation.cs
- DbExpressionRules.cs
- SQLResource.cs
- TreeView.cs
- TextDecorationCollection.cs
- Hash.cs
- DropSource.cs
- ipaddressinformationcollection.cs
- X509Certificate2Collection.cs
- DbDataReader.cs
- ValidationHelper.cs
- ImageDrawing.cs
- RawStylusInputCustomData.cs
- HitTestDrawingContextWalker.cs
- InvalidOleVariantTypeException.cs
- DependentTransaction.cs
- CustomWebEventKey.cs
- CollectionView.cs
- SqlProcedureAttribute.cs
- BinHexEncoder.cs
- future.cs
- DateTimeFormatInfoScanner.cs
- Nodes.cs
- XmlAttributeAttribute.cs
- InteropEnvironment.cs
- OdbcConnection.cs
- ProxyHwnd.cs
- Action.cs
- Matrix.cs
- OfTypeExpression.cs
- Point3D.cs
- AccessControlEntry.cs
- Single.cs
- StrokeFIndices.cs
- XsdBuilder.cs
- MatrixAnimationUsingKeyFrames.cs
- CompositionDesigner.cs
- ObjectStateEntryDbDataRecord.cs
- CheckBoxStandardAdapter.cs
- Axis.cs
- DirectoryInfo.cs
- RangeBase.cs
- ResourceAttributes.cs
- AccessDataSourceWizardForm.cs
- PeerNameResolver.cs
- FakeModelItemImpl.cs
- ChameleonKey.cs
- WeakEventTable.cs