Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- MenuItem.cs
- TableChangeProcessor.cs
- SystemUdpStatistics.cs
- MsmqInputChannel.cs
- OleDbWrapper.cs
- TreeNodeEventArgs.cs
- UTF7Encoding.cs
- CreateUserWizardStep.cs
- EditingCoordinator.cs
- XpsResourcePolicy.cs
- XmlElementAttribute.cs
- DbProviderServices.cs
- HighContrastHelper.cs
- SafeCryptHandles.cs
- MatrixTransform3D.cs
- TemplateManager.cs
- ActivityWithResultWrapper.cs
- DataControlCommands.cs
- Monitor.cs
- SamlAudienceRestrictionCondition.cs
- CmsInterop.cs
- IISUnsafeMethods.cs
- DrawingContext.cs
- RadioButton.cs
- TabControlEvent.cs
- Timeline.cs
- XmlObjectSerializerContext.cs
- EventToken.cs
- DbTransaction.cs
- SqlMultiplexer.cs
- IntellisenseTextBox.designer.cs
- X509UI.cs
- CodeArgumentReferenceExpression.cs
- PolyLineSegment.cs
- DataControlFieldCell.cs
- MsmqAppDomainProtocolHandler.cs
- SchemaEntity.cs
- SubclassTypeValidator.cs
- PinnedBufferMemoryStream.cs
- InvokeGenerator.cs
- RoleService.cs
- XsltSettings.cs
- MenuStrip.cs
- OperatingSystem.cs
- FragmentQuery.cs
- JumpList.cs
- ClusterRegistryConfigurationProvider.cs
- IisTraceListener.cs
- WebZone.cs
- PersonalizableTypeEntry.cs
- KeyGestureConverter.cs
- Timer.cs
- StaticSiteMapProvider.cs
- OleAutBinder.cs
- EntityReference.cs
- ComplexPropertyEntry.cs
- DropDownButton.cs
- ExtensibleClassFactory.cs
- TraceSource.cs
- ResourceDictionaryCollection.cs
- ContextInformation.cs
- GreenMethods.cs
- SqlMethodCallConverter.cs
- EventToken.cs
- PropertyCollection.cs
- RowBinding.cs
- ImageBrush.cs
- TraceLog.cs
- CallbackValidatorAttribute.cs
- EntityTransaction.cs
- CompiledELinqQueryState.cs
- CodeFieldReferenceExpression.cs
- Tokenizer.cs
- PLINQETWProvider.cs
- CompiledRegexRunnerFactory.cs
- MgmtConfigurationRecord.cs
- Formatter.cs
- RowUpdatedEventArgs.cs
- Graph.cs
- SmtpAuthenticationManager.cs
- SqlPersonalizationProvider.cs
- DateTimeOffset.cs
- RtType.cs
- CreateUserErrorEventArgs.cs
- columnmapfactory.cs
- SelectionPatternIdentifiers.cs
- SectionInput.cs
- AllMembershipCondition.cs
- EventLogException.cs
- PerformanceCounterPermission.cs
- MutexSecurity.cs
- counter.cs
- ResourceDictionary.cs
- UnaryOperationBinder.cs
- PropertyChangingEventArgs.cs
- TextSelectionHelper.cs
- FormsAuthenticationEventArgs.cs
- MissingMemberException.cs
- FixedSOMPageElement.cs
- FileDataSourceCache.cs