Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Design / Glyphs / ConfigErrorGlyph.cs / 1305376 / ConfigErrorGlyph.cs
namespace System.Workflow.ComponentModel.Design { using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; #region Glyphs #region Class ConfigErrorGlyph //Class is internal but not sealed as we dont expect the ActivityDesigner writers to supply their own //Glyph instead based on designer actions the smart tag will be shown //Exception: StripItemConfigErrorGlyph public class ConfigErrorGlyph : DesignerGlyph { private static ConfigErrorGlyph defaultConfigErrorGlyph = null; internal static ConfigErrorGlyph Default { get { if (defaultConfigErrorGlyph == null) defaultConfigErrorGlyph = new ConfigErrorGlyph(); return defaultConfigErrorGlyph; } } public override bool CanBeActivated { get { return true; } } public override int Priority { get { return DesignerGlyph.ConfigErrorPriority; } } public override Rectangle GetBounds(ActivityDesigner designer, bool activated) { if (designer == null) throw new ArgumentNullException("designer"); Size configErrorSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize; Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin; Point configErrorLocation = new Point(designer.Bounds.Right - configErrorSize.Width - margin.Width / 2, designer.Bounds.Top - configErrorSize.Height + margin.Height); Rectangle bounds = new Rectangle(configErrorLocation, configErrorSize); if (activated) { bounds.Width *= 2; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; bounds.Inflate(ambientTheme.Margin.Width / 2, ambientTheme.Margin.Height / 2); } return bounds; } protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = GetBounds(designer, false); Rectangle activatedBounds = GetBounds(designer, activated); Region clipRegion = null; Region oldClipRegion = graphics.Clip; try { if (oldClipRegion != null) { clipRegion = oldClipRegion.Clone(); if (activated) clipRegion.Union(activatedBounds); graphics.Clip = clipRegion; } if (activated) { graphics.FillRectangle(SystemBrushes.ButtonFace, activatedBounds); graphics.DrawRectangle(SystemPens.ControlDarkDark, activatedBounds.Left, activatedBounds.Top, activatedBounds.Width - 1, activatedBounds.Height - 1); activatedBounds.X += bounds.Width + ambientTheme.Margin.Width; activatedBounds.Width -= (bounds.Width + 2 * ambientTheme.Margin.Width); using (GraphicsPath dropDownIndicator = ActivityDesignerPaint.GetScrollIndicatorPath(activatedBounds, ScrollButton.Down)) { graphics.FillPath(SystemBrushes.ControlText, dropDownIndicator); graphics.DrawPath(SystemPens.ControlText, dropDownIndicator); } } ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ConfigErrorImage, bounds, DesignerContentAlignment.Fill); } finally { if (clipRegion != null) { graphics.Clip = oldClipRegion; clipRegion.Dispose(); } } } protected override void OnActivate(ActivityDesigner designer) { if (designer != null) { if (designer.DesignerActions.Count > 0) { Rectangle bounds = GetBounds(designer, false); Point location = designer.ParentView.LogicalPointToScreen(new Point(bounds.Left, bounds.Bottom)); DesignerHelpers.ShowDesignerVerbs(designer, location, DesignerHelpers.GetDesignerActionVerbs(designer, designer.DesignerActions)); } } } } #endregion #endregion } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Workflow.ComponentModel.Design { using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; #region Glyphs #region Class ConfigErrorGlyph //Class is internal but not sealed as we dont expect the ActivityDesigner writers to supply their own //Glyph instead based on designer actions the smart tag will be shown //Exception: StripItemConfigErrorGlyph public class ConfigErrorGlyph : DesignerGlyph { private static ConfigErrorGlyph defaultConfigErrorGlyph = null; internal static ConfigErrorGlyph Default { get { if (defaultConfigErrorGlyph == null) defaultConfigErrorGlyph = new ConfigErrorGlyph(); return defaultConfigErrorGlyph; } } public override bool CanBeActivated { get { return true; } } public override int Priority { get { return DesignerGlyph.ConfigErrorPriority; } } public override Rectangle GetBounds(ActivityDesigner designer, bool activated) { if (designer == null) throw new ArgumentNullException("designer"); Size configErrorSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize; Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin; Point configErrorLocation = new Point(designer.Bounds.Right - configErrorSize.Width - margin.Width / 2, designer.Bounds.Top - configErrorSize.Height + margin.Height); Rectangle bounds = new Rectangle(configErrorLocation, configErrorSize); if (activated) { bounds.Width *= 2; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; bounds.Inflate(ambientTheme.Margin.Width / 2, ambientTheme.Margin.Height / 2); } return bounds; } protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = GetBounds(designer, false); Rectangle activatedBounds = GetBounds(designer, activated); Region clipRegion = null; Region oldClipRegion = graphics.Clip; try { if (oldClipRegion != null) { clipRegion = oldClipRegion.Clone(); if (activated) clipRegion.Union(activatedBounds); graphics.Clip = clipRegion; } if (activated) { graphics.FillRectangle(SystemBrushes.ButtonFace, activatedBounds); graphics.DrawRectangle(SystemPens.ControlDarkDark, activatedBounds.Left, activatedBounds.Top, activatedBounds.Width - 1, activatedBounds.Height - 1); activatedBounds.X += bounds.Width + ambientTheme.Margin.Width; activatedBounds.Width -= (bounds.Width + 2 * ambientTheme.Margin.Width); using (GraphicsPath dropDownIndicator = ActivityDesignerPaint.GetScrollIndicatorPath(activatedBounds, ScrollButton.Down)) { graphics.FillPath(SystemBrushes.ControlText, dropDownIndicator); graphics.DrawPath(SystemPens.ControlText, dropDownIndicator); } } ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ConfigErrorImage, bounds, DesignerContentAlignment.Fill); } finally { if (clipRegion != null) { graphics.Clip = oldClipRegion; clipRegion.Dispose(); } } } protected override void OnActivate(ActivityDesigner designer) { if (designer != null) { if (designer.DesignerActions.Count > 0) { Rectangle bounds = GetBounds(designer, false); Point location = designer.ParentView.LogicalPointToScreen(new Point(bounds.Left, bounds.Bottom)); DesignerHelpers.ShowDesignerVerbs(designer, location, DesignerHelpers.GetDesignerActionVerbs(designer, designer.DesignerActions)); } } } } #endregion #endregion } // 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
- ActivityBindForm.Designer.cs
- CFStream.cs
- PackUriHelper.cs
- ServicesUtilities.cs
- ProviderConnectionPointCollection.cs
- SqlUdtInfo.cs
- METAHEADER.cs
- UniformGrid.cs
- ComplexType.cs
- SemanticTag.cs
- WebBrowserDocumentCompletedEventHandler.cs
- Style.cs
- CustomTypeDescriptor.cs
- StaticFileHandler.cs
- ChildrenQuery.cs
- EntityClassGenerator.cs
- MulticastNotSupportedException.cs
- PageThemeBuildProvider.cs
- XmlArrayItemAttribute.cs
- XmlSerializerImportOptions.cs
- ChannelSinkStacks.cs
- sqlcontext.cs
- PixelShader.cs
- basevalidator.cs
- TextTreeTextBlock.cs
- CharacterString.cs
- PasswordDeriveBytes.cs
- SqlConnectionHelper.cs
- DataSourceControl.cs
- TrustManagerMoreInformation.cs
- CodeAccessPermission.cs
- SafeRightsManagementHandle.cs
- SettingsPropertyWrongTypeException.cs
- IItemProperties.cs
- UriParserTemplates.cs
- CheckBoxRenderer.cs
- ImageUrlEditor.cs
- RoleManagerSection.cs
- ToolStripItemImageRenderEventArgs.cs
- ComponentEditorPage.cs
- UTF7Encoding.cs
- Transform3DGroup.cs
- WeakReferenceList.cs
- COM2PictureConverter.cs
- IndependentAnimationStorage.cs
- TypedOperationInfo.cs
- Setter.cs
- odbcmetadatafactory.cs
- CachedBitmap.cs
- CodePrimitiveExpression.cs
- SqlDataSourceStatusEventArgs.cs
- TableParaClient.cs
- NamespaceQuery.cs
- ValidationErrorCollection.cs
- XmlQuerySequence.cs
- KnownAssembliesSet.cs
- TreeNodeMouseHoverEvent.cs
- TrackingQuery.cs
- NonDualMessageSecurityOverHttp.cs
- DiscoveryServiceExtension.cs
- XamlReaderConstants.cs
- ProfilePropertyNameValidator.cs
- DecimalAnimationUsingKeyFrames.cs
- CallbackValidator.cs
- CrossAppDomainChannel.cs
- CellLabel.cs
- WindowsClientCredential.cs
- TextRunCache.cs
- StateBag.cs
- COM2FontConverter.cs
- ExecutedRoutedEventArgs.cs
- OleDbSchemaGuid.cs
- ConnectionsZoneAutoFormat.cs
- InputProcessorProfilesLoader.cs
- SolidBrush.cs
- MultiPageTextView.cs
- XmlHierarchicalEnumerable.cs
- FixedBufferAttribute.cs
- SByteStorage.cs
- HtmlImageAdapter.cs
- UserPersonalizationStateInfo.cs
- ColorTransform.cs
- ParameterToken.cs
- DbParameterHelper.cs
- PerformanceCounterLib.cs
- SerializationStore.cs
- ButtonBaseAdapter.cs
- UniqueEventHelper.cs
- SpecularMaterial.cs
- MsmqTransportSecurityElement.cs
- TemplateControlParser.cs
- EventTask.cs
- WindowsGraphics2.cs
- SegmentInfo.cs
- NameValuePermission.cs
- TextEncodedRawTextWriter.cs
- Span.cs
- SmtpReplyReaderFactory.cs
- DisplayNameAttribute.cs
- IndicCharClassifier.cs