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 / RadioButtonStandardAdapter.cs / 1 / RadioButtonStandardAdapter.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 RadioButtonStandardAdapter : RadioButtonBaseAdapter { internal RadioButtonStandardAdapter(ButtonBase control) : base(control) {} internal override void PaintUp(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBox(e, layout); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } private new ButtonStandardAdapter ButtonAdapter { get { return ((ButtonStandardAdapter)base.ButtonAdapter); } } protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonStandardAdapter(Control); } #region Temp protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = CommonLayout(); layout.hintTextUp = false; layout.everettButtonCompat = !Application.RenderWithVisualStyles; // VSWhidbey 420870 if (Application.RenderWithVisualStyles) { using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics()) { layout.checkSize = RadioButtonRenderer.GetGlyphSize(g, RadioButtonRenderer.ConvertFromButtonState(GetState(), Control.MouseIsOver)).Width; } } 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 RadioButtonStandardAdapter : RadioButtonBaseAdapter { internal RadioButtonStandardAdapter(ButtonBase control) : base(control) {} internal override void PaintUp(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBox(e, layout); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } private new ButtonStandardAdapter ButtonAdapter { get { return ((ButtonStandardAdapter)base.ButtonAdapter); } } protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonStandardAdapter(Control); } #region Temp protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = CommonLayout(); layout.hintTextUp = false; layout.everettButtonCompat = !Application.RenderWithVisualStyles; // VSWhidbey 420870 if (Application.RenderWithVisualStyles) { using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics()) { layout.checkSize = RadioButtonRenderer.GetGlyphSize(g, RadioButtonRenderer.ConvertFromButtonState(GetState(), Control.MouseIsOver)).Width; } } 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
- ManagementClass.cs
- FloaterParaClient.cs
- VisualStateGroup.cs
- MatrixKeyFrameCollection.cs
- DrawingGroupDrawingContext.cs
- GridViewDeleteEventArgs.cs
- Timeline.cs
- EntityViewGenerationConstants.cs
- GeometryValueSerializer.cs
- Point3DValueSerializer.cs
- QilPatternVisitor.cs
- ByteKeyFrameCollection.cs
- FixedSOMTextRun.cs
- DbDataReader.cs
- ScrollableControl.cs
- UxThemeWrapper.cs
- CompiledELinqQueryState.cs
- GroupStyle.cs
- AsyncSerializedWorker.cs
- DictionarySectionHandler.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- BadImageFormatException.cs
- ProviderException.cs
- ContourSegment.cs
- formatter.cs
- SoapAttributes.cs
- SqlStatistics.cs
- DataGridViewEditingControlShowingEventArgs.cs
- IdentityHolder.cs
- GridViewCancelEditEventArgs.cs
- PeerConnector.cs
- ToolStripGripRenderEventArgs.cs
- CapabilitiesRule.cs
- FormatConvertedBitmap.cs
- XmlSchemaType.cs
- GlyphInfoList.cs
- PointHitTestResult.cs
- XmlSchemaNotation.cs
- DataSetUtil.cs
- TextBoxDesigner.cs
- DrawingImage.cs
- PerspectiveCamera.cs
- InkCollectionBehavior.cs
- IISMapPath.cs
- ControlCollection.cs
- RoleExceptions.cs
- XXXOnTypeBuilderInstantiation.cs
- XPathMultyIterator.cs
- login.cs
- Marshal.cs
- HttpGetProtocolImporter.cs
- UpdateTranslator.cs
- ComplexObject.cs
- LeftCellWrapper.cs
- RuleValidation.cs
- InternalConfigSettingsFactory.cs
- CapacityStreamGeometryContext.cs
- SettingsPropertyNotFoundException.cs
- WindowsSecurityTokenAuthenticator.cs
- WebPartConnectionsEventArgs.cs
- SqlDataSourceStatusEventArgs.cs
- ActivityPreviewDesigner.cs
- PeerCollaborationPermission.cs
- Clipboard.cs
- TaskFileService.cs
- XmlSerializationWriter.cs
- Activator.cs
- XmlAtomicValue.cs
- Expressions.cs
- DummyDataSource.cs
- DefaultPropertyAttribute.cs
- StatusInfoItem.cs
- ModelItemCollection.cs
- PassportAuthenticationModule.cs
- ComponentCollection.cs
- NodeLabelEditEvent.cs
- NavigatorOutput.cs
- coordinatorscratchpad.cs
- NativeConfigurationLoader.cs
- WebInvokeAttribute.cs
- WebPartEditVerb.cs
- CommonDialog.cs
- CheckedListBox.cs
- ResourcePart.cs
- DetailsViewInsertEventArgs.cs
- QilReference.cs
- ServiceInstallComponent.cs
- RegisteredHiddenField.cs
- ToolStripSeparatorRenderEventArgs.cs
- UnmanagedMemoryAccessor.cs
- XmlSchemas.cs
- XmlRawWriterWrapper.cs
- CellIdBoolean.cs
- Rect3DValueSerializer.cs
- Decorator.cs
- WinFormsComponentEditor.cs
- EventLog.cs
- TextTreeRootTextBlock.cs
- CompiledQueryCacheKey.cs
- MemberAssignment.cs