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
- PolicyManager.cs
- tooltip.cs
- GridViewRowEventArgs.cs
- DataTableReader.cs
- SingleAnimationUsingKeyFrames.cs
- SoapHeaderException.cs
- ExclusiveHandleList.cs
- XPathExpr.cs
- PromptEventArgs.cs
- BaseProcessor.cs
- WebProxyScriptElement.cs
- RemoteWebConfigurationHost.cs
- NodeLabelEditEvent.cs
- NumberFormatInfo.cs
- ScalarConstant.cs
- RelatedImageListAttribute.cs
- ReservationNotFoundException.cs
- TypeForwardedToAttribute.cs
- MachineKeyConverter.cs
- PropertyBuilder.cs
- AssertHelper.cs
- OrderToken.cs
- DropShadowEffect.cs
- NumericUpDownAcceleration.cs
- SecurityResources.cs
- ConstNode.cs
- TypeEnumerableViewSchema.cs
- Vector3DAnimation.cs
- XmlAttributeHolder.cs
- CodeMemberProperty.cs
- DataShape.cs
- CanonicalXml.cs
- ObjectListCommand.cs
- BrushValueSerializer.cs
- DesignerCatalogPartChrome.cs
- CellParaClient.cs
- DataGridViewSortCompareEventArgs.cs
- SessionPageStateSection.cs
- TableLayoutSettingsTypeConverter.cs
- PolyQuadraticBezierSegment.cs
- QueryContext.cs
- ModulesEntry.cs
- ConfigurationValue.cs
- EpmCustomContentWriterNodeData.cs
- Byte.cs
- DictionaryEntry.cs
- FloaterBaseParaClient.cs
- EntityDesignerUtils.cs
- RegexStringValidatorAttribute.cs
- DoubleUtil.cs
- PenContext.cs
- CopyNamespacesAction.cs
- CursorConverter.cs
- XsltException.cs
- Win32.cs
- PathSegment.cs
- SecurityCapabilities.cs
- InvalidComObjectException.cs
- SQLCharsStorage.cs
- TaskCanceledException.cs
- DataGridSortCommandEventArgs.cs
- XmlWriter.cs
- ResourcePart.cs
- ContextQuery.cs
- GroupBox.cs
- ChannelEndpointElementCollection.cs
- SoapSchemaImporter.cs
- CodeChecksumPragma.cs
- FileSystemWatcher.cs
- BuilderInfo.cs
- SourceSwitch.cs
- NamespaceInfo.cs
- CatalogPartCollection.cs
- UserPersonalizationStateInfo.cs
- CompiledQuery.cs
- UDPClient.cs
- NonParentingControl.cs
- figurelengthconverter.cs
- TreeViewItem.cs
- MessageVersion.cs
- OutputCacheModule.cs
- WindowsAltTab.cs
- DbConnectionStringBuilder.cs
- BindingValueChangedEventArgs.cs
- ValidationPropertyAttribute.cs
- DataSourceSelectArguments.cs
- FormattedTextSymbols.cs
- PropertyManager.cs
- MessageDesigner.cs
- MetadataUtil.cs
- MouseGestureValueSerializer.cs
- coordinatorscratchpad.cs
- XmlSchemaObjectCollection.cs
- PermissionToken.cs
- MetadataSet.cs
- ListGeneralPage.cs
- Brush.cs
- MdImport.cs
- AccessorTable.cs
- DataGridHyperlinkColumn.cs