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
- InstanceStoreQueryResult.cs
- DynamicValueConverter.cs
- UmAlQuraCalendar.cs
- SoapIgnoreAttribute.cs
- Msec.cs
- DataGridCaption.cs
- TraceSource.cs
- _ConnectionGroup.cs
- DataTableCollection.cs
- InternalUserCancelledException.cs
- ToolboxDataAttribute.cs
- DesignerListAdapter.cs
- HtmlShim.cs
- NameValuePair.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- EntityTypeEmitter.cs
- NewItemsContextMenuStrip.cs
- QilInvokeLateBound.cs
- ValidatorCollection.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- CodeCommentStatementCollection.cs
- FrameworkElement.cs
- CommandDevice.cs
- AssociatedControlConverter.cs
- ObjectListField.cs
- MessageOperationFormatter.cs
- RefExpr.cs
- DataColumnMappingCollection.cs
- BufferedGraphics.cs
- SemaphoreFullException.cs
- OracleTimeSpan.cs
- ContainerControl.cs
- TcpServerChannel.cs
- PersonalizationProviderCollection.cs
- MobileControlDesigner.cs
- PointAnimationClockResource.cs
- MyContact.cs
- DbConnectionOptions.cs
- WindowsProgressbar.cs
- DataGridPagerStyle.cs
- ExpressionCopier.cs
- PartialArray.cs
- MenuBase.cs
- AppDomainCompilerProxy.cs
- WindowHideOrCloseTracker.cs
- EventMemberCodeDomSerializer.cs
- ThicknessKeyFrameCollection.cs
- DescriptionAttribute.cs
- Wizard.cs
- Serializer.cs
- StringBlob.cs
- ChangePassword.cs
- FixedSOMLineRanges.cs
- SymmetricCryptoHandle.cs
- SqlError.cs
- ToolbarAUtomationPeer.cs
- DataGridItem.cs
- MessageQueueException.cs
- CodeIdentifier.cs
- XPathDocumentNavigator.cs
- CellCreator.cs
- UserControl.cs
- IntSecurity.cs
- PageCatalogPartDesigner.cs
- ObjectQueryState.cs
- WSMessageEncoding.cs
- X509RawDataKeyIdentifierClause.cs
- RuntimeConfigurationRecord.cs
- ClosableStream.cs
- Stacktrace.cs
- NoClickablePointException.cs
- OracleDateTime.cs
- DecimalStorage.cs
- EntityDataSourceDataSelectionPanel.cs
- WebEncodingValidatorAttribute.cs
- SiteMapDataSourceView.cs
- CompositeDataBoundControl.cs
- DataTable.cs
- ExternalFile.cs
- ViewGenResults.cs
- InputScopeConverter.cs
- SafeViewOfFileHandle.cs
- StateWorkerRequest.cs
- BitmapMetadata.cs
- X509Extension.cs
- ConfigXmlAttribute.cs
- SrgsRulesCollection.cs
- FormatException.cs
- QueueProcessor.cs
- FilterableAttribute.cs
- ContractBase.cs
- OpenTypeCommon.cs
- ProxyAttribute.cs
- SaveFileDialog.cs
- OdbcErrorCollection.cs
- SafeThreadHandle.cs
- EntitySetBaseCollection.cs
- WizardPanelChangingEventArgs.cs
- DiscoveryClientReferences.cs
- AutomationProperties.cs