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
- NodeInfo.cs
- PageParser.cs
- CoreSwitches.cs
- UnmanagedMemoryStream.cs
- ProvidersHelper.cs
- ReadOnlyMetadataCollection.cs
- EventPropertyMap.cs
- GridView.cs
- ProxyWebPartManager.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- HttpRequest.cs
- DocumentScope.cs
- ObjectTag.cs
- CreateInstanceBinder.cs
- PointValueSerializer.cs
- TextElementEnumerator.cs
- DataServicePagingProviderWrapper.cs
- HostProtectionPermission.cs
- Walker.cs
- XmlCharType.cs
- UrlPath.cs
- RightsManagementInformation.cs
- InvalidWMPVersionException.cs
- SourceChangedEventArgs.cs
- Configuration.cs
- SpeechRecognizer.cs
- ScaleTransform3D.cs
- ControlValuePropertyAttribute.cs
- RegexRunnerFactory.cs
- MouseCaptureWithinProperty.cs
- PassportAuthentication.cs
- HttpInputStream.cs
- PixelFormat.cs
- invalidudtexception.cs
- SessionSwitchEventArgs.cs
- ShaperBuffers.cs
- RandomDelaySendsAsyncResult.cs
- UrlAuthFailedErrorFormatter.cs
- SqlCacheDependencySection.cs
- CodeTypeReferenceSerializer.cs
- FileUtil.cs
- CellLabel.cs
- WindowHideOrCloseTracker.cs
- Regex.cs
- XmlDomTextWriter.cs
- XmlNamespaceMappingCollection.cs
- OdbcConnectionStringbuilder.cs
- SharedPersonalizationStateInfo.cs
- WindowsListViewScroll.cs
- StrokeRenderer.cs
- NameValueFileSectionHandler.cs
- SynchronizedMessageSource.cs
- GetLedgerRequest.cs
- ByteAnimationUsingKeyFrames.cs
- RelationshipConverter.cs
- StrokeRenderer.cs
- FixedTextBuilder.cs
- Italic.cs
- StylusPointCollection.cs
- Marshal.cs
- counter.cs
- ScrollBarRenderer.cs
- Frame.cs
- EditingMode.cs
- DependencyPropertyKind.cs
- GuidelineSet.cs
- TypeDescriptor.cs
- ControlAdapter.cs
- ServiceBusyException.cs
- Symbol.cs
- PropertyCollection.cs
- Calendar.cs
- StandardCommands.cs
- BulletedList.cs
- GeneralTransformGroup.cs
- SystemInfo.cs
- Configuration.cs
- DataMisalignedException.cs
- ToolStripComboBox.cs
- CharAnimationUsingKeyFrames.cs
- XmlSchemaComplexContentRestriction.cs
- ButtonChrome.cs
- AmbientLight.cs
- XmlSchemaIdentityConstraint.cs
- NativeMethods.cs
- HtmlElementCollection.cs
- XPathPatternParser.cs
- AssemblyInfo.cs
- TextEffect.cs
- SingleAnimationUsingKeyFrames.cs
- XmlStringTable.cs
- PersonalizableAttribute.cs
- AppLevelCompilationSectionCache.cs
- SrgsToken.cs
- DataPagerField.cs
- RemotingAttributes.cs
- ReliableSessionElement.cs
- RegexNode.cs
- DoubleCollection.cs
- Bitmap.cs