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 / 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
- RepeatBehavior.cs
- ObjectStateEntryDbDataRecord.cs
- sqlinternaltransaction.cs
- MonthChangedEventArgs.cs
- ObjectReaderCompiler.cs
- DtdParser.cs
- RectKeyFrameCollection.cs
- DataGridColumnCollection.cs
- DataGridViewRowCollection.cs
- ExternalFile.cs
- SchemaObjectWriter.cs
- InternalEnumValidator.cs
- TimeSpanValidator.cs
- CryptoKeySecurity.cs
- XmlEncoding.cs
- ObjectCache.cs
- SweepDirectionValidation.cs
- SchemaEntity.cs
- RichTextBox.cs
- StreamSecurityUpgradeAcceptor.cs
- HttpDictionary.cs
- Win32.cs
- Label.cs
- PageSettings.cs
- TemplatedWizardStep.cs
- TextEditor.cs
- WebConfigurationManager.cs
- AttributeCollection.cs
- WindowsListBox.cs
- ProviderIncompatibleException.cs
- UTF7Encoding.cs
- DomainConstraint.cs
- BinHexEncoding.cs
- ObjectParameterCollection.cs
- TheQuery.cs
- GorillaCodec.cs
- TriState.cs
- DataSourceView.cs
- SqlFormatter.cs
- ResourcesChangeInfo.cs
- ListViewAutomationPeer.cs
- CodeCompiler.cs
- DictionaryEntry.cs
- HyperLinkStyle.cs
- ValidatorAttribute.cs
- ProxyHwnd.cs
- mda.cs
- NotifyCollectionChangedEventArgs.cs
- BindableAttribute.cs
- AppSecurityManager.cs
- XpsTokenContext.cs
- TypeListConverter.cs
- BaseCollection.cs
- PageSettings.cs
- SingleSelectRootGridEntry.cs
- UriScheme.cs
- ClientCultureInfo.cs
- PeerNameRegistration.cs
- DescriptionAttribute.cs
- SessionStateModule.cs
- TextClipboardData.cs
- SmiSettersStream.cs
- DataGridViewLinkColumn.cs
- SoapMessage.cs
- BypassElementCollection.cs
- GeometryConverter.cs
- ITextView.cs
- SiteMapDataSourceView.cs
- HttpException.cs
- CellParaClient.cs
- DbDeleteCommandTree.cs
- DmlSqlGenerator.cs
- SecurityManager.cs
- SoapFault.cs
- RawStylusInputCustomDataList.cs
- SequentialUshortCollection.cs
- PolicyValidationException.cs
- MSHTMLHostUtil.cs
- WS2007FederationHttpBindingCollectionElement.cs
- UnmanagedHandle.cs
- ToolStripGrip.cs
- NotSupportedException.cs
- Events.cs
- _HeaderInfo.cs
- SvcMapFile.cs
- SessionStateContainer.cs
- PolyBezierSegment.cs
- SByte.cs
- ProxyHwnd.cs
- GeometryValueSerializer.cs
- MetadataCacheItem.cs
- InputLangChangeRequestEvent.cs
- GridSplitterAutomationPeer.cs
- PanelStyle.cs
- BindingContext.cs
- SafeRightsManagementQueryHandle.cs
- DataGridViewRowsAddedEventArgs.cs
- HandlerBase.cs
- StateDesigner.TransitionInfo.cs
- CodeNamespaceImportCollection.cs