Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / ButtonInternal / RadioButtonPopupAdapter.cs / 1 / RadioButtonPopupAdapter.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 RadioButtonPopupAdapter : RadioButtonFlatAdapter {
internal RadioButtonPopupAdapter(ButtonBase control) : base(control) {}
internal override void PaintUp(PaintEventArgs e, CheckState state) {
System.Drawing.Graphics g = e.Graphics;
if (Control.Appearance == Appearance.Button) {
ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control);
adapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked);
}
else {
ColorData colors = PaintPopupRender(e.Graphics).Calculate();
LayoutData layout = Layout(e).Layout();
PaintButtonBackground(e, Control.ClientRectangle, null);
PaintImage(e, layout);
DrawCheckBackgroundFlat(e, layout.checkBounds, colors.buttonShadow, colors.options.highContrast ? colors.buttonFace : colors.highlight, true);
DrawCheckOnly(e, layout, colors.windowText, colors.highlight, true);
PaintField(e, layout, colors, colors.windowText, true);
}
}
internal override void PaintOver(PaintEventArgs e, CheckState state) {
System.Drawing.Graphics g = e.Graphics;
if (Control.Appearance == Appearance.Button) {
ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control);
adapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked);
}
else {
ColorData colors = PaintPopupRender(e.Graphics).Calculate();
LayoutData layout = Layout(e).Layout();
PaintButtonBackground(e, Control.ClientRectangle, null);
PaintImage(e, layout);
DrawCheckBackground3DLite(e, layout.checkBounds, colors.windowText, colors.options.highContrast ? colors.buttonFace : colors.highlight, colors, true);
DrawCheckOnly(e, layout, colors.windowText, colors.highlight, true);
PaintField(e, layout, colors, colors.windowText, true);
}
}
internal override void PaintDown(PaintEventArgs e, CheckState state) {
System.Drawing.Graphics g = e.Graphics;
if (Control.Appearance == Appearance.Button) {
ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control);
adapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked);
}
else {
ColorData colors = PaintPopupRender(e.Graphics).Calculate();
LayoutData layout = Layout(e).Layout();
PaintButtonBackground(e, Control.ClientRectangle, null);
PaintImage(e, layout);
DrawCheckBackground3DLite(e, layout.checkBounds, colors.windowText, colors.highlight, colors, true);
DrawCheckOnly(e, layout, colors.buttonShadow, colors.highlight, true);
PaintField(e, layout, colors, colors.windowText, true);
}
}
#region Layout
protected override ButtonBaseAdapter CreateButtonAdapter() {
return new ButtonPopupAdapter(Control);
}
protected override LayoutOptions Layout(PaintEventArgs e) {
LayoutOptions layout = base.Layout(e);
if (!Control.MouseIsDown && !Control.MouseIsOver) {
layout.shadowedText = true;
}
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 RadioButtonPopupAdapter : RadioButtonFlatAdapter {
internal RadioButtonPopupAdapter(ButtonBase control) : base(control) {}
internal override void PaintUp(PaintEventArgs e, CheckState state) {
System.Drawing.Graphics g = e.Graphics;
if (Control.Appearance == Appearance.Button) {
ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control);
adapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked);
}
else {
ColorData colors = PaintPopupRender(e.Graphics).Calculate();
LayoutData layout = Layout(e).Layout();
PaintButtonBackground(e, Control.ClientRectangle, null);
PaintImage(e, layout);
DrawCheckBackgroundFlat(e, layout.checkBounds, colors.buttonShadow, colors.options.highContrast ? colors.buttonFace : colors.highlight, true);
DrawCheckOnly(e, layout, colors.windowText, colors.highlight, true);
PaintField(e, layout, colors, colors.windowText, true);
}
}
internal override void PaintOver(PaintEventArgs e, CheckState state) {
System.Drawing.Graphics g = e.Graphics;
if (Control.Appearance == Appearance.Button) {
ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control);
adapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked);
}
else {
ColorData colors = PaintPopupRender(e.Graphics).Calculate();
LayoutData layout = Layout(e).Layout();
PaintButtonBackground(e, Control.ClientRectangle, null);
PaintImage(e, layout);
DrawCheckBackground3DLite(e, layout.checkBounds, colors.windowText, colors.options.highContrast ? colors.buttonFace : colors.highlight, colors, true);
DrawCheckOnly(e, layout, colors.windowText, colors.highlight, true);
PaintField(e, layout, colors, colors.windowText, true);
}
}
internal override void PaintDown(PaintEventArgs e, CheckState state) {
System.Drawing.Graphics g = e.Graphics;
if (Control.Appearance == Appearance.Button) {
ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control);
adapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked);
}
else {
ColorData colors = PaintPopupRender(e.Graphics).Calculate();
LayoutData layout = Layout(e).Layout();
PaintButtonBackground(e, Control.ClientRectangle, null);
PaintImage(e, layout);
DrawCheckBackground3DLite(e, layout.checkBounds, colors.windowText, colors.highlight, colors, true);
DrawCheckOnly(e, layout, colors.buttonShadow, colors.highlight, true);
PaintField(e, layout, colors, colors.windowText, true);
}
}
#region Layout
protected override ButtonBaseAdapter CreateButtonAdapter() {
return new ButtonPopupAdapter(Control);
}
protected override LayoutOptions Layout(PaintEventArgs e) {
LayoutOptions layout = base.Layout(e);
if (!Control.MouseIsDown && !Control.MouseIsOver) {
layout.shadowedText = true;
}
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
- WinFormsUtils.cs
- DrawingState.cs
- CodeBlockBuilder.cs
- ClientConfigurationSystem.cs
- HTMLTagNameToTypeMapper.cs
- GatewayIPAddressInformationCollection.cs
- UiaCoreProviderApi.cs
- OleDbReferenceCollection.cs
- SourceFileBuildProvider.cs
- DataListItemCollection.cs
- messageonlyhwndwrapper.cs
- AutomationPatternInfo.cs
- HttpConfigurationContext.cs
- EastAsianLunisolarCalendar.cs
- WindowsStartMenu.cs
- BitmapEffectGeneralTransform.cs
- MetadataItemCollectionFactory.cs
- AuthenticationException.cs
- DeferredSelectedIndexReference.cs
- DataGridBoolColumn.cs
- CallTemplateAction.cs
- InputLanguageManager.cs
- COMException.cs
- CalendarSelectionChangedEventArgs.cs
- SecureConversationDriver.cs
- FontFamilyConverter.cs
- HandleCollector.cs
- QueryOperationResponseOfT.cs
- TabItemWrapperAutomationPeer.cs
- DefaultPrintController.cs
- ScriptIgnoreAttribute.cs
- WebServicesInteroperability.cs
- UnsafeCollabNativeMethods.cs
- PrimitiveXmlSerializers.cs
- AssemblyBuilder.cs
- TabControlEvent.cs
- MethodBuilder.cs
- UserControlDocumentDesigner.cs
- XmlSchemaImporter.cs
- HttpConfigurationSystem.cs
- Publisher.cs
- CheckBoxRenderer.cs
- BasicCellRelation.cs
- Msec.cs
- HtmlInputText.cs
- WSFederationHttpBinding.cs
- HtmlButton.cs
- ToolStripButton.cs
- DefaultValidator.cs
- DescendantQuery.cs
- TextSegment.cs
- ColorContext.cs
- ApplicationId.cs
- RewritingSimplifier.cs
- HtmlFormParameterReader.cs
- ScriptReferenceEventArgs.cs
- ColorEditor.cs
- ObjectDataSourceSelectingEventArgs.cs
- Typography.cs
- AssemblyBuilder.cs
- JpegBitmapDecoder.cs
- LinkedList.cs
- _UriSyntax.cs
- ContainerParagraph.cs
- WeakReference.cs
- MouseGestureConverter.cs
- DependencyPropertyKey.cs
- WbmpConverter.cs
- ProtocolsConfigurationHandler.cs
- SqlNotificationEventArgs.cs
- PropertyDescriptorComparer.cs
- FixedSOMLineRanges.cs
- MachineKeySection.cs
- BitmapEffectRenderDataResource.cs
- StateMachineHelpers.cs
- WebContext.cs
- ConfigurationProperty.cs
- PackageStore.cs
- TextSelection.cs
- Unit.cs
- SqlBooleanMismatchVisitor.cs
- CodeVariableReferenceExpression.cs
- EventDescriptorCollection.cs
- Rules.cs
- TCEAdapterGenerator.cs
- HostedElements.cs
- WebPartMenu.cs
- MethodExecutor.cs
- CompilerCollection.cs
- ConfigXmlCDataSection.cs
- DataGridRowEventArgs.cs
- GenericPrincipal.cs
- CssStyleCollection.cs
- OletxCommittableTransaction.cs
- SynchronizedInputHelper.cs
- UnsafeNativeMethodsPenimc.cs
- TimeSpanConverter.cs
- parserscommon.cs
- GridViewRowPresenterBase.cs
- TraceHwndHost.cs