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 / 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
- ADConnectionHelper.cs
- Themes.cs
- SendActivityEventArgs.cs
- cache.cs
- TableRowCollection.cs
- WindowsListBox.cs
- HashAlgorithm.cs
- DotExpr.cs
- HMACSHA384.cs
- IIS7UserPrincipal.cs
- Int64.cs
- coordinatorscratchpad.cs
- HttpModulesSection.cs
- NamespaceDisplay.xaml.cs
- NTAccount.cs
- Attachment.cs
- DataGridCell.cs
- DataGridViewCellStyle.cs
- ColorMap.cs
- FileVersionInfo.cs
- RotateTransform.cs
- DbXmlEnabledProviderManifest.cs
- FileDetails.cs
- PersonalizablePropertyEntry.cs
- IndexedEnumerable.cs
- CallbackException.cs
- DecoderFallback.cs
- SimpleApplicationHost.cs
- CursorInteropHelper.cs
- CodeExporter.cs
- RuntimeArgumentHandle.cs
- OverrideMode.cs
- TypeUtils.cs
- SplitContainer.cs
- MailAddressParser.cs
- Header.cs
- SequenceRange.cs
- TaiwanLunisolarCalendar.cs
- Message.cs
- DesignerTextWriter.cs
- ProcessRequestArgs.cs
- BinaryReader.cs
- CallbackValidator.cs
- VariableAction.cs
- DependencyObject.cs
- TextBlockAutomationPeer.cs
- SettingsPropertyNotFoundException.cs
- Triangle.cs
- UnionQueryOperator.cs
- InputChannel.cs
- JulianCalendar.cs
- StorageRoot.cs
- PrimitiveSchema.cs
- DataPagerFieldCommandEventArgs.cs
- TemplateControlParser.cs
- OpenTypeLayout.cs
- KeyTimeConverter.cs
- WebColorConverter.cs
- ColorMatrix.cs
- X509Certificate2.cs
- PolicyStatement.cs
- HttpRequestCacheValidator.cs
- BasePattern.cs
- versioninfo.cs
- EFAssociationProvider.cs
- XPathMultyIterator.cs
- BezierSegment.cs
- RegexWriter.cs
- HtmlInputReset.cs
- BaseConfigurationRecord.cs
- entityreference_tresulttype.cs
- _NetworkingPerfCounters.cs
- FileDialog.cs
- NativeMethods.cs
- ToolStripItemCollection.cs
- MissingSatelliteAssemblyException.cs
- DataSourceControl.cs
- SystemInfo.cs
- CodeTypeMemberCollection.cs
- ObjectDataSourceStatusEventArgs.cs
- Point4DConverter.cs
- ToolStripItemDesigner.cs
- ApplicationTrust.cs
- ConsumerConnectionPointCollection.cs
- State.cs
- DbProviderFactory.cs
- DataGridHeaderBorder.cs
- DataRowChangeEvent.cs
- ValidatedMobileControlConverter.cs
- dsa.cs
- ComboBoxDesigner.cs
- CannotUnloadAppDomainException.cs
- HealthMonitoringSection.cs
- DateTimeConverter2.cs
- XmlDictionaryReader.cs
- BrushValueSerializer.cs
- While.cs
- SchemaComplexType.cs
- SpecularMaterial.cs
- BindingBase.cs