Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / ButtonInternal / CheckBoxFlatAdapter.cs / 1 / CheckBoxFlatAdapter.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 CheckBoxFlatAdapter : CheckBoxBaseAdapter { internal CheckBoxFlatAdapter(ButtonBase control) : base(control) {} internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintDown(e, Control.CheckState); 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) { ButtonAdapter.PaintOver(e, Control.CheckState); 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) { ButtonAdapter.PaintUp(e, Control.CheckState); 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); } } private 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, colors); PaintField(e, layout, colors, checkColor, true); } #region Layout private new ButtonFlatAdapter ButtonAdapter { get { return ((ButtonFlatAdapter)base.ButtonAdapter); } } protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonFlatAdapter(Control); } 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 CheckBoxFlatAdapter : CheckBoxBaseAdapter { internal CheckBoxFlatAdapter(ButtonBase control) : base(control) {} internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintDown(e, Control.CheckState); 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) { ButtonAdapter.PaintOver(e, Control.CheckState); 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) { ButtonAdapter.PaintUp(e, Control.CheckState); 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); } } private 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, colors); PaintField(e, layout, colors, checkColor, true); } #region Layout private new ButtonFlatAdapter ButtonAdapter { get { return ((ButtonFlatAdapter)base.ButtonAdapter); } } protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonFlatAdapter(Control); } 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
- AuthorizationSection.cs
- ListBoxItemWrapperAutomationPeer.cs
- JapaneseCalendar.cs
- NotFiniteNumberException.cs
- OnOperation.cs
- Tokenizer.cs
- PeerTransportListenAddressValidatorAttribute.cs
- Utility.cs
- XsdDataContractExporter.cs
- ContextMenuStrip.cs
- ClientRolePrincipal.cs
- Variant.cs
- Label.cs
- TextAnchor.cs
- Matrix3D.cs
- ServiceModelSecurityTokenTypes.cs
- DeclaredTypeElement.cs
- MenuItem.cs
- WebPermission.cs
- FamilyMapCollection.cs
- SqlTransaction.cs
- EventMappingSettings.cs
- BmpBitmapDecoder.cs
- CqlIdentifiers.cs
- TabletDeviceInfo.cs
- EventDescriptorCollection.cs
- XamlReaderHelper.cs
- XmlNodeComparer.cs
- PersonalizationStateInfo.cs
- ObjectAssociationEndMapping.cs
- DelegatingHeader.cs
- ServiceElement.cs
- SettingsPropertyValueCollection.cs
- ResolveMatchesMessageCD1.cs
- HttpApplicationFactory.cs
- SqlUserDefinedAggregateAttribute.cs
- ManagementObject.cs
- MenuItemBindingCollection.cs
- DoubleAnimationUsingPath.cs
- BlurBitmapEffect.cs
- NullToBooleanConverter.cs
- DashStyle.cs
- AliasGenerator.cs
- CryptographicAttribute.cs
- QuaternionConverter.cs
- x509utils.cs
- XmlReaderSettings.cs
- TransactionContextManager.cs
- Int64AnimationBase.cs
- FormViewModeEventArgs.cs
- WebSysDefaultValueAttribute.cs
- PropertyTabChangedEvent.cs
- GZipDecoder.cs
- XmlSchemaElement.cs
- TypeSystem.cs
- ExtendedProperty.cs
- BinHexEncoding.cs
- CommonDialog.cs
- TransformGroup.cs
- HtmlFormWrapper.cs
- Content.cs
- PixelFormat.cs
- WebServiceReceiveDesigner.cs
- DigitalSignature.cs
- OdbcException.cs
- DistributedTransactionPermission.cs
- BamlBinaryReader.cs
- BitmapEffectInput.cs
- DataGridViewTextBoxColumn.cs
- XmlSchemas.cs
- Script.cs
- SingleKeyFrameCollection.cs
- FontConverter.cs
- DataGridViewLinkCell.cs
- ConfigurationSectionGroup.cs
- Win32SafeHandles.cs
- Geometry.cs
- MenuCommandService.cs
- InternalResources.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- PropertyValueChangedEvent.cs
- IItemProperties.cs
- VisualStyleTypesAndProperties.cs
- ProvideValueServiceProvider.cs
- DesignerInterfaces.cs
- EventBindingService.cs
- HttpMethodAttribute.cs
- WebServiceClientProxyGenerator.cs
- NativeMethods.cs
- DefaultObjectMappingItemCollection.cs
- PropertyItemInternal.cs
- GradientStop.cs
- MimeMultiPart.cs
- IIS7UserPrincipal.cs
- LocatorManager.cs
- wgx_commands.cs
- GridViewAutomationPeer.cs
- WebInvokeAttribute.cs
- _AutoWebProxyScriptEngine.cs
- FileDialogCustomPlaces.cs