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
- CodeTypeReferenceExpression.cs
- CodePageUtils.cs
- RepeatInfo.cs
- ContainerSelectorActiveEvent.cs
- BitmapSource.cs
- SecureConversationServiceCredential.cs
- ActiveXContainer.cs
- DependsOnAttribute.cs
- ChannelManager.cs
- ObjectTokenCategory.cs
- DPAPIProtectedConfigurationProvider.cs
- HideDisabledControlAdapter.cs
- HttpRuntimeSection.cs
- PermissionSet.cs
- QueryProcessor.cs
- WindowsFormsLinkLabel.cs
- BindingOperations.cs
- DataGridRow.cs
- InputMethodStateTypeInfo.cs
- ECDiffieHellmanCngPublicKey.cs
- DataGridItem.cs
- basecomparevalidator.cs
- ScriptingWebServicesSectionGroup.cs
- DataBinder.cs
- DocumentGridPage.cs
- DocumentOrderQuery.cs
- ListBindableAttribute.cs
- XmlSerializerFactory.cs
- DesignerAttribute.cs
- _DigestClient.cs
- HtmlCalendarAdapter.cs
- EntitySetDataBindingList.cs
- MessageSecurityOverTcp.cs
- Helper.cs
- StringUtil.cs
- KoreanCalendar.cs
- IItemProperties.cs
- ListControlStringCollectionEditor.cs
- WebPartCatalogAddVerb.cs
- ClientConfigurationSystem.cs
- TraceUtils.cs
- SliderAutomationPeer.cs
- Vars.cs
- WorkflowApplicationEventArgs.cs
- XPathNavigatorReader.cs
- XmlSerializationReader.cs
- PackageDigitalSignature.cs
- MenuStrip.cs
- StatusBarDesigner.cs
- httpserverutility.cs
- RouteData.cs
- Propagator.ExtentPlaceholderCreator.cs
- MouseGestureValueSerializer.cs
- DesignConnection.cs
- XmlSecureResolver.cs
- InkPresenterAutomationPeer.cs
- QilSortKey.cs
- RequestQueue.cs
- SingleTagSectionHandler.cs
- ConfigUtil.cs
- RunWorkerCompletedEventArgs.cs
- KnowledgeBase.cs
- TextTreeTextNode.cs
- RelationshipEnd.cs
- CompressionTransform.cs
- GridViewColumnCollection.cs
- ParentQuery.cs
- ListItemCollection.cs
- DateTimeSerializationSection.cs
- PerspectiveCamera.cs
- EventLog.cs
- oledbmetadatacolumnnames.cs
- DocumentXmlWriter.cs
- ControllableStoryboardAction.cs
- SafeFindHandle.cs
- RegexRunnerFactory.cs
- TaiwanCalendar.cs
- MdiWindowListStrip.cs
- ParameterToken.cs
- RandomNumberGenerator.cs
- AbandonedMutexException.cs
- Helpers.cs
- StructuralCache.cs
- PngBitmapDecoder.cs
- Socket.cs
- MsmqReceiveParameters.cs
- BaseContextMenu.cs
- IsolatedStoragePermission.cs
- WindowsBrush.cs
- ComponentManagerBroker.cs
- UrlMappingsSection.cs
- HandoffBehavior.cs
- LayoutDump.cs
- Model3DGroup.cs
- EmptyControlCollection.cs
- DesignerSerializerAttribute.cs
- DataGridSortCommandEventArgs.cs
- InfoCardClaimCollection.cs
- SignatureHelper.cs
- StringDictionary.cs