Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.WorkflowServices / System / Workflow / ComponentModel / Design / HighlightOverlayGlyph.cs / 1305376 / HighlightOverlayGlyph.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Workflow.ComponentModel.Design { using System; using System.Collections.Generic; using System.Text; using System.Workflow.ComponentModel.Design; using System.Drawing; using System.Drawing.Drawing2D; using System.Runtime.InteropServices; //// This class provides the visualisation of the backdrop + hightlighted designer when // in highlight view. // [ComVisible(false)] internal class HighlightOverlayGlyph : DesignerGlyph { private Rectangle bounds; private ListhighlightedDesigners; public HighlightOverlayGlyph(Rectangle bounds, List highlightedDesigners) { this.HighlightedDesigners = highlightedDesigners; this.Bounds = bounds; } public Rectangle Bounds { get { return bounds; } set { bounds = value; } } public List HighlightedDesigners { get { return highlightedDesigners; } set { highlightedDesigners = value; } } protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle frameRect = Bounds; Rectangle shadowRect = frameRect; Color BaseColor = Color.FromArgb(150, 0, 0, 0); // dark semitransparent backdrop Color LightingColor = Color.FromArgb(150, 0, 0, 0); Brush frameBrush = new LinearGradientBrush(new Point(frameRect.Left, frameRect.Top), new Point(frameRect.Left, frameRect.Bottom), BaseColor, LightingColor); shadowRect = DropRoundedRectangleShadow(shadowRect, graphics); graphics.FillPath(frameBrush, RoundedRect(frameRect)); graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; foreach (ActivityDesigner highlightedDesigner in HighlightedDesigners) { DesignerPainter.PaintDesigner(highlightedDesigner, new ActivityDesignerPaintEventArgs(graphics, designer.Bounds, designer.Bounds, null)); } } private Rectangle DropRoundedRectangleShadow(Rectangle shadowRect, Graphics outputGraphics) { int shadowIntensity = 1; using (Pen shadowPen = new Pen(Color.FromArgb(shadowIntensity, 0, 0, 0))) { shadowPen.Width = 24; for (int i = 0; i < 12; i++) { outputGraphics.DrawPath(shadowPen, RoundedRect(shadowRect)); shadowPen.Color = Color.FromArgb(shadowIntensity - 1, 0, 0, 0); shadowIntensity += 2; shadowPen.Width = shadowPen.Width - 2;; } return shadowRect; } } private GraphicsPath RoundedRect(Rectangle frame) { GraphicsPath path = new GraphicsPath(); int radius = 1; int diameter = radius * 2; Rectangle arc = new Rectangle(frame.Left, frame.Top, diameter, diameter); path.AddArc(arc, 180, 90); arc.X = frame.Right - diameter; path.AddArc(arc, 270, 90); arc.Y = frame.Bottom - diameter; path.AddArc(arc, 0, 90); arc.X = frame.Left; path.AddArc(arc, 90, 90); path.CloseFigure(); return path; } } } // 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
- ObjectStateEntryBaseUpdatableDataRecord.cs
- PostBackTrigger.cs
- SqlUnionizer.cs
- ExpressionBindings.cs
- DynamicRendererThreadManager.cs
- SqlNamer.cs
- SQLInt16.cs
- PropertyPathConverter.cs
- SessionStateItemCollection.cs
- XmlCodeExporter.cs
- BindingCompleteEventArgs.cs
- SQLSingleStorage.cs
- Encoder.cs
- FlowPosition.cs
- EntityTypeEmitter.cs
- CacheVirtualItemsEvent.cs
- PartitionResolver.cs
- XmlSchemaRedefine.cs
- XamlTemplateSerializer.cs
- SimpleMailWebEventProvider.cs
- NameSpaceEvent.cs
- SchemaContext.cs
- ExpressionBindingCollection.cs
- ConfigLoader.cs
- PtsHost.cs
- XmlMapping.cs
- _OSSOCK.cs
- DecimalStorage.cs
- IxmlLineInfo.cs
- DateTimeUtil.cs
- DataGridViewToolTip.cs
- x509store.cs
- BamlRecordReader.cs
- ValidationEventArgs.cs
- X509ChainPolicy.cs
- MasterPage.cs
- XsdDateTime.cs
- AssemblyAttributes.cs
- MessagePropertyFilter.cs
- WebAdminConfigurationHelper.cs
- CompatibleComparer.cs
- WebBrowsableAttribute.cs
- HtmlInputSubmit.cs
- ConditionalAttribute.cs
- DataException.cs
- TextRangeEditLists.cs
- RawStylusSystemGestureInputReport.cs
- XmlElementList.cs
- FixUpCollection.cs
- EncodingDataItem.cs
- TransactionContextManager.cs
- SoapExtensionTypeElementCollection.cs
- GenericRootAutomationPeer.cs
- OpenTypeLayout.cs
- MobileErrorInfo.cs
- SamlConstants.cs
- OutOfMemoryException.cs
- SQLConvert.cs
- SizeKeyFrameCollection.cs
- AttachedPropertyInfo.cs
- TextServicesProperty.cs
- StyleHelper.cs
- PropertyToken.cs
- Lasso.cs
- ApplicationInterop.cs
- KeySpline.cs
- SessionEndingEventArgs.cs
- CompiledQueryCacheKey.cs
- XmlSchemaSimpleContentRestriction.cs
- HttpDebugHandler.cs
- FormsAuthenticationModule.cs
- ArrayElementGridEntry.cs
- DetailsViewInsertedEventArgs.cs
- ReadOnlyHierarchicalDataSourceView.cs
- RelationshipConverter.cs
- Serializer.cs
- PipeException.cs
- FileSecurity.cs
- ConstraintStruct.cs
- httpstaticobjectscollection.cs
- _BasicClient.cs
- SqlConnectionHelper.cs
- ClientData.cs
- Identifier.cs
- _NestedSingleAsyncResult.cs
- WindowHideOrCloseTracker.cs
- LoadGrammarCompletedEventArgs.cs
- MbpInfo.cs
- GCHandleCookieTable.cs
- MailAddress.cs
- MultiByteCodec.cs
- CompositeFontParser.cs
- ListBoxAutomationPeer.cs
- MemoryMappedFile.cs
- HebrewCalendar.cs
- ProxySimple.cs
- CodeBlockBuilder.cs
- InternalMappingException.cs
- PersonalizationStateInfoCollection.cs
- SqlDelegatedTransaction.cs