Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ //// 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
- ReliableOutputConnection.cs
- CheckBoxRenderer.cs
- RadioButtonBaseAdapter.cs
- ContextStack.cs
- TreeViewAutomationPeer.cs
- FontWeights.cs
- PublisherMembershipCondition.cs
- DataControlFieldCell.cs
- OutgoingWebRequestContext.cs
- ColorAnimationUsingKeyFrames.cs
- BaseValidator.cs
- CfgArc.cs
- HttpCachePolicy.cs
- HandlerMappingMemo.cs
- TextMessageEncodingElement.cs
- SafeBitVector32.cs
- ChangeConflicts.cs
- InstanceLockQueryResult.cs
- EditorBrowsableAttribute.cs
- SelectedDatesCollection.cs
- DataGridSortCommandEventArgs.cs
- WindowsPrincipal.cs
- ColorMap.cs
- PublishLicense.cs
- TypeToken.cs
- PrivilegeNotHeldException.cs
- ColorAnimation.cs
- JpegBitmapEncoder.cs
- ChildTable.cs
- XpsFilter.cs
- SqlHelper.cs
- MailAddressCollection.cs
- ProtocolsConfigurationHandler.cs
- ConfigPathUtility.cs
- SqlDependencyListener.cs
- BamlTreeUpdater.cs
- ScriptManagerProxy.cs
- EditingCommands.cs
- BaseProcessProtocolHandler.cs
- Literal.cs
- TypeResolver.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- oledbconnectionstring.cs
- EventsTab.cs
- FileStream.cs
- EdmRelationshipRoleAttribute.cs
- SectionVisual.cs
- PrimitiveDataContract.cs
- GatewayIPAddressInformationCollection.cs
- StyleSheetComponentEditor.cs
- PrimitiveCodeDomSerializer.cs
- ReceiveErrorHandling.cs
- SettingsPropertyWrongTypeException.cs
- RectangleHotSpot.cs
- FixedSOMSemanticBox.cs
- ToolboxItemCollection.cs
- DataObjectCopyingEventArgs.cs
- EdmValidator.cs
- SharedConnectionListener.cs
- ListViewGroup.cs
- View.cs
- ClassData.cs
- ViewManager.cs
- PolyQuadraticBezierSegment.cs
- NetPipeSectionData.cs
- autovalidator.cs
- MimeFormReflector.cs
- ReadWriteObjectLock.cs
- RegexCapture.cs
- RenderContext.cs
- Separator.cs
- LeafCellTreeNode.cs
- StateBag.cs
- EntityReference.cs
- SoapClientMessage.cs
- PeerNameRecordCollection.cs
- DrawingCollection.cs
- ModifierKeysConverter.cs
- XmlQueryOutput.cs
- XmlSchemaSimpleContent.cs
- MultiTargetingUtil.cs
- PassportAuthentication.cs
- PermissionSetTriple.cs
- SqlBuilder.cs
- HtmlTitle.cs
- _SpnDictionary.cs
- login.cs
- CaseCqlBlock.cs
- HashHelper.cs
- MsmqElementBase.cs
- ExtensionFile.cs
- WebPartManagerInternals.cs
- FormatConvertedBitmap.cs
- PasswordTextNavigator.cs
- Int32Converter.cs
- StrokeNodeEnumerator.cs
- HtmlHead.cs
- XPathBinder.cs
- TerminatorSinks.cs
- StringStorage.cs