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
- DebugView.cs
- XPathQueryGenerator.cs
- SrgsText.cs
- OracleBoolean.cs
- WebDescriptionAttribute.cs
- EventSourceCreationData.cs
- XPathNode.cs
- IdnElement.cs
- AssociatedControlConverter.cs
- TabItemWrapperAutomationPeer.cs
- CloseSequenceResponse.cs
- MemberHolder.cs
- LockedBorderGlyph.cs
- SqlDependencyListener.cs
- MailAddress.cs
- IPipelineRuntime.cs
- XmlNamespaceDeclarationsAttribute.cs
- SigningCredentials.cs
- WindowsTreeView.cs
- TraceUtils.cs
- XXXOnTypeBuilderInstantiation.cs
- HttpEncoderUtility.cs
- SamlSecurityTokenAuthenticator.cs
- SynchronousReceiveElement.cs
- Sentence.cs
- BookmarkUndoUnit.cs
- Model3D.cs
- InstanceNotFoundException.cs
- PropertyStore.cs
- MsmqAppDomainProtocolHandler.cs
- TypedDataSourceCodeGenerator.cs
- Expressions.cs
- ProcessRequestArgs.cs
- peernodestatemanager.cs
- LayoutEngine.cs
- CancelAsyncOperationRequest.cs
- Fx.cs
- MetabaseReader.cs
- FunctionMappingTranslator.cs
- InstanceDataCollection.cs
- NestedContainer.cs
- FileDialog.cs
- ProcessActivityTreeOptions.cs
- SelectionPattern.cs
- HandlerBase.cs
- ProviderCommandInfoUtils.cs
- LayoutEditorPart.cs
- QueryCacheKey.cs
- WindowsTreeView.cs
- TypeHelpers.cs
- PagesSection.cs
- RefreshPropertiesAttribute.cs
- SubpageParaClient.cs
- Html32TextWriter.cs
- grammarelement.cs
- SafeProcessHandle.cs
- Line.cs
- QilXmlReader.cs
- ECDiffieHellmanPublicKey.cs
- SmtpFailedRecipientException.cs
- EntityDesignerUtils.cs
- KeyFrames.cs
- EtwTrace.cs
- DataFieldConverter.cs
- Converter.cs
- ImageSource.cs
- RelationshipConverter.cs
- TypeDescriptor.cs
- SqlReferenceCollection.cs
- LockedHandleGlyph.cs
- CacheDependency.cs
- ManifestResourceInfo.cs
- MetaDataInfo.cs
- ArrayMergeHelper.cs
- ProcessInfo.cs
- ReturnType.cs
- ConfigXmlReader.cs
- TreeNodeStyleCollection.cs
- RuntimeArgumentHandle.cs
- SQLDateTimeStorage.cs
- Encoding.cs
- NativeActivityFaultContext.cs
- LinqDataSourceHelper.cs
- LZCodec.cs
- _IPv4Address.cs
- EventProviderTraceListener.cs
- ColumnCollection.cs
- RouteItem.cs
- Console.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- CalendarDay.cs
- Compiler.cs
- KernelTypeValidation.cs
- WpfGeneratedKnownTypes.cs
- TransformCollection.cs
- UrlMapping.cs
- EarlyBoundInfo.cs
- Canvas.cs
- ManagementEventArgs.cs
- DesignerExtenders.cs