Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / ButtonInternal / RadioButtonPopupAdapter.cs / 1305376 / RadioButtonPopupAdapter.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 RadioButtonPopupAdapter : RadioButtonFlatAdapter { internal RadioButtonPopupAdapter(ButtonBase control) : base(control) {} internal override void PaintUp(PaintEventArgs e, CheckState state) { System.Drawing.Graphics g = e.Graphics; if (Control.Appearance == Appearance.Button) { ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control); adapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintPopupRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBackgroundFlat(e, layout.checkBounds, colors.buttonShadow, colors.options.highContrast ? colors.buttonFace : colors.highlight, true); DrawCheckOnly(e, layout, colors.windowText, colors.highlight, true); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { System.Drawing.Graphics g = e.Graphics; if (Control.Appearance == Appearance.Button) { ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control); adapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintPopupRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBackground3DLite(e, layout.checkBounds, colors.windowText, colors.options.highContrast ? colors.buttonFace : colors.highlight, colors, true); DrawCheckOnly(e, layout, colors.windowText, colors.highlight, true); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintDown(PaintEventArgs e, CheckState state) { System.Drawing.Graphics g = e.Graphics; if (Control.Appearance == Appearance.Button) { ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control); adapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintPopupRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBackground3DLite(e, layout.checkBounds, colors.windowText, colors.highlight, colors, true); DrawCheckOnly(e, layout, colors.buttonShadow, colors.highlight, true); PaintField(e, layout, colors, colors.windowText, true); } } #region Layout protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonPopupAdapter(Control); } protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = base.Layout(e); if (!Control.MouseIsDown && !Control.MouseIsOver) { layout.shadowedText = true; } 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 RadioButtonPopupAdapter : RadioButtonFlatAdapter { internal RadioButtonPopupAdapter(ButtonBase control) : base(control) {} internal override void PaintUp(PaintEventArgs e, CheckState state) { System.Drawing.Graphics g = e.Graphics; if (Control.Appearance == Appearance.Button) { ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control); adapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintPopupRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBackgroundFlat(e, layout.checkBounds, colors.buttonShadow, colors.options.highContrast ? colors.buttonFace : colors.highlight, true); DrawCheckOnly(e, layout, colors.windowText, colors.highlight, true); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { System.Drawing.Graphics g = e.Graphics; if (Control.Appearance == Appearance.Button) { ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control); adapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintPopupRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBackground3DLite(e, layout.checkBounds, colors.windowText, colors.options.highContrast ? colors.buttonFace : colors.highlight, colors, true); DrawCheckOnly(e, layout, colors.windowText, colors.highlight, true); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintDown(PaintEventArgs e, CheckState state) { System.Drawing.Graphics g = e.Graphics; if (Control.Appearance == Appearance.Button) { ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control); adapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintPopupRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBackground3DLite(e, layout.checkBounds, colors.windowText, colors.highlight, colors, true); DrawCheckOnly(e, layout, colors.buttonShadow, colors.highlight, true); PaintField(e, layout, colors, colors.windowText, true); } } #region Layout protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonPopupAdapter(Control); } protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = base.Layout(e); if (!Control.MouseIsDown && !Control.MouseIsOver) { layout.shadowedText = true; } 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
- TdsEnums.cs
- JsonUriDataContract.cs
- OperationResponse.cs
- BrushValueSerializer.cs
- ScrollEvent.cs
- CompatibleIComparer.cs
- Activation.cs
- LinkDescriptor.cs
- QuaternionAnimation.cs
- Configuration.cs
- XmlSchemaAttribute.cs
- GPStream.cs
- Knowncolors.cs
- DocumentsTrace.cs
- InspectionWorker.cs
- XmlTypeMapping.cs
- ScriptControl.cs
- MemberInfoSerializationHolder.cs
- ImmutableObjectAttribute.cs
- StyleSelector.cs
- XamlStream.cs
- SocketElement.cs
- TraceSection.cs
- XmlSchemaElement.cs
- AuthenticationServiceManager.cs
- ModelUIElement3D.cs
- ToolboxDataAttribute.cs
- GradientBrush.cs
- RuntimeHandles.cs
- X509Certificate.cs
- ListItemConverter.cs
- TextBounds.cs
- GridViewColumnHeader.cs
- ParamArrayAttribute.cs
- TreeNodeBindingCollection.cs
- Color.cs
- JsonFormatGeneratorStatics.cs
- PageRanges.cs
- DefaultTraceListener.cs
- AtomEntry.cs
- Timer.cs
- PersonalizablePropertyEntry.cs
- StrongNameMembershipCondition.cs
- ClientReliableChannelBinder.cs
- SyndicationSerializer.cs
- WebPartConnectionsDisconnectVerb.cs
- HealthMonitoringSectionHelper.cs
- SocketException.cs
- WindowsStartMenu.cs
- Currency.cs
- CategoriesDocumentFormatter.cs
- WindowShowOrOpenTracker.cs
- NullEntityWrapper.cs
- WebPartConnectionsCloseVerb.cs
- XmlQueryContext.cs
- ValidationUtility.cs
- State.cs
- Frame.cs
- GridViewPageEventArgs.cs
- ManualResetEventSlim.cs
- TableAutomationPeer.cs
- XmlChoiceIdentifierAttribute.cs
- DataGridSortCommandEventArgs.cs
- SafeThreadHandle.cs
- Int32AnimationUsingKeyFrames.cs
- XmlSecureResolver.cs
- EventlogProvider.cs
- OutOfProcStateClientManager.cs
- DataGridRowAutomationPeer.cs
- RequestBringIntoViewEventArgs.cs
- FacetEnabledSchemaElement.cs
- OSFeature.cs
- AnnotationHelper.cs
- SHA1Managed.cs
- iisPickupDirectory.cs
- MimeTypeMapper.cs
- FileSecurity.cs
- NumericUpDown.cs
- SrgsNameValueTag.cs
- WeakReadOnlyCollection.cs
- ValueChangedEventManager.cs
- TlsnegoTokenProvider.cs
- Speller.cs
- TypeSystem.cs
- CryptoKeySecurity.cs
- ToolStripLocationCancelEventArgs.cs
- XmlMapping.cs
- ValidationErrorEventArgs.cs
- KoreanCalendar.cs
- CodeAttributeArgument.cs
- ZipIOLocalFileDataDescriptor.cs
- PopupRoot.cs
- SmiGettersStream.cs
- thaishape.cs
- SqlCacheDependencyDatabaseCollection.cs
- Flowchart.cs
- MILUtilities.cs
- BrushValueSerializer.cs
- DeviceOverridableAttribute.cs
- MatrixTransform.cs