Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / ButtonInternal / RadioButtonStandardAdapter.cs / 1305376 / 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; } } // Dev10 bug 525537 else { layout.checkSize = (int)(layout.checkSize * GetDpiScaleRatio(e.Graphics)); } 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
- TemplateControl.cs
- TagMapCollection.cs
- InputLanguageSource.cs
- SoapSchemaExporter.cs
- XmlLangPropertyAttribute.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- ColorTransformHelper.cs
- EditorZone.cs
- TextElementCollectionHelper.cs
- EasingKeyFrames.cs
- BCLDebug.cs
- HighlightVisual.cs
- TabPanel.cs
- StylusButton.cs
- JsonQNameDataContract.cs
- PrefixHandle.cs
- TextEndOfSegment.cs
- WebPartManagerInternals.cs
- SqlCacheDependency.cs
- EventLogEntryCollection.cs
- FormatSettings.cs
- ImpersonateTokenRef.cs
- HierarchicalDataTemplate.cs
- MulticastIPAddressInformationCollection.cs
- DataGridColumnDropSeparator.cs
- ResourceDescriptionAttribute.cs
- ScriptManagerProxy.cs
- Matrix3DConverter.cs
- TypeUsageBuilder.cs
- WorkflowEnvironment.cs
- BoundingRectTracker.cs
- ProtocolsConfigurationHandler.cs
- MultiBinding.cs
- XmlUrlResolver.cs
- TreeViewImageIndexConverter.cs
- ViewSimplifier.cs
- XsltSettings.cs
- GridViewEditEventArgs.cs
- InvalidOperationException.cs
- SafeProcessHandle.cs
- ExpressionConverter.cs
- Convert.cs
- AutomationProperties.cs
- ValidationResult.cs
- ManifestBasedResourceGroveler.cs
- TimersDescriptionAttribute.cs
- SingleSelectRootGridEntry.cs
- StateManagedCollection.cs
- MediaScriptCommandRoutedEventArgs.cs
- LocalValueEnumerator.cs
- ThrowOnMultipleAssignment.cs
- WizardSideBarListControlItemEventArgs.cs
- ManipulationDevice.cs
- FreezableCollection.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- DataBindingCollectionConverter.cs
- MachineSettingsSection.cs
- GeometryDrawing.cs
- DataErrorValidationRule.cs
- ProjectionPruner.cs
- FileFormatException.cs
- AppDomainAttributes.cs
- RootBuilder.cs
- DataSetMappper.cs
- InvariantComparer.cs
- CodeCompiler.cs
- PageWrapper.cs
- DataBoundLiteralControl.cs
- LoggedException.cs
- ImageListStreamer.cs
- ThreadExceptionDialog.cs
- BrowserTree.cs
- PipelineDeploymentState.cs
- ReflectionTypeLoadException.cs
- Timeline.cs
- SqlDataReaderSmi.cs
- EntityUtil.cs
- LinearGradientBrush.cs
- ToolZone.cs
- SessionSwitchEventArgs.cs
- DecoratedNameAttribute.cs
- AutoResetEvent.cs
- DesignerAdapterAttribute.cs
- XmlEnumAttribute.cs
- BasicHttpMessageCredentialType.cs
- ConfigXmlWhitespace.cs
- ObjectCloneHelper.cs
- WeakReferenceEnumerator.cs
- OwnerDrawPropertyBag.cs
- ServiceConfigurationTraceRecord.cs
- SrgsOneOf.cs
- System.Data.OracleClient_BID.cs
- AsymmetricSignatureFormatter.cs
- ResourceLoader.cs
- SystemTcpStatistics.cs
- versioninfo.cs
- RequestCacheEntry.cs
- FacetDescription.cs
- BookmarkInfo.cs
- StrokeCollection.cs