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
- RemotingHelper.cs
- PrimarySelectionAdorner.cs
- TextDecorationCollection.cs
- EnterpriseServicesHelper.cs
- GridViewUpdatedEventArgs.cs
- PageSettings.cs
- WinInetCache.cs
- WaitHandleCannotBeOpenedException.cs
- SkinBuilder.cs
- Cursor.cs
- FormsAuthenticationModule.cs
- CroppedBitmap.cs
- DbMetaDataFactory.cs
- WaitingCursor.cs
- DataGridHeaderBorder.cs
- safex509handles.cs
- ActiveDocumentEvent.cs
- SmtpClient.cs
- SharedConnectionWorkflowTransactionService.cs
- CharacterShapingProperties.cs
- InvokeBase.cs
- EdmConstants.cs
- COM2ICategorizePropertiesHandler.cs
- XmlMemberMapping.cs
- CompiledRegexRunner.cs
- Brushes.cs
- SelectedDatesCollection.cs
- SqlTypeConverter.cs
- StreamResourceInfo.cs
- DeadCharTextComposition.cs
- BitmapEffectOutputConnector.cs
- TemplateBamlRecordReader.cs
- PassportAuthentication.cs
- MethodCallTranslator.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- ObjectListShowCommandsEventArgs.cs
- ErrorFormatterPage.cs
- ZipIOCentralDirectoryBlock.cs
- Table.cs
- SystemIPInterfaceProperties.cs
- BatchParser.cs
- TextEncodedRawTextWriter.cs
- HMACSHA256.cs
- NullReferenceException.cs
- DeobfuscatingStream.cs
- XmlSchemaObjectCollection.cs
- WeakReference.cs
- CheckBoxPopupAdapter.cs
- smtpconnection.cs
- CopyNodeSetAction.cs
- DbSetClause.cs
- WorkflowTimerService.cs
- Clock.cs
- MessageHeaders.cs
- UnicodeEncoding.cs
- ContainerTracking.cs
- DataStreams.cs
- __Filters.cs
- MetadataProperty.cs
- CfgParser.cs
- BrowserDefinitionCollection.cs
- StylusSystemGestureEventArgs.cs
- TableSectionStyle.cs
- UnitySerializationHolder.cs
- DataSysAttribute.cs
- QueryTask.cs
- VideoDrawing.cs
- ThemeDictionaryExtension.cs
- ListenerAdaptersInstallComponent.cs
- RealizationContext.cs
- ToolboxItemFilterAttribute.cs
- ResetableIterator.cs
- DbProviderFactoriesConfigurationHandler.cs
- AtlasWeb.Designer.cs
- BitmapFrame.cs
- FigureParagraph.cs
- Soap12FormatExtensions.cs
- NodeLabelEditEvent.cs
- FixedDocumentPaginator.cs
- Material.cs
- StickyNoteContentControl.cs
- MouseButtonEventArgs.cs
- OleDbMetaDataFactory.cs
- QilName.cs
- RadioButtonBaseAdapter.cs
- SecurityUtils.cs
- Classification.cs
- DrawItemEvent.cs
- RegistryConfigurationProvider.cs
- CssTextWriter.cs
- DocobjHost.cs
- ParserExtension.cs
- _UncName.cs
- AnimationLayer.cs
- OutputCacheProfile.cs
- UniqueConstraint.cs
- HttpListenerRequestUriBuilder.cs
- BamlTreeUpdater.cs
- LogicalExpr.cs
- WebMessageFormatHelper.cs