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
- ArraySortHelper.cs
- DataControlPagerLinkButton.cs
- DataContractAttribute.cs
- DataRecordInternal.cs
- ButtonBase.cs
- shaperfactory.cs
- TypedRowHandler.cs
- ThrowHelper.cs
- LockedActivityGlyph.cs
- ValidatorCollection.cs
- DoubleUtil.cs
- BlurBitmapEffect.cs
- RegularExpressionValidator.cs
- ApplicationFileCodeDomTreeGenerator.cs
- SQLInt32Storage.cs
- FaultHandlingFilter.cs
- RootProjectionNode.cs
- PathGeometry.cs
- basecomparevalidator.cs
- XmlElementCollection.cs
- ExpressionHelper.cs
- TransformerConfigurationWizardBase.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- XmlSchemaAny.cs
- Bind.cs
- EventLogTraceListener.cs
- SchemaElement.cs
- ImageIndexConverter.cs
- DataGridViewLinkColumn.cs
- ScriptComponentDescriptor.cs
- TextElementEnumerator.cs
- SmiRequestExecutor.cs
- XmlSchemaProviderAttribute.cs
- OptimizedTemplateContent.cs
- DBBindings.cs
- mansign.cs
- AsyncSerializedWorker.cs
- RuleSettingsCollection.cs
- SimpleColumnProvider.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- ErrorFormatterPage.cs
- TimeSpanValidatorAttribute.cs
- SpellerError.cs
- securitycriticaldataformultiplegetandset.cs
- ASCIIEncoding.cs
- FormViewPagerRow.cs
- ReadOnlyCollection.cs
- XmlSerializerVersionAttribute.cs
- SafeRsaProviderHandle.cs
- LinqDataSourceContextData.cs
- basevalidator.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- CatalogUtil.cs
- RC2CryptoServiceProvider.cs
- ToolboxCategory.cs
- COM2ExtendedUITypeEditor.cs
- BreakRecordTable.cs
- SqlDataSourceConnectionPanel.cs
- PropertyContainer.cs
- WebChannelFactory.cs
- sqlnorm.cs
- ModuleBuilder.cs
- Int32Storage.cs
- WebPartEditorOkVerb.cs
- SqlXml.cs
- TimeoutConverter.cs
- EditorZoneBase.cs
- RoleManagerEventArgs.cs
- TextAutomationPeer.cs
- UTF7Encoding.cs
- SocketPermission.cs
- ButtonBaseAutomationPeer.cs
- UnsafeNativeMethods.cs
- _PooledStream.cs
- ValueConversionAttribute.cs
- GridViewColumnCollectionChangedEventArgs.cs
- FrameworkElement.cs
- XhtmlBasicListAdapter.cs
- QuotedStringFormatReader.cs
- sqlnorm.cs
- Vector3DCollectionConverter.cs
- DependencyPropertyKey.cs
- X509CertificateCollection.cs
- TextEffectCollection.cs
- HtmlPhoneCallAdapter.cs
- ByteStream.cs
- CryptographicAttribute.cs
- PtsPage.cs
- SingleObjectCollection.cs
- FontStyle.cs
- X509Utils.cs
- WorkflowCompensationBehavior.cs
- Configuration.cs
- ActionFrame.cs
- WebPartConnectionsEventArgs.cs
- FormatterServicesNoSerializableCheck.cs
- PinnedBufferMemoryStream.cs
- Volatile.cs
- DataGridViewCheckBoxColumn.cs
- ProviderException.cs