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
- VirtualStackFrame.cs
- _CookieModule.cs
- BinaryObjectReader.cs
- ProfileSection.cs
- ImageField.cs
- ColumnCollection.cs
- XmlReader.cs
- PropertyValueChangedEvent.cs
- LinearGradientBrush.cs
- RenamedEventArgs.cs
- XamlStyleSerializer.cs
- XsdBuildProvider.cs
- FunctionMappingTranslator.cs
- InsufficientMemoryException.cs
- DebugController.cs
- ExceptionUtil.cs
- ResourceLoader.cs
- RtfToXamlReader.cs
- Queue.cs
- PropertyEntry.cs
- MessageQueueCriteria.cs
- WebCategoryAttribute.cs
- DocComment.cs
- ParseChildrenAsPropertiesAttribute.cs
- TemplateControlBuildProvider.cs
- KeyValuePairs.cs
- RequestCachePolicyConverter.cs
- ToolStripInSituService.cs
- NotifyIcon.cs
- ProfileBuildProvider.cs
- IProvider.cs
- OdbcStatementHandle.cs
- XamlFigureLengthSerializer.cs
- ZoomPercentageConverter.cs
- PreviewKeyDownEventArgs.cs
- OwnerDrawPropertyBag.cs
- RNGCryptoServiceProvider.cs
- RightsManagementEncryptedStream.cs
- ClientOptions.cs
- EventLog.cs
- FieldAccessException.cs
- DynamicRenderer.cs
- BoundPropertyEntry.cs
- Model3D.cs
- PanelDesigner.cs
- DataViewManagerListItemTypeDescriptor.cs
- mediapermission.cs
- RegistrationServices.cs
- BuildResultCache.cs
- OracleConnectionStringBuilder.cs
- DataSourceControlBuilder.cs
- MimePart.cs
- FixedSOMImage.cs
- GroupDescription.cs
- PropertyRecord.cs
- InProcStateClientManager.cs
- ExternalFile.cs
- ConfigXmlDocument.cs
- WebServiceHost.cs
- Rules.cs
- StackSpiller.Generated.cs
- OleDbConnectionFactory.cs
- OleDbCommand.cs
- ToolStripSplitButton.cs
- DesignerEditorPartChrome.cs
- UnsafeNativeMethods.cs
- RegistrationServices.cs
- SchemaMapping.cs
- DefaultValueAttribute.cs
- CreationContext.cs
- AtomServiceDocumentSerializer.cs
- CapabilitiesState.cs
- IPAddress.cs
- Choices.cs
- GACIdentityPermission.cs
- TriState.cs
- TextContainerHelper.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- BlockUIContainer.cs
- DerivedKeySecurityToken.cs
- SafeMarshalContext.cs
- SchemaTypeEmitter.cs
- VScrollProperties.cs
- ChannelPool.cs
- DataListItemCollection.cs
- Terminate.cs
- SvcFileManager.cs
- URLIdentityPermission.cs
- RegisteredArrayDeclaration.cs
- ReadOnlyTernaryTree.cs
- BuilderPropertyEntry.cs
- ConnectionManagementElementCollection.cs
- RegisteredDisposeScript.cs
- RoleService.cs
- Bidi.cs
- DispatcherHookEventArgs.cs
- ButtonField.cs
- WebHttpDispatchOperationSelector.cs
- HelpInfo.cs
- TextBoxLine.cs