Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataKey.cs
- NodeFunctions.cs
- StringReader.cs
- RequestQueryParser.cs
- CaseInsensitiveComparer.cs
- WebPartTransformer.cs
- FullTextBreakpoint.cs
- ConfigurationManagerInternalFactory.cs
- XsdValidatingReader.cs
- HttpResponse.cs
- WSSecurityOneDotZeroReceiveSecurityHeader.cs
- PathSegment.cs
- Int32CollectionConverter.cs
- AttributeCollection.cs
- ImmutableCollection.cs
- HtmlInputPassword.cs
- TextViewSelectionProcessor.cs
- RuleProcessor.cs
- _FtpDataStream.cs
- Effect.cs
- WebPartConnectionsCancelEventArgs.cs
- CompositeDataBoundControl.cs
- TextServicesContext.cs
- CodeIndexerExpression.cs
- Int32.cs
- MDIWindowDialog.cs
- ImageListUtils.cs
- NamedPipeChannelListener.cs
- XmlSchemaAttribute.cs
- Parser.cs
- DesignerTextBoxAdapter.cs
- AssertFilter.cs
- ZipIOModeEnforcingStream.cs
- IndentedTextWriter.cs
- As.cs
- FixedSOMTableRow.cs
- COM2PropertyPageUITypeConverter.cs
- StreamGeometryContext.cs
- Help.cs
- DefaultValueTypeConverter.cs
- TableCell.cs
- LowerCaseStringConverter.cs
- CommonRemoteMemoryBlock.cs
- CommandField.cs
- InvalidStoreProtectionKeyException.cs
- TextRange.cs
- BufferModeSettings.cs
- ReadWriteControlDesigner.cs
- IdnElement.cs
- RemotingService.cs
- SyntaxCheck.cs
- PackUriHelper.cs
- SQLUtility.cs
- PageHandlerFactory.cs
- SyntaxCheck.cs
- WebPartEditVerb.cs
- WebScriptMetadataMessage.cs
- TrustManager.cs
- DataGridBoolColumn.cs
- DeviceSpecificChoiceCollection.cs
- UserControl.cs
- ToolboxDataAttribute.cs
- CharEntityEncoderFallback.cs
- ToolTipService.cs
- FileDialogCustomPlace.cs
- EventRoute.cs
- CachedTypeface.cs
- BitArray.cs
- BinaryObjectWriter.cs
- AdornerDecorator.cs
- WSUtilitySpecificationVersion.cs
- TimeSpanConverter.cs
- Invariant.cs
- HttpTransportElement.cs
- EditCommandColumn.cs
- ConnectionOrientedTransportManager.cs
- ToolStripItem.cs
- DataGridPageChangedEventArgs.cs
- ISCIIEncoding.cs
- DateBoldEvent.cs
- WebReferenceOptions.cs
- SelfIssuedSamlTokenFactory.cs
- PointAnimationUsingKeyFrames.cs
- _LocalDataStoreMgr.cs
- AffineTransform3D.cs
- SoapParser.cs
- SiteMapProvider.cs
- ChainedAsyncResult.cs
- IndentedWriter.cs
- LineBreakRecord.cs
- XhtmlBasicPanelAdapter.cs
- CapabilitiesRule.cs
- ScalarOps.cs
- StyleSelector.cs
- CategoryNameCollection.cs
- Clause.cs
- EntryIndex.cs
- XmlUTF8TextWriter.cs
- CompiledELinqQueryState.cs
- GeneralTransform3D.cs