Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / WinForms / Managed / System / WinForms / ToolStripProfessionalLowResolutionRenderer.cs / 1 / ToolStripProfessionalLowResolutionRenderer.cs
namespace System.Windows.Forms { using System; using System.Drawing; internal class ToolStripProfessionalLowResolutionRenderer : ToolStripProfessionalRenderer { public ToolStripProfessionalLowResolutionRenderer() { } internal override ToolStripRenderer RendererOverride { get { return null; } } protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { if( e.ToolStrip is ToolStripDropDown ) { base.OnRenderToolStripBackground(e); } } protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { if(e.ToolStrip is MenuStrip) { return; } else if (e.ToolStrip is StatusStrip ) { return; } else if (e.ToolStrip is ToolStripDropDown) { base.OnRenderToolStripBorder(e); } else { RenderToolStripBorderInternal(e); } } private void RenderToolStripBorderInternal(ToolStripRenderEventArgs e) { Rectangle bounds = new Rectangle(Point.Empty, e.ToolStrip.Size); Graphics g = e.Graphics; // have to create a pen here because we're not allowed to modify the SystemPens. using( Pen p = new Pen(SystemColors.ButtonShadow) ) { p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; bool oddWidth = ((bounds.Width & 0x1) == 0x1); bool oddHeight = ((bounds.Height & 0x1) == 0x1); int indent = 2; // top g.DrawLine(p, bounds.X + indent, bounds.Y, bounds.Width - 1, bounds.Y); // bottom g.DrawLine(p, bounds.X + indent, bounds.Height - 1, bounds.Width - 1, bounds.Height - 1); // left g.DrawLine(p, bounds.X, bounds.Y + indent, bounds.X, bounds.Height - 1); // right g.DrawLine(p, bounds.Width - 1, bounds.Y + indent, bounds.Width - 1, bounds.Height - 1); // connecting pixels // top left conntecting pixel - always drawn g.FillRectangle(SystemBrushes.ButtonShadow, new Rectangle(1, 1, 1, 1)); if (oddWidth) { // top right pixel g.FillRectangle(SystemBrushes.ButtonShadow, new Rectangle(bounds.Width - 2, 1, 1, 1)); } // bottom conntecting pixels - drawn only if height is odd if(oddHeight) { // bottom left g.FillRectangle(SystemBrushes.ButtonShadow, new Rectangle(1, bounds.Height - 2, 1, 1)); } // top and bottom right conntecting pixel - drawn only if height and width are odd if( oddHeight && oddWidth ) { // bottom right g.FillRectangle(SystemBrushes.ButtonShadow, new Rectangle(bounds.Width - 2, bounds.Height - 2, 1, 1)); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebPartMovingEventArgs.cs
- ListViewItem.cs
- WebBrowserContainer.cs
- UnmanagedHandle.cs
- ValueType.cs
- DbParameterHelper.cs
- DrawingServices.cs
- DataServiceExpressionVisitor.cs
- RoleGroup.cs
- StickyNote.cs
- ApplicationId.cs
- Label.cs
- StorageMappingFragment.cs
- APCustomTypeDescriptor.cs
- SQLInt32Storage.cs
- JoinQueryOperator.cs
- COM2PropertyBuilderUITypeEditor.cs
- Timer.cs
- TextServicesDisplayAttribute.cs
- XmlAttributeCollection.cs
- ReadOnlyAttribute.cs
- SessionIDManager.cs
- ReadingWritingEntityEventArgs.cs
- NameScopePropertyAttribute.cs
- QilXmlReader.cs
- ControlPersister.cs
- AppliedDeviceFiltersDialog.cs
- XmlAttributeHolder.cs
- ZipIOExtraFieldZip64Element.cs
- StoreItemCollection.Loader.cs
- ChildrenQuery.cs
- BamlLocalizer.cs
- GridViewItemAutomationPeer.cs
- FixedPageStructure.cs
- Crc32.cs
- CustomErrorsSectionWrapper.cs
- serverconfig.cs
- CopyNodeSetAction.cs
- TCPClient.cs
- CaseInsensitiveComparer.cs
- DynamicHyperLink.cs
- DetailsViewDeleteEventArgs.cs
- TemplateXamlParser.cs
- RadioButtonFlatAdapter.cs
- ECDsa.cs
- RandomNumberGenerator.cs
- mediaeventargs.cs
- MsmqActivation.cs
- InternalMappingException.cs
- TransportChannelListener.cs
- SmtpReplyReaderFactory.cs
- CheckBoxField.cs
- BindingMemberInfo.cs
- FileChangesMonitor.cs
- RelationshipNavigation.cs
- OrderByBuilder.cs
- ConnectionPoolManager.cs
- DesignerContextDescriptor.cs
- DropShadowBitmapEffect.cs
- OpenTypeLayoutCache.cs
- RegexNode.cs
- HtmlTableRow.cs
- WebServicesSection.cs
- webclient.cs
- SynchronizationHandlesCodeDomSerializer.cs
- RelatedCurrencyManager.cs
- RegisteredExpandoAttribute.cs
- DbProviderFactoriesConfigurationHandler.cs
- XPathBinder.cs
- TextElementEditingBehaviorAttribute.cs
- KeyEvent.cs
- SafeFileMappingHandle.cs
- PanelStyle.cs
- WindowsSysHeader.cs
- ServiceDescriptionSerializer.cs
- ServiceErrorHandler.cs
- WebServiceMethodData.cs
- SHA1CryptoServiceProvider.cs
- ExpressionStringBuilder.cs
- MultitargetUtil.cs
- RelationshipConstraintValidator.cs
- FileUtil.cs
- SqlNotificationEventArgs.cs
- Function.cs
- FunctionNode.cs
- HtmlLiteralTextAdapter.cs
- ProtectedConfigurationSection.cs
- DynamicArgumentDialog.cs
- listitem.cs
- IssuanceLicense.cs
- clipboard.cs
- UserCancellationException.cs
- WebScriptEnablingElement.cs
- SourceElementsCollection.cs
- SmiMetaDataProperty.cs
- TraceLevelStore.cs
- Literal.cs
- HwndSubclass.cs
- AbstractDataSvcMapFileLoader.cs
- SQlBooleanStorage.cs