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
- Rect3DConverter.cs
- SafeNativeMethods.cs
- Assign.cs
- SecurityUtils.cs
- PrimitiveXmlSerializers.cs
- MouseCaptureWithinProperty.cs
- DataGridViewSelectedColumnCollection.cs
- DesignRelation.cs
- GroupQuery.cs
- SQLByte.cs
- COSERVERINFO.cs
- StreamInfo.cs
- DesignerActionUIStateChangeEventArgs.cs
- _AcceptOverlappedAsyncResult.cs
- TableLayoutColumnStyleCollection.cs
- DataGridViewMethods.cs
- SessionSymmetricTransportSecurityProtocolFactory.cs
- DataRecord.cs
- EventItfInfo.cs
- ObjectAnimationUsingKeyFrames.cs
- WizardStepBase.cs
- SeekStoryboard.cs
- ContentFilePart.cs
- SchemaImporterExtensionElement.cs
- MenuItemStyle.cs
- ApplicationActivator.cs
- DataRelation.cs
- Binding.cs
- HitTestParameters3D.cs
- ControlCachePolicy.cs
- InternalCache.cs
- XmlSchemaGroup.cs
- QueryInterceptorAttribute.cs
- KerberosSecurityTokenProvider.cs
- PolicyLevel.cs
- ValueUtilsSmi.cs
- EntitySetDataBindingList.cs
- UIPermission.cs
- TemplateBindingExpressionConverter.cs
- ApplicationInfo.cs
- EdmSchemaError.cs
- ConnectionStringsSection.cs
- DataServiceContext.cs
- ToolStripTextBox.cs
- Vector3DIndependentAnimationStorage.cs
- XmlSchemaSequence.cs
- querybuilder.cs
- ProfessionalColorTable.cs
- SessionEndingEventArgs.cs
- XmlUnspecifiedAttribute.cs
- SqlComparer.cs
- XmlSerializerNamespaces.cs
- LocalFileSettingsProvider.cs
- DocumentXmlWriter.cs
- HighlightComponent.cs
- ObjectStateFormatter.cs
- EntityContainerRelationshipSet.cs
- SetState.cs
- Figure.cs
- QueuePathDialog.cs
- WebEvents.cs
- SecurityUtils.cs
- HyperLinkColumn.cs
- WebPartDisplayMode.cs
- InputDevice.cs
- DefaultValueConverter.cs
- LogLogRecordHeader.cs
- ScrollChangedEventArgs.cs
- NTAccount.cs
- TextDecorations.cs
- FtpRequestCacheValidator.cs
- DbMetaDataFactory.cs
- TransformFinalBlockRequest.cs
- SafeProcessHandle.cs
- CultureTableRecord.cs
- GridView.cs
- XsltCompileContext.cs
- ValidatingReaderNodeData.cs
- XmlImplementation.cs
- MetaColumn.cs
- BuildResultCache.cs
- CodeDefaultValueExpression.cs
- BrushConverter.cs
- DeviceContext2.cs
- ProfileManager.cs
- ClickablePoint.cs
- SoapAttributes.cs
- SiteMapDataSourceView.cs
- ReversePositionQuery.cs
- CallbackValidatorAttribute.cs
- DeleteIndexBinder.cs
- LongTypeConverter.cs
- GCHandleCookieTable.cs
- PartialList.cs
- XPathNavigator.cs
- CellCreator.cs
- ReaderWriterLockSlim.cs
- AsyncResult.cs
- DefaultBindingPropertyAttribute.cs
- RecordConverter.cs