Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Design / Glyphs / SelectionGlyph.cs / 1305376 / SelectionGlyph.cs
namespace System.Workflow.ComponentModel.Design { using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; #region Glyphs #region Class SelectionGlyph public abstract class SelectionGlyph : DesignerGlyph { public override Rectangle GetBounds(ActivityDesigner designer, bool activated) { if (designer == null) throw new ArgumentNullException("designer"); Rectangle rectangle = designer.Bounds; rectangle.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize.Width / 2, WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize.Height / 2); return rectangle; } protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { ActivityDesignerPaint.DrawSelection(graphics, GetBounds(designer, activated), IsPrimarySelection, WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize, GetGrabHandles(designer)); } public override int Priority { get { return DesignerGlyph.SelectionPriority; } } public abstract bool IsPrimarySelection { get;} public virtual Rectangle[] GetGrabHandles(ActivityDesigner designer) { Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize; Size grabHandleSize = new Size(selectionSize.Width, selectionSize.Height); Rectangle selectionRect = GetBounds(designer, false); selectionRect.Inflate(selectionSize.Width, selectionSize.Height); //we need grab handles only in case this activity is an immediate child of a free-form activity //otherwise, no grab handles ActivityDesigner parentDesigner = designer.ParentDesigner; Rectangle[] grabHandles = null; if (parentDesigner != null && parentDesigner is FreeformActivityDesigner) { grabHandles = new Rectangle[8]; grabHandles[0] = new Rectangle(selectionRect.Location, grabHandleSize); grabHandles[1] = new Rectangle(new Point(selectionRect.Left + (selectionRect.Width - grabHandleSize.Width) / 2, selectionRect.Top), grabHandleSize); grabHandles[2] = new Rectangle(selectionRect.Right - grabHandleSize.Width, selectionRect.Top, grabHandleSize.Width, grabHandleSize.Height); grabHandles[3] = new Rectangle(new Point(selectionRect.Right - grabHandleSize.Width, selectionRect.Top + (selectionRect.Height - grabHandleSize.Height) / 2), grabHandleSize); grabHandles[4] = new Rectangle(selectionRect.Right - grabHandleSize.Width, selectionRect.Bottom - grabHandleSize.Height, grabHandleSize.Width, grabHandleSize.Height); grabHandles[5] = new Rectangle(new Point(selectionRect.Left + (selectionRect.Width - grabHandleSize.Width) / 2, selectionRect.Bottom - grabHandleSize.Height), grabHandleSize); grabHandles[6] = new Rectangle(selectionRect.Left, selectionRect.Bottom - grabHandleSize.Height, grabHandleSize.Width, grabHandleSize.Height); grabHandles[7] = new Rectangle(new Point(selectionRect.Left, selectionRect.Top + (selectionRect.Height - grabHandleSize.Height) / 2), grabHandleSize); return grabHandles; } else { grabHandles = new Rectangle[1]; grabHandles[0] = new Rectangle(selectionRect.Location, grabHandleSize); } return grabHandles; } } #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 SelectionGlyph public abstract class SelectionGlyph : DesignerGlyph { public override Rectangle GetBounds(ActivityDesigner designer, bool activated) { if (designer == null) throw new ArgumentNullException("designer"); Rectangle rectangle = designer.Bounds; rectangle.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize.Width / 2, WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize.Height / 2); return rectangle; } protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { ActivityDesignerPaint.DrawSelection(graphics, GetBounds(designer, activated), IsPrimarySelection, WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize, GetGrabHandles(designer)); } public override int Priority { get { return DesignerGlyph.SelectionPriority; } } public abstract bool IsPrimarySelection { get;} public virtual Rectangle[] GetGrabHandles(ActivityDesigner designer) { Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize; Size grabHandleSize = new Size(selectionSize.Width, selectionSize.Height); Rectangle selectionRect = GetBounds(designer, false); selectionRect.Inflate(selectionSize.Width, selectionSize.Height); //we need grab handles only in case this activity is an immediate child of a free-form activity //otherwise, no grab handles ActivityDesigner parentDesigner = designer.ParentDesigner; Rectangle[] grabHandles = null; if (parentDesigner != null && parentDesigner is FreeformActivityDesigner) { grabHandles = new Rectangle[8]; grabHandles[0] = new Rectangle(selectionRect.Location, grabHandleSize); grabHandles[1] = new Rectangle(new Point(selectionRect.Left + (selectionRect.Width - grabHandleSize.Width) / 2, selectionRect.Top), grabHandleSize); grabHandles[2] = new Rectangle(selectionRect.Right - grabHandleSize.Width, selectionRect.Top, grabHandleSize.Width, grabHandleSize.Height); grabHandles[3] = new Rectangle(new Point(selectionRect.Right - grabHandleSize.Width, selectionRect.Top + (selectionRect.Height - grabHandleSize.Height) / 2), grabHandleSize); grabHandles[4] = new Rectangle(selectionRect.Right - grabHandleSize.Width, selectionRect.Bottom - grabHandleSize.Height, grabHandleSize.Width, grabHandleSize.Height); grabHandles[5] = new Rectangle(new Point(selectionRect.Left + (selectionRect.Width - grabHandleSize.Width) / 2, selectionRect.Bottom - grabHandleSize.Height), grabHandleSize); grabHandles[6] = new Rectangle(selectionRect.Left, selectionRect.Bottom - grabHandleSize.Height, grabHandleSize.Width, grabHandleSize.Height); grabHandles[7] = new Rectangle(new Point(selectionRect.Left, selectionRect.Top + (selectionRect.Height - grabHandleSize.Height) / 2), grabHandleSize); return grabHandles; } else { grabHandles = new Rectangle[1]; grabHandles[0] = new Rectangle(selectionRect.Location, grabHandleSize); } return grabHandles; } } #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
- BCryptSafeHandles.cs
- _DomainName.cs
- HScrollProperties.cs
- SHA1.cs
- _NegoStream.cs
- MarshalByRefObject.cs
- PhoneCallDesigner.cs
- TextSelectionHighlightLayer.cs
- BuildManager.cs
- RowsCopiedEventArgs.cs
- Help.cs
- FormattedText.cs
- QilValidationVisitor.cs
- UserNameSecurityTokenAuthenticator.cs
- SessionPageStatePersister.cs
- PrintPageEvent.cs
- DbConnectionStringBuilder.cs
- XmlTextReaderImpl.cs
- FileSystemEventArgs.cs
- HtmlUtf8RawTextWriter.cs
- CatchDesigner.xaml.cs
- SortedSetDebugView.cs
- DataTable.cs
- EnterpriseServicesHelper.cs
- HttpContext.cs
- KoreanLunisolarCalendar.cs
- Bidi.cs
- SmtpNtlmAuthenticationModule.cs
- ToolboxItemFilterAttribute.cs
- NetStream.cs
- Pts.cs
- GridPatternIdentifiers.cs
- PropertyContainer.cs
- DataControlButton.cs
- ContractComponent.cs
- DataControlFieldCollection.cs
- NodeFunctions.cs
- SafeCryptoHandles.cs
- SingleQueryOperator.cs
- PersonalizationStateInfoCollection.cs
- TagNameToTypeMapper.cs
- ObjectIDGenerator.cs
- PartialList.cs
- BufferedGraphics.cs
- SuppressMessageAttribute.cs
- Application.cs
- UnescapedXmlDiagnosticData.cs
- ColorContextHelper.cs
- XPathParser.cs
- CatalogZoneBase.cs
- SmiSettersStream.cs
- RenderOptions.cs
- ListInitExpression.cs
- DataRecordInternal.cs
- ProxyWebPart.cs
- SelfIssuedTokenFactoryCredential.cs
- Metadata.cs
- ApplicationHost.cs
- PropertyNames.cs
- AddingNewEventArgs.cs
- PageContentCollection.cs
- Pen.cs
- LassoHelper.cs
- WebColorConverter.cs
- CounterCreationData.cs
- _AcceptOverlappedAsyncResult.cs
- QilFunction.cs
- LinqDataSourceValidationException.cs
- ListViewGroupConverter.cs
- SqlDataSourceFilteringEventArgs.cs
- BamlStream.cs
- ArgumentOutOfRangeException.cs
- HuffCodec.cs
- ListBindingConverter.cs
- HtmlEncodedRawTextWriter.cs
- PreviewKeyDownEventArgs.cs
- Assembly.cs
- InternalConfigSettingsFactory.cs
- COM2PropertyPageUITypeConverter.cs
- CommandExpr.cs
- StickyNoteAnnotations.cs
- EventLogEntryCollection.cs
- TextEncodedRawTextWriter.cs
- Predicate.cs
- StaticDataManager.cs
- DependencySource.cs
- ThreadAbortException.cs
- MetadataException.cs
- RawKeyboardInputReport.cs
- RemotingServices.cs
- CompositeScriptReference.cs
- SimpleWebHandlerParser.cs
- XPathDescendantIterator.cs
- IISMapPath.cs
- PriorityChain.cs
- SqlAliasesReferenced.cs
- TimerElapsedEvenArgs.cs
- EmptyReadOnlyDictionaryInternal.cs
- LinearQuaternionKeyFrame.cs
- SystemIcmpV6Statistics.cs