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
- DocumentXmlWriter.cs
- PropertyDescriptorCollection.cs
- FixedTextPointer.cs
- GifBitmapEncoder.cs
- CodeDomComponentSerializationService.cs
- IteratorFilter.cs
- TextTreeTextElementNode.cs
- SourceLineInfo.cs
- TimeManager.cs
- XmlAttributeCache.cs
- DataSourceControl.cs
- WebPartEditorOkVerb.cs
- RegularExpressionValidator.cs
- SiteMapPath.cs
- SystemSounds.cs
- Console.cs
- StaticTextPointer.cs
- _ProxyChain.cs
- ContractReference.cs
- AccessDataSource.cs
- CompressEmulationStream.cs
- AssemblyName.cs
- ClientTargetCollection.cs
- ProfileEventArgs.cs
- PieceNameHelper.cs
- DataGridViewElement.cs
- ContainerUtilities.cs
- XPathDescendantIterator.cs
- WebPartActionVerb.cs
- WebPartConnectionsConfigureVerb.cs
- XmlEventCache.cs
- KeyValueInternalCollection.cs
- InputQueue.cs
- ConfigurationPermission.cs
- ComponentDispatcher.cs
- FixedPageAutomationPeer.cs
- HierarchicalDataBoundControlAdapter.cs
- HwndMouseInputProvider.cs
- ApplicationBuildProvider.cs
- DesignerView.cs
- BrushMappingModeValidation.cs
- ImportContext.cs
- SamlAssertionKeyIdentifierClause.cs
- PathParser.cs
- InsufficientMemoryException.cs
- StopRoutingHandler.cs
- GeometryDrawing.cs
- EmptyWorkItem.cs
- TypedReference.cs
- SyntaxCheck.cs
- UnsettableComboBox.cs
- ValidatedControlConverter.cs
- SequentialOutput.cs
- LinqDataSourceView.cs
- PermissionAttributes.cs
- SafeArchiveContext.cs
- ElementNotEnabledException.cs
- UriScheme.cs
- ReferencedCollectionType.cs
- Constants.cs
- BindingListCollectionView.cs
- Converter.cs
- SqlConnectionPoolProviderInfo.cs
- SafeCertificateContext.cs
- ScrollEvent.cs
- SourceSwitch.cs
- CapabilitiesState.cs
- OutputCacheSettingsSection.cs
- DbParameterCollectionHelper.cs
- TcpHostedTransportConfiguration.cs
- InstanceKeyCompleteException.cs
- SoapFormatter.cs
- DataBinding.cs
- ContractListAdapter.cs
- ContentControl.cs
- Missing.cs
- ApplicationException.cs
- ConnectionManager.cs
- URL.cs
- ClientScriptManager.cs
- MetafileHeaderWmf.cs
- XmlTextWriter.cs
- _ListenerResponseStream.cs
- KeyPullup.cs
- CreateRefExpr.cs
- XmlAttributeOverrides.cs
- GeneralTransform2DTo3DTo2D.cs
- ItemAutomationPeer.cs
- RoleManagerSection.cs
- AppearanceEditorPart.cs
- NumberFunctions.cs
- PKCS1MaskGenerationMethod.cs
- FunctionNode.cs
- ViewStateChangedEventArgs.cs
- ToolStripDropDownItem.cs
- _Win32.cs
- ISessionStateStore.cs
- HtmlWindow.cs
- MailAddress.cs
- XmlSchemaRedefine.cs