Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- Enum.cs
- ExceptionUtil.cs
- ListViewInsertEventArgs.cs
- cookiecollection.cs
- Literal.cs
- ColumnMapTranslator.cs
- StylusCollection.cs
- MenuItemStyleCollectionEditor.cs
- StdValidatorsAndConverters.cs
- InfoCardListRequest.cs
- FrugalList.cs
- ByteConverter.cs
- UnknownWrapper.cs
- EventlogProvider.cs
- EventLogEntry.cs
- RuntimeEnvironment.cs
- Stroke2.cs
- ProcessModelSection.cs
- PeerNearMe.cs
- SqlTypesSchemaImporter.cs
- SingleAnimationBase.cs
- SiteMapSection.cs
- CFGGrammar.cs
- DbModificationCommandTree.cs
- DelegatingTypeDescriptionProvider.cs
- InheritanceAttribute.cs
- RemoveStoryboard.cs
- PolyBezierSegment.cs
- CreatingCookieEventArgs.cs
- FieldNameLookup.cs
- SqlDataSourceSelectingEventArgs.cs
- BamlReader.cs
- AbsoluteQuery.cs
- GeneralTransformCollection.cs
- DataGridViewColumnConverter.cs
- HttpModulesSection.cs
- ProcessModuleDesigner.cs
- SQLStringStorage.cs
- DataBoundControlHelper.cs
- RawStylusSystemGestureInputReport.cs
- ChannelSinkStacks.cs
- FatalException.cs
- RotateTransform3D.cs
- TrackBar.cs
- CollectionViewGroupInternal.cs
- RawUIStateInputReport.cs
- SemaphoreSecurity.cs
- _TLSstream.cs
- StorageComplexPropertyMapping.cs
- ToolBar.cs
- IDispatchConstantAttribute.cs
- DataGridViewRowHeaderCell.cs
- KeyPressEvent.cs
- ExecutorLocksHeldException.cs
- WrapPanel.cs
- ToolboxSnapDragDropEventArgs.cs
- SwitchLevelAttribute.cs
- WebPartCatalogAddVerb.cs
- WSHttpBindingElement.cs
- InternalPermissions.cs
- ElasticEase.cs
- ColorTransform.cs
- XmlnsPrefixAttribute.cs
- ModelUIElement3D.cs
- Operand.cs
- Camera.cs
- FtpRequestCacheValidator.cs
- TraceContextEventArgs.cs
- MembershipUser.cs
- CellIdBoolean.cs
- SkinBuilder.cs
- ResourceAttributes.cs
- Triplet.cs
- ProfileGroupSettingsCollection.cs
- AuthenticationManager.cs
- HierarchicalDataTemplate.cs
- IFlowDocumentViewer.cs
- CollectionConverter.cs
- DrawingContextDrawingContextWalker.cs
- ToolStripPanel.cs
- StringUtil.cs
- VoiceSynthesis.cs
- AnnotationHelper.cs
- CodeAttributeDeclaration.cs
- LinqDataSourceView.cs
- DispatchChannelSink.cs
- CSharpCodeProvider.cs
- DefaultPropertyAttribute.cs
- TiffBitmapDecoder.cs
- CloseSequence.cs
- DataConnectionHelper.cs
- BaseUriHelper.cs
- RecognizedWordUnit.cs
- QilName.cs
- IconBitmapDecoder.cs
- CollectionContainer.cs
- ListViewCancelEventArgs.cs
- BindToObject.cs
- FigureHelper.cs
- XmlExtensionFunction.cs