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
- ImmutableObjectAttribute.cs
- ObjectPersistData.cs
- WebServiceAttribute.cs
- ProviderConnectionPointCollection.cs
- IsolatedStorageSecurityState.cs
- UidManager.cs
- MenuItem.cs
- Axis.cs
- PostBackTrigger.cs
- ToolStripSettings.cs
- IdentifierService.cs
- CompiledQueryCacheKey.cs
- ItemsChangedEventArgs.cs
- UrlPropertyAttribute.cs
- SqlStream.cs
- SSmlParser.cs
- ResXResourceSet.cs
- GenericWebPart.cs
- DefaultMemberAttribute.cs
- InputMethodStateTypeInfo.cs
- bidPrivateBase.cs
- BinaryFormatter.cs
- Models.cs
- DataContractSerializer.cs
- PropertyPath.cs
- Column.cs
- Baml2006ReaderSettings.cs
- DataSourceExpressionCollection.cs
- DataColumnChangeEvent.cs
- MessageHeaderDescriptionCollection.cs
- XPathNode.cs
- DoWorkEventArgs.cs
- DesigntimeLicenseContextSerializer.cs
- GeneralTransform3D.cs
- cookie.cs
- ImageMap.cs
- ListViewCommandEventArgs.cs
- DataGridDesigner.cs
- OracleDataReader.cs
- VirtualizedItemProviderWrapper.cs
- ArrayList.cs
- ProxyAssemblyNotLoadedException.cs
- TransportElement.cs
- DesignerHierarchicalDataSourceView.cs
- BufferedReceiveManager.cs
- DataTrigger.cs
- SecureStringHasher.cs
- SrgsToken.cs
- AssertSection.cs
- XmlBinaryReader.cs
- TransactionalPackage.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- UserThread.cs
- AddDataControlFieldDialog.cs
- TemplatedMailWebEventProvider.cs
- InvokeHandlers.cs
- Operator.cs
- InfiniteIntConverter.cs
- Size.cs
- DocumentViewer.cs
- BaseHashHelper.cs
- FilterElement.cs
- TransactedBatchContext.cs
- ConfigurationStrings.cs
- BufferedStream.cs
- DataGridViewIntLinkedList.cs
- CacheMode.cs
- OneToOneMappingSerializer.cs
- IntegerValidatorAttribute.cs
- TableStyle.cs
- FlowDocumentReaderAutomationPeer.cs
- CollectionViewGroup.cs
- StorageComplexPropertyMapping.cs
- ExpressionSelection.cs
- QilGenerator.cs
- OperationSelectorBehavior.cs
- NamedElement.cs
- AsymmetricSignatureFormatter.cs
- ADMembershipUser.cs
- StorageTypeMapping.cs
- MetaColumn.cs
- RoleGroupCollection.cs
- ExceptionValidationRule.cs
- SchemaNames.cs
- Timer.cs
- DocumentGrid.cs
- StringStorage.cs
- BorderGapMaskConverter.cs
- BinaryObjectReader.cs
- WorkBatch.cs
- PreservationFileReader.cs
- ToolStripDropDownClosingEventArgs.cs
- UIElement3D.cs
- NegotiateStream.cs
- CompilationUtil.cs
- loginstatus.cs
- GlyphRunDrawing.cs
- GenericRootAutomationPeer.cs
- Decoder.cs
- DesignSurface.cs