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 / RadioButtonFlatAdapter.cs / 1 / RadioButtonFlatAdapter.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 RadioButtonFlatAdapter : RadioButtonBaseAdapter { protected const int flatCheckSize = 12; internal RadioButtonFlatAdapter(ButtonBase control) : base(control) {} internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonFlatAdapter adapter = new ButtonFlatAdapter(Control); adapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.highlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonFlatAdapter adapter = new ButtonFlatAdapter(Control); adapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.lowHighlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } internal override void PaintUp(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonFlatAdapter adapter = new ButtonFlatAdapter(Control); adapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.highlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } void PaintFlatWorker(PaintEventArgs e, Color checkColor, Color checkBackground, Color checkBorder, ColorData colors) { System.Drawing.Graphics g = e.Graphics; LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckFlat(e, layout, checkColor, colors.options.highContrast ? colors.buttonFace : checkBackground, checkBorder); PaintField(e, layout, colors, checkColor, true); } #region Layout protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonFlatAdapter(Control); } // RadioButtonPopupLayout also uses this layout for down and over protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = CommonLayout(); layout.checkSize = flatCheckSize; layout.shadowedText = false; 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 RadioButtonFlatAdapter : RadioButtonBaseAdapter { protected const int flatCheckSize = 12; internal RadioButtonFlatAdapter(ButtonBase control) : base(control) {} internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonFlatAdapter adapter = new ButtonFlatAdapter(Control); adapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.highlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonFlatAdapter adapter = new ButtonFlatAdapter(Control); adapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.lowHighlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } internal override void PaintUp(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonFlatAdapter adapter = new ButtonFlatAdapter(Control); adapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); return; } ColorData colors = PaintFlatRender(e.Graphics).Calculate(); if (Control.Enabled) { PaintFlatWorker(e, colors.windowText, colors.highlight, colors.windowFrame, colors); } else { PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors); } } void PaintFlatWorker(PaintEventArgs e, Color checkColor, Color checkBackground, Color checkBorder, ColorData colors) { System.Drawing.Graphics g = e.Graphics; LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckFlat(e, layout, checkColor, colors.options.highContrast ? colors.buttonFace : checkBackground, checkBorder); PaintField(e, layout, colors, checkColor, true); } #region Layout protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonFlatAdapter(Control); } // RadioButtonPopupLayout also uses this layout for down and over protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = CommonLayout(); layout.checkSize = flatCheckSize; layout.shadowedText = false; 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
- EntityViewContainer.cs
- TargetConverter.cs
- TextServicesDisplayAttributePropertyRanges.cs
- ObjectItemAssemblyLoader.cs
- EntityViewGenerationConstants.cs
- ContainsRowNumberChecker.cs
- ApplicationInterop.cs
- IPipelineRuntime.cs
- EntityTypeEmitter.cs
- CodePropertyReferenceExpression.cs
- PrimitiveCodeDomSerializer.cs
- ClientBuildManager.cs
- StorageEntityTypeMapping.cs
- XmlJsonWriter.cs
- LogSwitch.cs
- IxmlLineInfo.cs
- Animatable.cs
- CompilerErrorCollection.cs
- SQLResource.cs
- TypeContext.cs
- SecureEnvironment.cs
- TransformGroup.cs
- EdmSchemaAttribute.cs
- CategoryAttribute.cs
- RewritingSimplifier.cs
- FormsAuthenticationTicket.cs
- WindowsStatic.cs
- DataBinding.cs
- InlineObject.cs
- Memoizer.cs
- CharAnimationUsingKeyFrames.cs
- XmlSchemaExternal.cs
- PageAsyncTaskManager.cs
- DropTarget.cs
- EntryWrittenEventArgs.cs
- InlineCollection.cs
- PropertyIDSet.cs
- WindowsGraphics2.cs
- Shared.cs
- TriggerBase.cs
- PersistChildrenAttribute.cs
- DataSetSchema.cs
- TemplateField.cs
- CellIdBoolean.cs
- PingReply.cs
- DBSqlParserTableCollection.cs
- GridLength.cs
- AssemblySettingAttributes.cs
- NativeMethodsOther.cs
- PermissionAttributes.cs
- GPPOINTF.cs
- MergeFailedEvent.cs
- SystemIPv6InterfaceProperties.cs
- SoapFault.cs
- TextPattern.cs
- DataGridViewRowStateChangedEventArgs.cs
- RootProfilePropertySettingsCollection.cs
- ButtonPopupAdapter.cs
- ListViewInsertEventArgs.cs
- ListDataBindEventArgs.cs
- CdpEqualityComparer.cs
- KeyProperty.cs
- EventLogReader.cs
- DragDeltaEventArgs.cs
- PlatformNotSupportedException.cs
- ComponentRenameEvent.cs
- ListControlBuilder.cs
- GridViewDesigner.cs
- Pkcs9Attribute.cs
- TreeBuilder.cs
- DashStyle.cs
- DataGridClipboardHelper.cs
- RewritingProcessor.cs
- DocumentPageTextView.cs
- SingleObjectCollection.cs
- ObjectListGeneralPage.cs
- UnsafeNativeMethodsTablet.cs
- Psha1DerivedKeyGenerator.cs
- VisualProxy.cs
- SafeNativeMethods.cs
- SynchronizationContext.cs
- Part.cs
- TextEvent.cs
- SerializerWriterEventHandlers.cs
- DoubleLinkListEnumerator.cs
- DataGridViewButtonCell.cs
- SelfSignedCertificate.cs
- Rijndael.cs
- CustomAttributeSerializer.cs
- ObjectDataSourceMethodEventArgs.cs
- LateBoundBitmapDecoder.cs
- RawStylusInputReport.cs
- SqlTopReducer.cs
- ArrayElementGridEntry.cs
- HtmlHead.cs
- PassportAuthentication.cs
- UserControl.cs
- AspProxy.cs
- DbConnectionPoolOptions.cs
- ScriptingRoleServiceSection.cs