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 / 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
- AsymmetricSignatureFormatter.cs
- IisTraceListener.cs
- UIElement.cs
- EditorBrowsableAttribute.cs
- DiscoveryDocument.cs
- OutputScopeManager.cs
- GetBrowserTokenRequest.cs
- StructuredTypeInfo.cs
- SQLBytesStorage.cs
- TaskCanceledException.cs
- Brush.cs
- ManagementObject.cs
- GlobalEventManager.cs
- SHA1Managed.cs
- PropertyDescriptor.cs
- VariableValue.cs
- URLAttribute.cs
- NCryptSafeHandles.cs
- ElementUtil.cs
- CollectionEditorDialog.cs
- DebuggerAttributes.cs
- DbConnectionStringBuilder.cs
- ServerIdentity.cs
- Variable.cs
- DesignerActionUIStateChangeEventArgs.cs
- DataBoundLiteralControl.cs
- Label.cs
- PatternMatcher.cs
- OLEDB_Util.cs
- ProxyHwnd.cs
- DocumentAutomationPeer.cs
- HwndSourceParameters.cs
- TypeSource.cs
- TextStore.cs
- InvokeProviderWrapper.cs
- ExecutionEngineException.cs
- Point.cs
- ViewSimplifier.cs
- ThreadStaticAttribute.cs
- PageCodeDomTreeGenerator.cs
- XmlObjectSerializerReadContextComplexJson.cs
- HwndKeyboardInputProvider.cs
- EntityTransaction.cs
- TimeSpanOrInfiniteConverter.cs
- CountdownEvent.cs
- CellTreeNodeVisitors.cs
- UnsafeNativeMethods.cs
- EnumerableCollectionView.cs
- _NTAuthentication.cs
- ImageListStreamer.cs
- Win32SafeHandles.cs
- CharUnicodeInfo.cs
- Attributes.cs
- DataProtection.cs
- SafeNativeMethods.cs
- DependencyPropertyKey.cs
- SequentialUshortCollection.cs
- DiscardableAttribute.cs
- CheckBoxFlatAdapter.cs
- HandlerBase.cs
- UriExt.cs
- PropertySourceInfo.cs
- ConnectivityStatus.cs
- TemplateControl.cs
- VirtualDirectoryMappingCollection.cs
- MatrixTransform3D.cs
- TextBoxBase.cs
- XmlElementList.cs
- ActivityStatusChangeEventArgs.cs
- WindowsStreamSecurityBindingElement.cs
- WebPartsPersonalization.cs
- SecurityContext.cs
- lengthconverter.cs
- DbDataRecord.cs
- WebBrowser.cs
- OleDbRowUpdatedEvent.cs
- IndexedString.cs
- WebPartAddingEventArgs.cs
- MulticastOption.cs
- Property.cs
- CommentEmitter.cs
- SchemaAttDef.cs
- SimpleRecyclingCache.cs
- PenContext.cs
- WebPartManager.cs
- CodeDomLoader.cs
- FillRuleValidation.cs
- CodeMethodInvokeExpression.cs
- CaseCqlBlock.cs
- DbCommandTree.cs
- Random.cs
- InputLanguageSource.cs
- ProfileInfo.cs
- EncoderBestFitFallback.cs
- EncryptedData.cs
- ObjectDataSourceFilteringEventArgs.cs
- PartitionResolver.cs
- Win32KeyboardDevice.cs
- DataPagerCommandEventArgs.cs
- Descriptor.cs