Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- Geometry3D.cs
- ComponentEditorPage.cs
- RecognizedWordUnit.cs
- IconBitmapDecoder.cs
- ConstraintEnumerator.cs
- LocalizedNameDescriptionPair.cs
- SmuggledIUnknown.cs
- HistoryEventArgs.cs
- DispatcherTimer.cs
- EmptyEnumerable.cs
- HelpInfo.cs
- FrameworkRichTextComposition.cs
- ColorAnimationBase.cs
- CollectionViewGroupRoot.cs
- Application.cs
- ApplicationGesture.cs
- ParentQuery.cs
- FieldNameLookup.cs
- StreamAsIStream.cs
- StyleXamlParser.cs
- PrivacyNoticeBindingElement.cs
- ServerValidateEventArgs.cs
- HttpTransportElement.cs
- XmlDictionaryReaderQuotasElement.cs
- DataContractSet.cs
- SettingsSection.cs
- SrgsDocument.cs
- GraphicsContext.cs
- BaseTemplateBuildProvider.cs
- MethodCallConverter.cs
- RbTree.cs
- DataGridTable.cs
- CodeDirectionExpression.cs
- RecipientServiceModelSecurityTokenRequirement.cs
- FixedSOMElement.cs
- DbConnectionInternal.cs
- DataControlHelper.cs
- DataAdapter.cs
- GPPOINT.cs
- TextElement.cs
- AutomationElement.cs
- ExecutedRoutedEventArgs.cs
- ZipIOFileItemStream.cs
- SQLString.cs
- PolicyLevel.cs
- GZipStream.cs
- DSASignatureDeformatter.cs
- XmlSchemaProviderAttribute.cs
- Comparer.cs
- AndMessageFilterTable.cs
- DesigntimeLicenseContextSerializer.cs
- DataControlImageButton.cs
- Substitution.cs
- PartitionedDataSource.cs
- HatchBrush.cs
- PolyLineSegment.cs
- ConfigurationConverterBase.cs
- GenerateHelper.cs
- ThousandthOfEmRealDoubles.cs
- CrossAppDomainChannel.cs
- BitmapFrameEncode.cs
- EvidenceBase.cs
- RtfControls.cs
- UnmanagedMemoryStreamWrapper.cs
- OverrideMode.cs
- ReceiveActivityDesigner.cs
- ColorDialog.cs
- BasicExpressionVisitor.cs
- DeviceSpecificChoiceCollection.cs
- GenerateTemporaryTargetAssembly.cs
- ValidationSettings.cs
- ControlBuilder.cs
- PermissionToken.cs
- SmtpDigestAuthenticationModule.cs
- CircleEase.cs
- RichTextBoxAutomationPeer.cs
- Matrix3DConverter.cs
- QueueProcessor.cs
- OdbcParameter.cs
- UserValidatedEventArgs.cs
- DoubleAnimationClockResource.cs
- XmlCharCheckingReader.cs
- PrintDialogException.cs
- Button.cs
- OdbcException.cs
- AttributeConverter.cs
- ErrorInfoXmlDocument.cs
- XmlSchemaProviderAttribute.cs
- EntityParameter.cs
- ComPlusTypeValidator.cs
- AssemblyBuilderData.cs
- ColorContext.cs
- DBNull.cs
- ExtendedProperty.cs
- TcpConnectionPoolSettings.cs
- QilGeneratorEnv.cs
- CookieParameter.cs
- CodeGenerator.cs
- RefType.cs
- KerberosSecurityTokenProvider.cs