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 / RadioButtonStandardAdapter.cs / 1 / RadioButtonStandardAdapter.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 RadioButtonStandardAdapter : RadioButtonBaseAdapter { internal RadioButtonStandardAdapter(ButtonBase control) : base(control) {} internal override void PaintUp(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBox(e, layout); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } private new ButtonStandardAdapter ButtonAdapter { get { return ((ButtonStandardAdapter)base.ButtonAdapter); } } protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonStandardAdapter(Control); } #region Temp protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = CommonLayout(); layout.hintTextUp = false; layout.everettButtonCompat = !Application.RenderWithVisualStyles; // VSWhidbey 420870 if (Application.RenderWithVisualStyles) { using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics()) { layout.checkSize = RadioButtonRenderer.GetGlyphSize(g, RadioButtonRenderer.ConvertFromButtonState(GetState(), Control.MouseIsOver)).Width; } } 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 RadioButtonStandardAdapter : RadioButtonBaseAdapter { internal RadioButtonStandardAdapter(ButtonBase control) : base(control) {} internal override void PaintUp(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBox(e, layout); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } private new ButtonStandardAdapter ButtonAdapter { get { return ((ButtonStandardAdapter)base.ButtonAdapter); } } protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonStandardAdapter(Control); } #region Temp protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = CommonLayout(); layout.hintTextUp = false; layout.everettButtonCompat = !Application.RenderWithVisualStyles; // VSWhidbey 420870 if (Application.RenderWithVisualStyles) { using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics()) { layout.checkSize = RadioButtonRenderer.GetGlyphSize(g, RadioButtonRenderer.ConvertFromButtonState(GetState(), Control.MouseIsOver)).Width; } } 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
- DataControlField.cs
- PropertyEmitter.cs
- TypedCompletedAsyncResult.cs
- ObjectQueryExecutionPlan.cs
- ConsumerConnectionPoint.cs
- UIElementParagraph.cs
- Perspective.cs
- AssemblyAttributesGoHere.cs
- InputProviderSite.cs
- BoundColumn.cs
- ParseChildrenAsPropertiesAttribute.cs
- ProcessHostServerConfig.cs
- StorageAssociationSetMapping.cs
- DataKeyCollection.cs
- XmlSchemaSimpleContent.cs
- ConfigXmlComment.cs
- SaveFileDialog.cs
- StoryFragments.cs
- sqlpipe.cs
- OdbcFactory.cs
- SignedPkcs7.cs
- CodeTypeReferenceCollection.cs
- cookie.cs
- OdbcFactory.cs
- HwndMouseInputProvider.cs
- FormViewInsertedEventArgs.cs
- Decimal.cs
- WindowInteropHelper.cs
- CultureSpecificCharacterBufferRange.cs
- CustomValidator.cs
- ScrollEventArgs.cs
- ObjectItemConventionAssemblyLoader.cs
- ViewValidator.cs
- MergeFilterQuery.cs
- TabletCollection.cs
- HttpGetProtocolImporter.cs
- BamlMapTable.cs
- CompModHelpers.cs
- WebPartCancelEventArgs.cs
- PropertyPath.cs
- SafeBitVector32.cs
- ElementHost.cs
- WpfGeneratedKnownProperties.cs
- NativeRecognizer.cs
- FileDialogCustomPlacesCollection.cs
- TextBox.cs
- WebColorConverter.cs
- GeometryModel3D.cs
- ProxyWebPart.cs
- SqlTypesSchemaImporter.cs
- ExpanderAutomationPeer.cs
- TrackingServices.cs
- CharacterBufferReference.cs
- mda.cs
- AbstractDataSvcMapFileLoader.cs
- MetadataItemCollectionFactory.cs
- SpellerHighlightLayer.cs
- HttpRawResponse.cs
- GrammarBuilderRuleRef.cs
- ViewSimplifier.cs
- Mouse.cs
- ProxyWebPartManagerDesigner.cs
- DataServiceExpressionVisitor.cs
- HitTestFilterBehavior.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- ThousandthOfEmRealDoubles.cs
- GenericIdentity.cs
- XmlDocumentSerializer.cs
- DiscoveryEndpoint.cs
- CompiledELinqQueryState.cs
- PrintingPermission.cs
- WrapPanel.cs
- MainMenu.cs
- WebHttpBindingCollectionElement.cs
- DataReaderContainer.cs
- WebServiceTypeData.cs
- CodeDirectiveCollection.cs
- HandlerBase.cs
- HandlerBase.cs
- AttributeEmitter.cs
- VerificationException.cs
- CompensationTokenData.cs
- SiteMapNodeItemEventArgs.cs
- RegexGroupCollection.cs
- EdmProperty.cs
- Point3D.cs
- FlowDocumentPageViewerAutomationPeer.cs
- SHA384.cs
- selecteditemcollection.cs
- ProgressBarBrushConverter.cs
- TextEditorMouse.cs
- CacheRequest.cs
- _NestedSingleAsyncResult.cs
- BamlLocalizableResource.cs
- dsa.cs
- TemplateInstanceAttribute.cs
- DirectoryGroupQuery.cs
- PolyBezierSegment.cs
- SigningCredentials.cs
- WebBrowser.cs