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
- AxParameterData.cs
- ContainerParagraph.cs
- ArrayElementGridEntry.cs
- ViewGenerator.cs
- DataGridHeaderBorder.cs
- CatalogPart.cs
- CompositeDuplexBindingElementImporter.cs
- DeploymentSection.cs
- TdsParameterSetter.cs
- VersionPair.cs
- Tablet.cs
- PhonemeConverter.cs
- StylusLogic.cs
- ProfileSettings.cs
- CheckBoxList.cs
- PageThemeCodeDomTreeGenerator.cs
- LiteralControl.cs
- ArrayList.cs
- SafePEFileHandle.cs
- ClientSponsor.cs
- Single.cs
- FolderLevelBuildProvider.cs
- NavigationProperty.cs
- DynamicValueConverter.cs
- StringAnimationBase.cs
- Matrix3DValueSerializer.cs
- WindowsMenu.cs
- EntityDataSourceWrapper.cs
- XmlNode.cs
- DataGridBoolColumn.cs
- TreeViewItem.cs
- DbConnectionHelper.cs
- HTTPNotFoundHandler.cs
- EntityFrameworkVersions.cs
- CursorConverter.cs
- SystemIPInterfaceStatistics.cs
- TrustManager.cs
- NetCodeGroup.cs
- Int32Storage.cs
- CharKeyFrameCollection.cs
- PolicyException.cs
- ProxyManager.cs
- RayMeshGeometry3DHitTestResult.cs
- ContextProperty.cs
- RequestDescription.cs
- InlineCollection.cs
- ZoomPercentageConverter.cs
- ZipIOCentralDirectoryBlock.cs
- SiteMapSection.cs
- StructuralType.cs
- TabPage.cs
- WizardDesigner.cs
- IfAction.cs
- CounterCreationDataCollection.cs
- Line.cs
- EntityCommandDefinition.cs
- TextFormatter.cs
- SafeProcessHandle.cs
- ToolStripOverflowButton.cs
- parserscommon.cs
- FixUp.cs
- InvalidateEvent.cs
- entityreference_tresulttype.cs
- ErrorWebPart.cs
- WebPartVerbsEventArgs.cs
- SerializationInfo.cs
- Model3DGroup.cs
- GenerateScriptTypeAttribute.cs
- Attributes.cs
- EdmTypeAttribute.cs
- Privilege.cs
- RelatedPropertyManager.cs
- EventLogConfiguration.cs
- NameValuePermission.cs
- SuppressedPackageProperties.cs
- ListChunk.cs
- DesignerVerbToolStripMenuItem.cs
- SettingsPropertyValue.cs
- ExpressionVisitor.cs
- DataExchangeServiceBinder.cs
- WmlSelectionListAdapter.cs
- ObjectView.cs
- OutputCacheSection.cs
- ZipIOExtraField.cs
- PersonalizationDictionary.cs
- SmiGettersStream.cs
- DataGridViewComboBoxEditingControl.cs
- TransportElement.cs
- EntitySetBaseCollection.cs
- DebugInfoExpression.cs
- SafeFileHandle.cs
- BitmapEffect.cs
- IgnoreSectionHandler.cs
- ConsoleEntryPoint.cs
- WrapPanel.cs
- RuntimeHelpers.cs
- RuleSet.cs
- CodeConditionStatement.cs
- ControlEvent.cs
- SecureEnvironment.cs