Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- MeshGeometry3D.cs
- CustomLineCap.cs
- TransformerInfoCollection.cs
- ExpandedWrapper.cs
- OracleMonthSpan.cs
- _HeaderInfoTable.cs
- BamlRecords.cs
- Normalizer.cs
- FaultPropagationQuery.cs
- XmlIgnoreAttribute.cs
- CachingHintValidation.cs
- DataGridViewRowCancelEventArgs.cs
- ListViewItem.cs
- TreeNodeBinding.cs
- TreeChangeInfo.cs
- ColorKeyFrameCollection.cs
- AnnotationHelper.cs
- ListViewSortEventArgs.cs
- RemotingConfiguration.cs
- TextBox.cs
- dataSvcMapFileLoader.cs
- ConfigDefinitionUpdates.cs
- DataExpression.cs
- FormatterServices.cs
- QilChoice.cs
- ConfigXmlComment.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- DataGridViewComboBoxCell.cs
- SrgsElementFactoryCompiler.cs
- ObjectQueryExecutionPlan.cs
- SessionStateModule.cs
- MarkupCompilePass1.cs
- CompilerGeneratedAttribute.cs
- SQLDateTime.cs
- TreeViewDesigner.cs
- EventHandlersStore.cs
- LicenseContext.cs
- DynamicValidatorEventArgs.cs
- AmbiguousMatchException.cs
- ClientOptions.cs
- OrderedDictionary.cs
- AppearanceEditorPart.cs
- CryptoHandle.cs
- StateChangeEvent.cs
- XPathScanner.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- IEnumerable.cs
- StateBag.cs
- DataGridViewLinkCell.cs
- ComplexObject.cs
- LinearGradientBrush.cs
- Shape.cs
- SyndicationSerializer.cs
- RenderOptions.cs
- Selection.cs
- CssTextWriter.cs
- RenderDataDrawingContext.cs
- AdjustableArrowCap.cs
- LoginViewDesigner.cs
- HttpListenerContext.cs
- PatternMatcher.cs
- ConversionHelper.cs
- M3DUtil.cs
- CodeComment.cs
- CookieHandler.cs
- DataControlPagerLinkButton.cs
- HttpWriter.cs
- HttpProfileGroupBase.cs
- ListControl.cs
- SecureConversationVersion.cs
- SessionPageStateSection.cs
- COM2TypeInfoProcessor.cs
- DuplicateWaitObjectException.cs
- RouteValueDictionary.cs
- SqlConnectionString.cs
- CalendarKeyboardHelper.cs
- UnsafeNativeMethodsMilCoreApi.cs
- CurrencyManager.cs
- CodeDomDesignerLoader.cs
- ObjectQueryProvider.cs
- ProcessInfo.cs
- RelOps.cs
- AxHost.cs
- Vector3DAnimationBase.cs
- PropertyValueChangedEvent.cs
- StylusPointProperties.cs
- CryptoConfig.cs
- DataSourceGeneratorException.cs
- XamlInt32CollectionSerializer.cs
- LabelLiteral.cs
- ApplicationCommands.cs
- GetUserPreferenceRequest.cs
- TextTabProperties.cs
- PaintEvent.cs
- ExtendedTransformFactory.cs
- ConnectionStringSettings.cs
- BulletChrome.cs
- Positioning.cs
- DeviceContext.cs
- CriticalExceptions.cs