Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- WebPartPersonalization.cs
- AssociationProvider.cs
- MaterialGroup.cs
- Semaphore.cs
- XmlNamespaceDeclarationsAttribute.cs
- _SpnDictionary.cs
- HttpContext.cs
- XPathDocumentIterator.cs
- BindingMemberInfo.cs
- WindowsFormsSectionHandler.cs
- ResourceDisplayNameAttribute.cs
- localization.cs
- ExceptionUtil.cs
- ClassHandlersStore.cs
- SHA384CryptoServiceProvider.cs
- AuthenticatedStream.cs
- FilteredDataSetHelper.cs
- ProviderUtil.cs
- FixedSchema.cs
- DbProviderFactories.cs
- TreeView.cs
- TextEditorSelection.cs
- ExceptionUtility.cs
- XmlCharType.cs
- UInt32.cs
- WebUtility.cs
- DetailsViewRow.cs
- MonitoringDescriptionAttribute.cs
- Cursor.cs
- LostFocusEventManager.cs
- TreeNodeClickEventArgs.cs
- EditorServiceContext.cs
- RequestQueue.cs
- oledbmetadatacollectionnames.cs
- ProtectedConfiguration.cs
- SqlCommand.cs
- ScrollBarRenderer.cs
- NodeLabelEditEvent.cs
- _AutoWebProxyScriptEngine.cs
- HtmlTableCell.cs
- DispatcherOperation.cs
- PersonalizablePropertyEntry.cs
- SecurityRuntime.cs
- BindingContext.cs
- StringFreezingAttribute.cs
- RemotingAttributes.cs
- XappLauncher.cs
- ScriptingProfileServiceSection.cs
- FixedTextPointer.cs
- ServiceNameElementCollection.cs
- DSACryptoServiceProvider.cs
- HtmlSelectionListAdapter.cs
- LabelAutomationPeer.cs
- Stylesheet.cs
- Geometry.cs
- ProxyManager.cs
- MetadataProperty.cs
- Trace.cs
- _LocalDataStoreMgr.cs
- AssemblyNameUtility.cs
- UnsafeNativeMethods.cs
- TypeConverterHelper.cs
- WebConvert.cs
- EditorZoneBase.cs
- AssemblyAttributesGoHere.cs
- TableDetailsCollection.cs
- StickyNoteContentControl.cs
- PanelStyle.cs
- CSharpCodeProvider.cs
- DataGridViewComboBoxColumn.cs
- ToolStripGripRenderEventArgs.cs
- RequiredAttributeAttribute.cs
- MenuBindingsEditorForm.cs
- SoapSchemaImporter.cs
- ConnectionManagementElement.cs
- MinMaxParagraphWidth.cs
- XmlQueryType.cs
- WebEventTraceProvider.cs
- RtfNavigator.cs
- CollectionViewGroupRoot.cs
- ButtonChrome.cs
- Baml2006SchemaContext.cs
- PropertyMetadata.cs
- NavigationHelper.cs
- BmpBitmapEncoder.cs
- ErrorHandlingReceiver.cs
- WorkflowRuntimeSection.cs
- __TransparentProxy.cs
- SelectionRangeConverter.cs
- EventNotify.cs
- BookmarkEventArgs.cs
- LogicalExpr.cs
- TemplatedWizardStep.cs
- _ServiceNameStore.cs
- XPathMultyIterator.cs
- SqlClientWrapperSmiStreamChars.cs
- ForceCopyBuildProvider.cs
- UserPreferenceChangingEventArgs.cs
- WebDisplayNameAttribute.cs
- IgnoreDeviceFilterElementCollection.cs