Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- XPathAxisIterator.cs
- StorageEntityContainerMapping.cs
- Converter.cs
- MetadataPropertyCollection.cs
- MetafileHeader.cs
- AssociationType.cs
- TypeDefinition.cs
- PropertyMapper.cs
- SqlParameter.cs
- TableFieldsEditor.cs
- SizeAnimationUsingKeyFrames.cs
- OutputCacheSection.cs
- XmlSchemaInfo.cs
- MemberPath.cs
- TdsParserSafeHandles.cs
- RepeatButtonAutomationPeer.cs
- Atom10FeedFormatter.cs
- TextServicesCompartment.cs
- WebConfigurationManager.cs
- JavaScriptString.cs
- RoleManagerEventArgs.cs
- GeneratedContractType.cs
- EntityAdapter.cs
- ContentPathSegment.cs
- XmlNodeReader.cs
- MappableObjectManager.cs
- StateChangeEvent.cs
- DataGridViewButtonColumn.cs
- LineVisual.cs
- UnsafeNativeMethods.cs
- AssemblyEvidenceFactory.cs
- EqualityComparer.cs
- DataGridViewDataErrorEventArgs.cs
- HtmlInputControl.cs
- RayHitTestParameters.cs
- TypefaceCollection.cs
- HeaderedItemsControl.cs
- Menu.cs
- X509Certificate2.cs
- RoleBoolean.cs
- ProcessModelInfo.cs
- SystemIcons.cs
- CodeMemberEvent.cs
- DataGridViewColumnConverter.cs
- JournalEntry.cs
- OdbcRowUpdatingEvent.cs
- MediaCommands.cs
- SqlCachedBuffer.cs
- Encoder.cs
- Rules.cs
- ServiceParser.cs
- Collection.cs
- TypeSystemHelpers.cs
- VirtualPathProvider.cs
- Sorting.cs
- GeneralTransform3DTo2DTo3D.cs
- XPathDocument.cs
- XmlEventCache.cs
- OSEnvironmentHelper.cs
- FileRecordSequenceCompletedAsyncResult.cs
- ADRoleFactoryConfiguration.cs
- ConfigXmlCDataSection.cs
- CodePropertyReferenceExpression.cs
- DictionaryContent.cs
- WasAdminWrapper.cs
- TextRenderer.cs
- EventBuilder.cs
- NotSupportedException.cs
- ResolveCompletedEventArgs.cs
- WizardForm.cs
- EventLogEntryCollection.cs
- SafeNativeMethodsCLR.cs
- VirtualPathUtility.cs
- TrustLevel.cs
- KeyBinding.cs
- ResourceKey.cs
- BinaryConverter.cs
- RtfFormatStack.cs
- DbMetaDataCollectionNames.cs
- UnaryExpression.cs
- PropertyPathConverter.cs
- InplaceBitmapMetadataWriter.cs
- TextTreeUndo.cs
- XmlSchemaAnnotation.cs
- InputScopeNameConverter.cs
- FixedSOMTableRow.cs
- HtmlInputButton.cs
- Operator.cs
- BitmapFrameEncode.cs
- ClearTypeHintValidation.cs
- WindowsButton.cs
- MethodBody.cs
- OdbcError.cs
- DesignerLoader.cs
- Select.cs
- ErrorHandlerFaultInfo.cs
- SqlBooleanMismatchVisitor.cs
- FileSystemInfo.cs
- DataGridColumnEventArgs.cs
- DataTablePropertyDescriptor.cs