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
- ProviderConnectionPointCollection.cs
- DataGridViewCellCancelEventArgs.cs
- ParameterElement.cs
- EmptyEnumerable.cs
- DesignerDataSchemaClass.cs
- BamlLocalizer.cs
- BamlResourceContent.cs
- TypeElement.cs
- SafeBuffer.cs
- PropertyValueChangedEvent.cs
- HotSpotCollection.cs
- TaskCanceledException.cs
- HttpModuleAction.cs
- MetadataFile.cs
- X500Name.cs
- WebPartDescriptionCollection.cs
- ValidationError.cs
- SetterBaseCollection.cs
- CopyCodeAction.cs
- TreeIterator.cs
- DataGridColumnDropSeparator.cs
- DataGridViewCellConverter.cs
- sqlnorm.cs
- WebBrowserDesigner.cs
- IdentityHolder.cs
- SqlTriggerAttribute.cs
- WebPartVerbCollection.cs
- GeneralTransform.cs
- ManualResetEvent.cs
- ContentPosition.cs
- XmlElementList.cs
- FillErrorEventArgs.cs
- XmlSchemaChoice.cs
- ControlParser.cs
- MultitargetingHelpers.cs
- MediaSystem.cs
- DockPanel.cs
- ReadOnlyHierarchicalDataSourceView.cs
- XsdValidatingReader.cs
- LocalBuilder.cs
- ClrProviderManifest.cs
- DragDeltaEventArgs.cs
- ProgressBar.cs
- OrderedDictionary.cs
- HashRepartitionStream.cs
- ListMarkerSourceInfo.cs
- xdrvalidator.cs
- EditingCommands.cs
- CssStyleCollection.cs
- Events.cs
- ClientScriptManager.cs
- LogExtent.cs
- Types.cs
- TableLayout.cs
- Parser.cs
- TextFormatterContext.cs
- IsolatedStorageFileStream.cs
- PropertyGridCommands.cs
- TypedRowGenerator.cs
- BinaryObjectInfo.cs
- TextOptions.cs
- DateTimeAutomationPeer.cs
- ExpressionBuilder.cs
- GenericUriParser.cs
- configsystem.cs
- CodeAssignStatement.cs
- SqlMetaData.cs
- CacheDict.cs
- WebPartConnectionsCloseVerb.cs
- ClientConfigurationHost.cs
- UInt16.cs
- ContainerControl.cs
- DiagnosticsConfiguration.cs
- KeyedCollection.cs
- ExpressionBuilderCollection.cs
- HtmlTableCell.cs
- ToolStripProgressBar.cs
- DispatchOperation.cs
- FactoryGenerator.cs
- TemplatedAdorner.cs
- PluralizationService.cs
- RangeExpression.cs
- ThreadExceptionDialog.cs
- Helpers.cs
- OperationPickerDialog.cs
- CheckBox.cs
- BitmapFrameEncode.cs
- Normalization.cs
- GestureRecognizer.cs
- NameObjectCollectionBase.cs
- ProfileGroupSettings.cs
- WindowsStartMenu.cs
- SamlSubject.cs
- WorkflowViewStateService.cs
- LineProperties.cs
- LinearGradientBrush.cs
- ErrorLog.cs
- MouseBinding.cs
- WindowCollection.cs
- XmlMtomWriter.cs