Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- TraceInternal.cs
- returneventsaver.cs
- MsmqAppDomainProtocolHandler.cs
- QueryOperator.cs
- XmlSchemaException.cs
- LinkedResourceCollection.cs
- TPLETWProvider.cs
- TreeNodeStyleCollection.cs
- CategoryGridEntry.cs
- OrCondition.cs
- CodeArrayCreateExpression.cs
- XLinq.cs
- MetabaseSettingsIis7.cs
- CollectionType.cs
- SpnegoTokenProvider.cs
- BuilderPropertyEntry.cs
- StringUtil.cs
- ColumnMapVisitor.cs
- DesignerLoader.cs
- httpserverutility.cs
- StorageScalarPropertyMapping.cs
- PageContentAsyncResult.cs
- XmlStreamNodeWriter.cs
- WmlListAdapter.cs
- DataRelationCollection.cs
- BackStopAuthenticationModule.cs
- PathHelper.cs
- DashStyle.cs
- NameTable.cs
- ToolBarOverflowPanel.cs
- PeerApplicationLaunchInfo.cs
- QueryExpr.cs
- sqlcontext.cs
- XDeferredAxisSource.cs
- MSG.cs
- InputGestureCollection.cs
- SortedList.cs
- TableItemStyle.cs
- ExpandSegmentCollection.cs
- UnsafeNativeMethods.cs
- MenuItemBinding.cs
- SQLRoleProvider.cs
- Application.cs
- GenericWebPart.cs
- DataGridViewHeaderCell.cs
- ColorMatrix.cs
- InputDevice.cs
- WindowsListViewGroupHelper.cs
- ObjectViewListener.cs
- KeyConstraint.cs
- BackgroundFormatInfo.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- SerializerProvider.cs
- XmlHelper.cs
- MgmtResManager.cs
- TextServicesContext.cs
- PerfCounterSection.cs
- DetailsViewCommandEventArgs.cs
- XmlSchemaParticle.cs
- HttpApplicationFactory.cs
- ResumeStoryboard.cs
- ComponentChangedEvent.cs
- QueryRelOp.cs
- WindowsFormsSectionHandler.cs
- XmlAutoDetectWriter.cs
- BaseParagraph.cs
- OpenFileDialog.cs
- SafeWaitHandle.cs
- View.cs
- WindowsUpDown.cs
- OneToOneMappingSerializer.cs
- SqlInternalConnection.cs
- TableItemStyle.cs
- RoleBoolean.cs
- ValidationSummary.cs
- PeerObject.cs
- XmlChildEnumerator.cs
- ListViewItemEventArgs.cs
- SinglePageViewer.cs
- SafeRightsManagementHandle.cs
- RequestDescription.cs
- XamlReader.cs
- cookiecollection.cs
- SapiRecognizer.cs
- ScrollBarAutomationPeer.cs
- SortedList.cs
- AutomationPropertyInfo.cs
- ReadOnlyCollectionBuilder.cs
- AssemblyLoader.cs
- ExpressionBuilderContext.cs
- DiscoveryCallbackBehavior.cs
- SelectorAutomationPeer.cs
- Deflater.cs
- MemoryPressure.cs
- PeerNearMe.cs
- SqlDataRecord.cs
- OpacityConverter.cs
- ISO2022Encoding.cs
- DecimalConverter.cs
- XmlAnyAttributeAttribute.cs