Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlMethods.cs
- InfoCardRequestException.cs
- SocketInformation.cs
- GACMembershipCondition.cs
- Domain.cs
- HybridDictionary.cs
- ProxyGenerationError.cs
- LogicalExpr.cs
- UTF32Encoding.cs
- CodePageEncoding.cs
- NameSpaceExtractor.cs
- EnglishPluralizationService.cs
- ProxyWebPartManager.cs
- WindowInteractionStateTracker.cs
- PerformanceCounterNameAttribute.cs
- QilFunction.cs
- StylusTouchDevice.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- Random.cs
- HtmlForm.cs
- DependencyPropertyKey.cs
- ConnectionManagementElement.cs
- _ListenerResponseStream.cs
- Model3D.cs
- EventTrigger.cs
- BamlWriter.cs
- AsymmetricAlgorithm.cs
- WindowsUpDown.cs
- CngKeyBlobFormat.cs
- DataGridViewColumnEventArgs.cs
- WebPartEditorCancelVerb.cs
- RequestUriProcessor.cs
- BooleanAnimationBase.cs
- PasswordPropertyTextAttribute.cs
- SchemaImporter.cs
- WebControl.cs
- MailWriter.cs
- BinaryQueryOperator.cs
- CacheVirtualItemsEvent.cs
- ElementHostAutomationPeer.cs
- ObjectDataSourceDisposingEventArgs.cs
- DomNameTable.cs
- XmlSubtreeReader.cs
- OdbcHandle.cs
- RelationshipConverter.cs
- DataObject.cs
- TextTabProperties.cs
- OneOfConst.cs
- DataSysAttribute.cs
- UrlMapping.cs
- _ShellExpression.cs
- Model3D.cs
- InheritablePropertyChangeInfo.cs
- TemplateParser.cs
- ByteArrayHelperWithString.cs
- Bitmap.cs
- SmiMetaData.cs
- ObjectPropertyMapping.cs
- Calendar.cs
- NavigationHelper.cs
- ObjectQuery.cs
- SqlCommand.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- DataServiceClientException.cs
- Tuple.cs
- WorkflowMarkupSerializerMapping.cs
- IndividualDeviceConfig.cs
- InputMethodStateChangeEventArgs.cs
- InvokeHandlers.cs
- DesignerTextBoxAdapter.cs
- NamedPipeTransportElement.cs
- NavigationExpr.cs
- TypeUtils.cs
- FormClosingEvent.cs
- SqlConnectionPoolGroupProviderInfo.cs
- SecurityTokenValidationException.cs
- ExpressionEditor.cs
- PingOptions.cs
- CodeStatementCollection.cs
- ScrollProperties.cs
- HighlightVisual.cs
- Rules.cs
- SubMenuStyleCollection.cs
- InteropAutomationProvider.cs
- DmlSqlGenerator.cs
- VerificationAttribute.cs
- DetailsView.cs
- HyperLinkStyle.cs
- RectangleGeometry.cs
- DrawingState.cs
- MouseGestureConverter.cs
- CngKey.cs
- ObjectIDGenerator.cs
- ModelUIElement3D.cs
- MessageEnumerator.cs
- ZipPackagePart.cs
- MappingModelBuildProvider.cs
- DataFormat.cs
- CustomErrorsSectionWrapper.cs
- Fonts.cs