Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / WinForms / Managed / System / WinForms / ButtonInternal / RadioButtonPopupAdapter.cs / 1 / 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
- TextEncodedRawTextWriter.cs
- ProcessThreadDesigner.cs
- NullableDoubleSumAggregationOperator.cs
- BindToObject.cs
- LabelAutomationPeer.cs
- ValidatorAttribute.cs
- SerializationStore.cs
- DataGridBoolColumn.cs
- HMAC.cs
- NamespaceQuery.cs
- NamespaceInfo.cs
- SchemaObjectWriter.cs
- TreeNodeMouseHoverEvent.cs
- WindowsContainer.cs
- TableLayoutPanel.cs
- PersistenceProviderElement.cs
- ObjectConverter.cs
- StyleBamlTreeBuilder.cs
- DataSourceConverter.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- XmlILConstructAnalyzer.cs
- cache.cs
- StringResourceManager.cs
- SqlRemoveConstantOrderBy.cs
- DirectoryInfo.cs
- Graphics.cs
- MaterialCollection.cs
- CodeMemberField.cs
- BuildResultCache.cs
- ReadOnlyMetadataCollection.cs
- HelpProvider.cs
- TreeNode.cs
- Clipboard.cs
- AsyncCompletedEventArgs.cs
- PathSegmentCollection.cs
- BStrWrapper.cs
- SystemTcpStatistics.cs
- StylusEventArgs.cs
- CannotUnloadAppDomainException.cs
- Msmq4PoisonHandler.cs
- UrlParameterReader.cs
- DbCommandDefinition.cs
- OperationFormatUse.cs
- ExpressionEditor.cs
- ComplexTypeEmitter.cs
- listviewsubitemcollectioneditor.cs
- CopyAttributesAction.cs
- DesignerWebPartChrome.cs
- MetafileHeader.cs
- ApplicationException.cs
- Int16Converter.cs
- CacheVirtualItemsEvent.cs
- IdentityManager.cs
- ExpressionTextBox.xaml.cs
- EndpointPerformanceCounters.cs
- Imaging.cs
- DispatcherObject.cs
- CharEntityEncoderFallback.cs
- ISAPIApplicationHost.cs
- ListViewItemMouseHoverEvent.cs
- NumberAction.cs
- HighContrastHelper.cs
- EventWaitHandleSecurity.cs
- FileDialogCustomPlace.cs
- ResourceDescriptionAttribute.cs
- KnownTypesHelper.cs
- TypeSource.cs
- XmlCharType.cs
- DrawingContext.cs
- ImageAutomationPeer.cs
- TagMapCollection.cs
- PrtTicket_Editor.cs
- counter.cs
- HandlerBase.cs
- ComNativeDescriptor.cs
- SqlFacetAttribute.cs
- HtmlElementCollection.cs
- MinimizableAttributeTypeConverter.cs
- TableAutomationPeer.cs
- DbConnectionPoolOptions.cs
- ValidationException.cs
- BamlVersionHeader.cs
- DataGridColumnCollection.cs
- TerminateDesigner.cs
- CrossSiteScriptingValidation.cs
- Icon.cs
- EventLogTraceListener.cs
- WindowsListViewItem.cs
- FreeFormDragDropManager.cs
- QueryParameter.cs
- DataGridViewCellFormattingEventArgs.cs
- DataConnectionHelper.cs
- DocumentApplication.cs
- ScanQueryOperator.cs
- CaseExpr.cs
- PerformanceCounterCategory.cs
- Constraint.cs
- HandlerBase.cs
- DispatcherExceptionFilterEventArgs.cs
- DataGridViewCellCancelEventArgs.cs