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
- ToolStripScrollButton.cs
- FunctionDetailsReader.cs
- DBSqlParserTable.cs
- TreeNode.cs
- CodePageUtils.cs
- TextFormatterHost.cs
- WindowsSidIdentity.cs
- ThemeInfoAttribute.cs
- COM2PictureConverter.cs
- ProxyGenerator.cs
- ReferencedCollectionType.cs
- FilteredDataSetHelper.cs
- SwitchElementsCollection.cs
- HealthMonitoringSection.cs
- DataColumnMapping.cs
- CodeSubDirectory.cs
- PenThreadWorker.cs
- SoapExtensionTypeElement.cs
- ResolveMatchesMessage11.cs
- DataGridViewBindingCompleteEventArgs.cs
- ViewRendering.cs
- xamlnodes.cs
- SinglePhaseEnlistment.cs
- ListItemDetailViewAttribute.cs
- RadioButtonPopupAdapter.cs
- AnimatedTypeHelpers.cs
- ByteConverter.cs
- CalendarAutoFormatDialog.cs
- TextRangeEdit.cs
- Pair.cs
- FormsIdentity.cs
- List.cs
- DateRangeEvent.cs
- XmlDocumentFragment.cs
- ThreadAttributes.cs
- TextElementEnumerator.cs
- CompiledRegexRunner.cs
- TdsParserStaticMethods.cs
- GradientPanel.cs
- NotifyInputEventArgs.cs
- LineProperties.cs
- DataServiceKeyAttribute.cs
- HtmlTableRowCollection.cs
- ChannelManager.cs
- ShapeTypeface.cs
- SqlEnums.cs
- DBCommand.cs
- querybuilder.cs
- NativeDirectoryServicesQueryAPIs.cs
- XmlUtil.cs
- NotificationContext.cs
- LogExtent.cs
- ApplicationCommands.cs
- CodeDirectoryCompiler.cs
- CodeSubDirectoriesCollection.cs
- ListViewInsertionMark.cs
- XmlAtomicValue.cs
- Char.cs
- SecondaryIndexDefinition.cs
- KeyPullup.cs
- LinearGradientBrush.cs
- SystemWebSectionGroup.cs
- WebBrowserDocumentCompletedEventHandler.cs
- XmlSubtreeReader.cs
- DataKeyPropertyAttribute.cs
- ResourcesGenerator.cs
- AssemblyNameProxy.cs
- SerializationObjectManager.cs
- ExtensionDataReader.cs
- WS2007FederationHttpBinding.cs
- DSASignatureFormatter.cs
- DecoratedNameAttribute.cs
- Visual3DCollection.cs
- ListSourceHelper.cs
- ConfigurationValidatorBase.cs
- DecimalAnimationUsingKeyFrames.cs
- DispatchChannelSink.cs
- Encoder.cs
- SoapAttributes.cs
- PrintDialog.cs
- StackOverflowException.cs
- PickDesigner.xaml.cs
- Journaling.cs
- AppSecurityManager.cs
- FilteredXmlReader.cs
- PathData.cs
- MessageLogger.cs
- Journal.cs
- StagingAreaInputItem.cs
- UseLicense.cs
- PrinterUnitConvert.cs
- FontUnitConverter.cs
- MemberRelationshipService.cs
- BamlWriter.cs
- ContextStaticAttribute.cs
- DockPatternIdentifiers.cs
- Win32SafeHandles.cs
- ButtonBaseAdapter.cs
- ImageResources.Designer.cs
- ToolboxComponentsCreatingEventArgs.cs