Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- DbCommandTree.cs
- TypeUnloadedException.cs
- XPathNavigatorKeyComparer.cs
- ArraySet.cs
- ConnectionManager.cs
- SqlTransaction.cs
- SingleTagSectionHandler.cs
- CompositeFontFamily.cs
- Polygon.cs
- Serializer.cs
- ConcurrencyMode.cs
- XmlEncoding.cs
- SqlRecordBuffer.cs
- TypeDelegator.cs
- ResourceAssociationSet.cs
- HttpException.cs
- FileAuthorizationModule.cs
- CompilerInfo.cs
- TemplateControlParser.cs
- DataViewSettingCollection.cs
- ToolBarOverflowPanel.cs
- ToolStripArrowRenderEventArgs.cs
- EffectiveValueEntry.cs
- WorkflowServiceAttributes.cs
- DateTimeValueSerializerContext.cs
- Helper.cs
- PipelineModuleStepContainer.cs
- DisposableCollectionWrapper.cs
- EnumerableRowCollectionExtensions.cs
- CodeExporter.cs
- ClosableStream.cs
- NegotiationTokenAuthenticator.cs
- XmlUtf8RawTextWriter.cs
- InfoCardTrace.cs
- VectorCollection.cs
- VideoDrawing.cs
- ProfileSettings.cs
- EventLogPermissionAttribute.cs
- ProcessHostConfigUtils.cs
- PersonalizationProviderHelper.cs
- DesignerLoader.cs
- XPathNodePointer.cs
- HtmlFormWrapper.cs
- CreateUserWizardStep.cs
- Visual3D.cs
- HtmlUtf8RawTextWriter.cs
- RNGCryptoServiceProvider.cs
- DateTimeUtil.cs
- CfgArc.cs
- XmlILIndex.cs
- SoapTypeAttribute.cs
- DiagnosticEventProvider.cs
- OrderByBuilder.cs
- IDReferencePropertyAttribute.cs
- TransportDefaults.cs
- SendSecurityHeader.cs
- HwndTarget.cs
- AutomationTextAttribute.cs
- AutomationPeer.cs
- CompleteWizardStep.cs
- ObjectDataSourceMethodEventArgs.cs
- SqlWebEventProvider.cs
- SymmetricKeyWrap.cs
- WebPartManager.cs
- FrameworkElementFactory.cs
- UrlAuthorizationModule.cs
- _NegotiateClient.cs
- UnaryExpression.cs
- OdbcFactory.cs
- XmlSchemaComplexContent.cs
- GeometryHitTestResult.cs
- SmtpCommands.cs
- FrameworkElement.cs
- backend.cs
- regiisutil.cs
- ActivityCompletionCallbackWrapper.cs
- EntityExpressionVisitor.cs
- TraceSection.cs
- DnsEndpointIdentity.cs
- SystemException.cs
- securitycriticaldata.cs
- WmlImageAdapter.cs
- CaseCqlBlock.cs
- MimeFormatExtensions.cs
- ButtonDesigner.cs
- TextTreeUndoUnit.cs
- BaseAsyncResult.cs
- IdentityManager.cs
- HttpFileCollection.cs
- AppDomainFactory.cs
- ZoomPercentageConverter.cs
- UInt16.cs
- PrinterResolution.cs
- ErrorRuntimeConfig.cs
- UriTemplatePathPartiallyEquivalentSet.cs
- DesignerActionItemCollection.cs
- Tuple.cs
- InternalControlCollection.cs
- DbConnectionPoolGroupProviderInfo.cs
- ToolTipService.cs