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
- ClassGenerator.cs
- CharacterMetrics.cs
- Pens.cs
- SmiEventSink.cs
- SoapDocumentServiceAttribute.cs
- Stream.cs
- ControlEvent.cs
- SystemTcpConnection.cs
- ComponentResourceManager.cs
- RemotingException.cs
- ImageIndexConverter.cs
- DockingAttribute.cs
- XmlSchemaSet.cs
- ProfileEventArgs.cs
- DbSourceCommand.cs
- QilScopedVisitor.cs
- InvalidAsynchronousStateException.cs
- ServiceThrottle.cs
- DataGridViewRowPostPaintEventArgs.cs
- CounterCreationData.cs
- ElementProxy.cs
- SoapIgnoreAttribute.cs
- SqlCacheDependencySection.cs
- WorkItem.cs
- SystemIcons.cs
- OperatingSystem.cs
- BitmapCodecInfoInternal.cs
- sqlpipe.cs
- Clause.cs
- IncrementalCompileAnalyzer.cs
- XmlSchemaValidator.cs
- printdlgexmarshaler.cs
- XamlDesignerSerializationManager.cs
- UrlMappingsSection.cs
- RenderTargetBitmap.cs
- InputReferenceExpression.cs
- ConfigurationSectionGroup.cs
- InvalidProgramException.cs
- GeometryModel3D.cs
- HostSecurityManager.cs
- Utils.cs
- PageCatalogPart.cs
- ConfigurationFileMap.cs
- XmlSchemaComplexType.cs
- XmlBindingWorker.cs
- ILGenerator.cs
- IndexingContentUnit.cs
- GenerateHelper.cs
- DataComponentGenerator.cs
- Thickness.cs
- XsdBuilder.cs
- TimerElapsedEvenArgs.cs
- Popup.cs
- OperationDescriptionCollection.cs
- SystemResources.cs
- HtmlShimManager.cs
- FrameworkReadOnlyPropertyMetadata.cs
- IssuanceLicense.cs
- RangeValuePattern.cs
- AxisAngleRotation3D.cs
- DuplicateMessageDetector.cs
- DataGridViewRowPrePaintEventArgs.cs
- Helpers.cs
- IPHostEntry.cs
- ResourceReferenceKeyNotFoundException.cs
- GetChildSubtree.cs
- GeometryCombineModeValidation.cs
- BufferedGraphicsManager.cs
- SmiTypedGetterSetter.cs
- InputLanguageManager.cs
- StorageMappingItemLoader.cs
- FontFaceLayoutInfo.cs
- MarkerProperties.cs
- Invariant.cs
- SplitterCancelEvent.cs
- AsymmetricSecurityProtocolFactory.cs
- FontStretchConverter.cs
- XmlCharacterData.cs
- ProfileParameter.cs
- WindowsFormsHelpers.cs
- CodeLinePragma.cs
- DetailsViewUpdatedEventArgs.cs
- webclient.cs
- PackageProperties.cs
- RoleManagerModule.cs
- GridViewCellAutomationPeer.cs
- ConfigXmlDocument.cs
- SlipBehavior.cs
- ApplicationProxyInternal.cs
- BitmapMetadataBlob.cs
- RuntimeResourceSet.cs
- TemplateBaseAction.cs
- XmlKeywords.cs
- CopyEncoder.cs
- ComAdminInterfaces.cs
- ToolStripButton.cs
- DataGridViewIntLinkedList.cs
- WebPartUtil.cs
- ActivityWithResult.cs
- ConfigurationLocation.cs