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 / 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
- DataGridComboBoxColumn.cs
- LifetimeServices.cs
- GeometryModel3D.cs
- RecommendedAsConfigurableAttribute.cs
- GridViewSortEventArgs.cs
- DynamicResourceExtensionConverter.cs
- MouseDevice.cs
- ItemList.cs
- NavigationPropertyEmitter.cs
- PersianCalendar.cs
- DataServiceConfiguration.cs
- MenuRendererClassic.cs
- XmlValidatingReaderImpl.cs
- DbParameterHelper.cs
- InputBinding.cs
- CommentEmitter.cs
- PeerServiceMessageContracts.cs
- GlobalizationAssembly.cs
- CorruptStoreException.cs
- ADMembershipUser.cs
- InitializationEventAttribute.cs
- StructuredProperty.cs
- WebSysDefaultValueAttribute.cs
- HandlerWithFactory.cs
- DataTableReader.cs
- CertificateManager.cs
- GetCertificateRequest.cs
- NetworkStream.cs
- BooleanStorage.cs
- InfiniteTimeSpanConverter.cs
- SqlTypeSystemProvider.cs
- FlowSwitch.cs
- SkewTransform.cs
- Selection.cs
- SafeHandles.cs
- PrtTicket_Public_Simple.cs
- HttpListenerContext.cs
- InputMethodStateChangeEventArgs.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- HttpCachePolicyElement.cs
- Section.cs
- DataViewManagerListItemTypeDescriptor.cs
- DispatcherHooks.cs
- Compiler.cs
- ZipIOExtraFieldZip64Element.cs
- XmlIlGenerator.cs
- ServiceEndpointCollection.cs
- XsdCachingReader.cs
- selecteditemcollection.cs
- PersonalizationStateQuery.cs
- BaseValidator.cs
- HandledMouseEvent.cs
- MembershipSection.cs
- PrinterUnitConvert.cs
- WeakKeyDictionary.cs
- TextTreeRootTextBlock.cs
- RemotingAttributes.cs
- ProfileEventArgs.cs
- MenuItem.cs
- RequestCachePolicy.cs
- InkPresenter.cs
- Keywords.cs
- SerialStream.cs
- CaseInsensitiveHashCodeProvider.cs
- BindingFormattingDialog.cs
- DataGridViewCellEventArgs.cs
- BamlRecordHelper.cs
- SqlStatistics.cs
- MultiplexingDispatchMessageFormatter.cs
- ListenerAdapterBase.cs
- DataGridRow.cs
- FrameworkElementAutomationPeer.cs
- NaturalLanguageHyphenator.cs
- SqlDataSourceCommandParser.cs
- SerialPort.cs
- FlowDocumentScrollViewer.cs
- OracleDataReader.cs
- GridViewRowPresenterBase.cs
- PerformanceCounterManager.cs
- TabControlEvent.cs
- QuerySafeNavigator.cs
- MemberRelationshipService.cs
- SettingsPropertyCollection.cs
- UpWmlPageAdapter.cs
- QuaternionRotation3D.cs
- ObfuscateAssemblyAttribute.cs
- SecurityKeyIdentifier.cs
- OleDbTransaction.cs
- PrimitiveCodeDomSerializer.cs
- UserValidatedEventArgs.cs
- CharEntityEncoderFallback.cs
- HealthMonitoringSectionHelper.cs
- ResXFileRef.cs
- GetIndexBinder.cs
- ExtensionSurface.cs
- XPathBinder.cs
- ProfileProvider.cs
- TextModifier.cs
- CachedBitmap.cs
- Exceptions.cs