Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WindowsFormsSynchronizationContext.cs
- WebPartDisplayModeCollection.cs
- SQLMembershipProvider.cs
- SQLCharsStorage.cs
- InfoCardRSACryptoProvider.cs
- ElasticEase.cs
- FrameworkElementFactoryMarkupObject.cs
- SemanticBasicElement.cs
- RotationValidation.cs
- Atom10FormatterFactory.cs
- BStrWrapper.cs
- WebContext.cs
- SystemSounds.cs
- InvalidAsynchronousStateException.cs
- COSERVERINFO.cs
- backend.cs
- Speller.cs
- RouteValueDictionary.cs
- JpegBitmapEncoder.cs
- DelegatingConfigHost.cs
- WindowsProgressbar.cs
- BadImageFormatException.cs
- ClientScriptItemCollection.cs
- CellConstant.cs
- CodeDomConfigurationHandler.cs
- AffineTransform3D.cs
- CodeTypeDeclaration.cs
- VariableDesigner.xaml.cs
- RunWorkerCompletedEventArgs.cs
- TripleDESCryptoServiceProvider.cs
- FrameworkContentElement.cs
- SQLMoney.cs
- RootProfilePropertySettingsCollection.cs
- SmtpClient.cs
- OletxDependentTransaction.cs
- LogEntryUtils.cs
- ResourceDictionaryCollection.cs
- RegexReplacement.cs
- PointCollectionConverter.cs
- RecordConverter.cs
- InfiniteIntConverter.cs
- PropertyEmitter.cs
- CharKeyFrameCollection.cs
- SecurityException.cs
- BaseHashHelper.cs
- UrlPath.cs
- FaultDescriptionCollection.cs
- HttpInputStream.cs
- TransformDescriptor.cs
- CreateInstanceBinder.cs
- ProjectionQueryOptionExpression.cs
- CellRelation.cs
- _NtlmClient.cs
- PageRequestManager.cs
- TextBoxRenderer.cs
- ZoneButton.cs
- SqlNotificationRequest.cs
- WebPartVerbCollection.cs
- UnsafeNativeMethods.cs
- CommandExpr.cs
- basenumberconverter.cs
- SqlConnectionManager.cs
- DetailsViewAutoFormat.cs
- EtwTrace.cs
- XmlSchemaExporter.cs
- ResourceBinder.cs
- baseshape.cs
- DataGridDetailsPresenter.cs
- SQLInt64Storage.cs
- QuotedStringFormatReader.cs
- securitycriticaldataClass.cs
- BufferedGraphicsContext.cs
- XmlSchemaSimpleType.cs
- DetailsViewAutoFormat.cs
- JsonClassDataContract.cs
- KeyTimeConverter.cs
- ThreadInterruptedException.cs
- MouseActionValueSerializer.cs
- IdentitySection.cs
- LinqDataSource.cs
- ProfileService.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- OpCodes.cs
- TableStyle.cs
- GeometryDrawing.cs
- Perspective.cs
- DoubleCollectionConverter.cs
- Validator.cs
- GridEntryCollection.cs
- DataGridColumnCollection.cs
- HiddenFieldPageStatePersister.cs
- ViewPort3D.cs
- DataBinder.cs
- Label.cs
- MSHTMLHostUtil.cs
- TypeDependencyAttribute.cs
- ComplexObject.cs
- PrePostDescendentsWalker.cs
- ClientApiGenerator.cs
- DefaultMemberAttribute.cs