public AimGraphic(IGraphic graphic, IAimAnnotationInstance annotationInstance, int shapeIdentifier) : base(graphic) { _annotationInstance = annotationInstance; _shapeIdentifier = shapeIdentifier; _graphic = graphic; }
public BinaryLayout(Position aPos, int gap) { fPrimaryGraphic = null; fSecondaryGraphic = null; fMargin = gap; fPosition = aPos; }
public RemoveGraphicCommand(IGraphic graphic) { Platform.CheckForNullReference(graphic, "graphic"); _graphic = graphic; Validate(); }
public PLCView(string name, string heading, int x, int y, int width, int height) : base(name, x, y, width, height) { //this.GraphicsUnit = GraphicsUnit.Inch; fTeamLogo = new TextBox("Team Logo","Tahoma",14,GDIFont.FontStyle.Regular,0,0,160,60,RGBColor.Black); fLegend = null; fCS = new PLCColorScheme(); //fTransitionAnimator = new CrossFade(); fDataBinder = null; fBackingPixelBuffer = new GDIDIBSection(width, height); fBackingGraphics = fBackingPixelBuffer.GraphPort; //fBackingGraphics.PageUnit = GraphicsUnit.Inch; fHeading = heading; // These are the set of virtual calls // That any subclasser will implement AddMasterHeading(); AddPhaseArrows(); AddPhaseHeadings(); AddStageHeadings(); AddDeliveryContainers(); AddImages(); AddLegend(); AddTeamLogo(); //DrawSelf(fBackingGraphics); }
public void RenderImage(IGraphic img, Vector2 pos) { Image ui = img.MakeImage(); RenderCanvas.Children.Add(ui); Canvas.SetLeft(ui, pos.X); Canvas.SetTop(ui, pos.Y); }
/// <summary> /// Constructs a new <see cref="BoundableResizeControlGraphic"/>. /// </summary> /// <param name="fixedAspectRatio">The width to height aspect ratio that constrains the movement of the resize control points, or null if the movement should not be constrained.</param> /// <param name="subject">An <see cref="IBoundableGraphic"/> or an <see cref="IControlGraphic"/> chain whose subject is an <see cref="IBoundableGraphic"/>.</param> public BoundableResizeControlGraphic(float? fixedAspectRatio, IGraphic subject) : this(subject) { if (fixedAspectRatio.HasValue) Platform.CheckPositive(fixedAspectRatio.Value, "fixedAspectRatio"); _fixedAspectRatio = fixedAspectRatio; }
public override void AddToLayout(IGraphic trans) { int cWidth = Frame.Width; int cHeight = Frame.Height; int left = 0; // WAA - Container.Origin.X; int numElements = Container.CountGraphics(); int fixedHeight = (cHeight - ((numElements - 1) * fGap)) / (numElements); int collectiveHeight=0; bool normalize = false; // First figure out the collective height foreach (IGraphic g in Container.GraphicChildren) collectiveHeight += g.Frame.Height; collectiveHeight += fGap * (numElements - 1); if (collectiveHeight > cHeight) normalize = true; int currentY = 0; // WAA - Container.Origin.Y; foreach (IGraphic g in Container.GraphicChildren) { if (normalize) { g.ResizeTo(cWidth, fixedHeight); } else { g.ResizeTo(cWidth, g.Frame.Height); } g.MoveTo(left + fMargin, currentY); currentY = g.Frame.Bottom + fGap; } }
public GraphicCell(Position aPosition, int margin) : base(null, Rectangle.Empty) { fPosition = aPosition; fMargin = margin; fWrappedGraphic = null; }
/// <summary> /// Constructs a new <see cref="ControlPointsGraphic"/> to control the given subject graphic. /// </summary> /// <param name="subject">The graphic to control.</param> public ControlPointsGraphic(IGraphic subject) : base(subject) { _stretchingToken = new CursorToken(CursorToken.SystemCursors.Cross); Initialize(); }
/// <summary> /// Constructs an instance of a <see cref="ContextMenuControlGraphic"/> with the specified initial context menu actions. /// </summary> /// <param name="namespace">The namespace to qualify the <paramref name="site"/>.</param> /// <param name="site">The action model site for the context menu (see <see cref="ActionPath.Site"/>).</param> /// <param name="actions">The set of actions on the context menu.</param> /// <param name="subject">The subject graphic.</param> public ContextMenuControlGraphic(string @namespace, string site, IActionSet actions, IGraphic subject) : base(subject) { _namespace = @namespace; _site = site; _actions = actions; }
/// <summary> /// Initializes a new instance of <see cref="MammographyImageSpatialTransform"/> with the specified image plane details. /// </summary> public MammographyImageSpatialTransform(IGraphic ownerGraphic, int rows, int columns, double pixelSpacingX, double pixelSpacingY, double pixelAspectRatioX, double pixelAspectRatioY, PatientOrientation patientOrientation, string laterality) : base(ownerGraphic, rows, columns, pixelSpacingX, pixelSpacingY, pixelAspectRatioX, pixelAspectRatioY) { // image coordinates are defined with X and Y being equivalent to the screen axes (right and down) and with Z = X cross Y (into the screen) Vector3D imagePosterior, imageHead, imageLeft; // patient orientation vectors in image space GetPatientOrientationVectors(patientOrientation, out imageHead, out imageLeft, out imagePosterior); // no adjustments if the posterior direction is not represented in the image if ((_imagePosterior = imagePosterior) != null) { Vector3D normativePosterior, normativeHead, normativeLeft; // normative patient orientation vectors in image space GetNormativeOrientationVectors(laterality, out normativeHead, out normativeLeft, out normativePosterior); // only do any adjustments if laterality implies a normative orientation for the posterior direction if (normativePosterior != null) { // check if the order of the patient vectors are flipped according to the normative vectors // we know we need to flip if the direction vector cross products have different signs if (imageHead != null) FlipX = _coreFlipX = Math.Sign(imagePosterior.Cross(imageHead).Z) != Math.Sign(normativePosterior.Cross(normativeHead).Z); else if (imageLeft != null) FlipX = _coreFlipX = Math.Sign(imagePosterior.Cross(imageLeft).Z) != Math.Sign(normativePosterior.Cross(normativeLeft).Z); // with flip normalized, just rotate to align the current posterior direction with the normative posterior var currentPosterior = GetCurrentPosteriorVector(_imagePosterior, SourceWidth, AdjustedSourceHeight, 0, 1, 1, _coreFlipX, false); var posteriorAngle = Math.Atan2(currentPosterior.Y, currentPosterior.X); var normativeAngle = Math.Atan2(normativePosterior.Y, normativePosterior.X); // compute required rotation, rounded to multiples of 90 degrees (PI/2 radians) RotationXY = _coreRotation = 90*((int) Math.Round((normativeAngle - posteriorAngle)*2/Math.PI)); } } }
/// <summary> /// Constructs a new <see cref="TextPlaceholderControlGraphic"/>. /// </summary> /// <param name="subject">An <see cref="ITextGraphic"/> or an <see cref="IControlGraphic"/> chain whose subject is an <see cref="ITextGraphic"/>.</param> public TextPlaceholderControlGraphic(IGraphic subject) : base(subject) { Platform.CheckExpectedType(base.Subject, typeof (ITextGraphic)); Initialize(); }
public static XElement GraphicToXml(IGraphic g) { XElement node = new XElement("IS3Graphic", new XAttribute("DGObjID", g.DGObjID.ToString()), new XAttribute("Geometry",g.Geometry.ToJson())); return node; }
internal static IMarkup GraphicToIMarkup(IGraphic graphic) { if (graphic == null || graphic.ParentPresentationImage == null) return null; var markup = DoGraphicToIMarkup(graphic); if (markup != null) { var sopInstanceUid = string.Empty; var frameNumber = 1; try { if (graphic.ParentPresentationImage is IImageSopProvider) { var imageSopProvider = graphic.ParentPresentationImage as IImageSopProvider; sopInstanceUid = imageSopProvider.ImageSop.SopInstanceUid; frameNumber = imageSopProvider.Frame.FrameNumber; } else if (!string.IsNullOrEmpty(graphic.ParentPresentationImage.Uid)) sopInstanceUid = graphic.ParentPresentationImage.Uid; } catch (Exception) { } markup.PresentationImageUid = sopInstanceUid; markup.FrameNumber = frameNumber; markup.IncludeInAnnotation = true; markup.GraphicHashcode = graphic.GetHashCode(); } return markup; }
public GraphicCell(Position aPosition, int margin, Rectangle frame) :base(null,frame) { fPosition = aPosition; fMargin = margin; fWrappedGraphic = null; }
/// <summary> /// Initializes a new instance of <see cref="SpatialTransform"/>. /// </summary> public SpatialTransform(IGraphic ownerGraphic) { _ownerGraphic = ownerGraphic; _recalculationRequired = true; _updatingScaleParameters = false; Initialize(); }
public AimGraphic(IGraphic graphic, aim_dotnet.ImageAnnotation imageAnnotation, int shapeIdentifier) : base(graphic) { _imageAnnotation = imageAnnotation; _shapeIdentifier = shapeIdentifier; _graphic = graphic; }
public GraphicWindow(string title, int x, int y, int width, int height) :base(title,x,y,width,height) { fActiveGraphic = null; //fMouseTrackerGraphic = null; fChildList = new List<IGraphic>(); fLayoutManager = LayoutManager.Empty; }
public AddGraphicCommand(IGraphic graphic, GraphicCollection parentCollection) { Platform.CheckForNullReference(graphic, "graphic"); Platform.CheckForNullReference(parentCollection, "parentCollection"); _parentCollection = parentCollection; _graphic = graphic; }
private static void Flash(IGraphic graphic) { if (graphic is IVectorGraphic) { DoFlashDelegate doFlashDelegate = DoFlash; doFlashDelegate.BeginInvoke((IVectorGraphic) graphic, SynchronizationContext.Current, delegate(IAsyncResult result) { doFlashDelegate.EndInvoke(result); }, null); } }
public MainPresenter(IGraphic graphic, IFileManager manager, IMessageService messageService) { _manager = manager; _messageService = messageService; _graphic = graphic; _graphic.FileOpenClick += _graphic_FileOpenClick; }
//public event System.EventHandler ValueChangedEvent; public TrackSlider(string name, IGraphic track, IGraphic thumb, Orientation orient, float min, float max, float initialValue) : base(name, 0,0,0,0) { fTrackGraphic = track; fThumbGraphic = thumb; fOrientation = orient; fMin = min; fMax = max; fCurrentValue = initialValue; fPosition = initialValue; int yoffset = 0; int xoffset = 0; int trackyoffset = 0; int trackxoffset = 0; if ((track==null) || (thumb==null)) return ; AddGraphic(fTrackGraphic, null); AddGraphic(fThumbGraphic, null); if (orient == Orientation.Horizontal) { // Must align thumb vertically with track. int midy = fTrackGraphic.Frame.Top + (fTrackGraphic.Frame.Height+1)/2; int thumbHeight = fThumbGraphic.Frame.Height+1; yoffset = midy - (thumbHeight / 2); xoffset = fTrackGraphic.Frame.Left; } else { // Must align thumb horizontally with track. int midx = Frame.Left+(Frame.Width+1)/2; int thumbWidth = fThumbGraphic.Frame.Width+1; int trackWidth = fTrackGraphic.Frame.Width+1; xoffset = midx - (thumbWidth / 2); yoffset = fTrackGraphic.Frame.Top; trackxoffset = midx - (trackWidth/2); trackyoffset = fTrackGraphic.Frame.Top; fTrackGraphic.MoveTo(trackxoffset, trackyoffset); } fThumbGraphic.MoveTo(xoffset,yoffset); RectangleI newFrame = fTrackGraphic.Frame; //newFrame.Union(fThumbGraphic.Frame); Frame = newFrame; SetValue(initialValue, false); }
public InsertGraphicCommand(IGraphic graphic, GraphicCollection parentCollection, int index) { Platform.CheckForNullReference(graphic, "graphic"); Platform.CheckForNullReference(parentCollection, "parentCollection"); Platform.CheckTrue(index >= 0, "Insert index positive"); _parentCollection = parentCollection; _graphic = graphic; _index = index; }
public MainMenu(IGraphic graphObject) : base(graphObject) { Buttons = new Dictionary<Button, ButtonParams> { { Button.NewGame, new ButtonParams { Image = Res.Buttons[Button.NewGame], Area = BuildButtonRect(Button.NewGame), Render = true } }, { Button.LoadGame, new ButtonParams { Image = Res.Buttons[Button.LoadGame], Area = BuildButtonRect(Button.LoadGame), Render = true } }, { Button.SmallScale, new ButtonParams { Image = Res.Buttons[Button.SmallScale], Area = BuildButtonRect(Button.SmallScale), Render = true } }, { Button.NormalScale, new ButtonParams { Image = Res.Buttons[Button.NormalScale], Area = BuildButtonRect(Button.NormalScale), Render = true } }, { Button.BigScale, new ButtonParams { Image = Res.Buttons[Button.BigScale], Area = BuildButtonRect(Button.BigScale), Render = true } }, { Button.Exit, new ButtonParams { Image = Res.Buttons[Button.Exit], Area = BuildButtonRect(Button.Exit), Render = true } } }; }
public PushButton(string name, int x, int y, int width, int height, IGraphic label) : base(name, x,y,width,height) { Enabled = true; GraphicCell layout = new GraphicCell(Position.Center, 2); layout.Frame = new RectangleI(0, 0, width, height); LayoutHandler = layout; fLabel = label; AddGraphic(fLabel,null); }
/// <summary> /// Add new graphic layer to the existing layers according to its Z Order /// </summary> /// <param name="layer">The layer graphic instance</param> public void AddLayer(IGraphic layer) { _layers.Add(layer); _layers.Sort(delegate(IGraphic a, IGraphic b) { if (b.ZOrder > a.ZOrder) return 1; else if (a.ZOrder > b.ZOrder) return -1; else return 0; }); }
public GameForm() { InitializeComponent(); _graphObject = new WinFormsGraphic(null); _currentScale = 1.0f; GameResize(1.0f); _gameMenu = new MainMenu(_graphObject); _timer = new Timer(); _timer.Tick += TimerTick; _timer.Interval = 1; _timer.Start(); }
private static bool IsShutterTooSmall(IGraphic shutterGraphic) { shutterGraphic.CoordinateSystem = CoordinateSystem.Destination; try { RectangleF boundingBox = shutterGraphic.BoundingBox; return (boundingBox.Width < 50 || boundingBox.Height < 50); } finally { shutterGraphic.ResetCoordinateSystem(); } }
private static bool IsGraphicInCollection(IGraphic graphic, GraphicCollection graphicCollection) { IGraphic testGraphic = graphic; while(testGraphic != null) { if (graphicCollection.Contains(testGraphic)) return true; testGraphic = testGraphic.ParentGraphic; } return false; }
/// <summary> /// Helper method to serialize a graphic to the supplied serialization state object. /// </summary> /// <param name="graphic">The graphic to serialize.</param> /// <param name="serializationState">The state to which the graphic should be serialized.</param> /// <returns>True if the graphic was serializable; False otherwise.</returns> public static bool SerializeGraphic(IGraphic graphic, GraphicAnnotationSequenceItem serializationState) { Platform.CheckForNullReference(graphic, "graphic"); Platform.CheckForNullReference(serializationState, "serializationState"); object[] attributes = graphic.GetType().GetCustomAttributes(typeof (DicomSerializableGraphicAnnotationAttribute), true); if (attributes.Length > 0) { ((DicomSerializableGraphicAnnotationAttribute) attributes[0]).Serializer.Serialize(graphic, serializationState); return true; } return false; }
protected abstract InteractiveGraphicBuilder CreateGraphicBuilder(IGraphic subjectGraphic);
internal void SetParentGraphic(IGraphic parentGraphic) { _parentGraphic = parentGraphic; SpatialTransform.ForceRecalculation(); }
/// <summary> /// Constructs a new control graphic to control the given subject graphic. /// </summary> /// <param name="subject">The graphic to control.</param> public ControlGraphic(IGraphic subject) : base(subject) { }
/// <summary> /// Initializes a new instance of the <see cref="VisualStateChangedEventArgs"/> class. /// </summary> /// <param name="graphic">The graphic whose visual state changed.</param> /// <param name="propertyName">The name of the property that changed. </param> public VisualStateChangedEventArgs(IGraphic graphic, string propertyName) : base(propertyName) { this.Graphic = graphic; }
private static SizeF GetDropShadowOffset(IGraphic graphic, float dpi) { float offset = CalculateScaledPenWidth(graphic, 1, dpi); return(new SizeF(offset, offset)); }
/// <summary> /// Serializes the specified graphic to the supplied serialization state object. /// </summary> /// <param name="graphic">The graphic to serialize.</param> /// <param name="serializationState">The state to which the graphic should be serialized.</param> protected abstract void Serialize(IGraphic graphic, GraphicAnnotationSequenceItem serializationState);
/// <summary> /// Constructs a new <see cref="VerticesControlGraphic"/>. /// </summary> /// <param name="subject">An <see cref="IPointsGraphic"/> or an <see cref="IControlGraphic"/> chain whose subject is an <see cref="IPointsGraphic"/>.</param> public VerticesControlGraphic(IGraphic subject) : this(false, subject) { }
/// <summary> /// Constructs a new <see cref="BoundableResizeControlGraphic"/>. /// </summary> /// <param name="aspectRatio">The width to height aspect ratio that constrains the movement of the resize control points.</param> /// <param name="subject">An <see cref="IBoundableGraphic"/> or an <see cref="IControlGraphic"/> chain whose subject is an <see cref="IBoundableGraphic"/>.</param> public BoundableResizeControlGraphic(float aspectRatio, IGraphic subject) : this(subject) { Platform.CheckPositive(aspectRatio, "aspectRatio"); _fixedAspectRatio = aspectRatio; }
protected override InteractiveGraphicBuilder CreateGraphicBuilder(IGraphic graphic) { return(new InteractivePolylineGraphicBuilder(2, (IPointsGraphic)graphic)); }
protected override InteractiveGraphicBuilder CreateGraphicBuilder(IGraphic graphic) { return(new InteractiveBoundableGraphicBuilder((IBoundableGraphic)graphic)); }
public void Remove(IGraphic g) { graphics.Remove(g); }
public void Add(IGraphic g) { graphics.Add(g); }
/// <summary> /// Constructs a new <see cref="GraphicEventArgs"/>. /// </summary> /// <param name="graphic">The graphic to which the event applies.</param> public GraphicEventArgs(IGraphic graphic) { this.Graphic = graphic; }
private static float CalculateScaledPenWidth(IGraphic graphic, int penWidth, float dpi) { return(penWidth / graphic.SpatialTransform.CumulativeScale * dpi / _nominalScreenDpi); }
/// <summary> /// Constructs a new instance of <see cref="MoveControlGraphic"/>. /// </summary> /// <param name="subject">The subject graphic.</param> public MoveControlGraphic(IGraphic subject) : base(subject) { _cursor = new CursorToken(CursorToken.SystemCursors.SizeAll); }
//Adds the graphic to the composition public void Add(IGraphic graphic) { _graphics.Add(graphic); }
/// <summary> /// Constructs a new instance of <see cref="RoiGraphic"/>. /// </summary> /// <param name="roi">The graphic or control chain graphic representing the region of interest.</param> public RoiGraphic(IGraphic roi) : base(roi) { Initialize(); }
protected InteractiveTextGraphicBuilder(IGraphic graphic) : base(graphic) { }
public MainController(IGraphic graphic, IWordRepository dataReader, IAnagramSolver solver) { Graphic = graphic; DataReader = dataReader; Solver = solver; }
/// <summary> /// Constructs a new instance of <see cref="RoiGraphic"/>. /// </summary> /// <param name="roi">The graphic or control chain graphic representing the region of interest.</param> /// <param name="calloutLocationStrategy">An <see cref="IAnnotationCalloutLocationStrategy"/> to automatically place the callout.</param> public RoiGraphic(IGraphic roi, IAnnotationCalloutLocationStrategy calloutLocationStrategy) : base(roi, calloutLocationStrategy) { Initialize(); }
//Removes the graphic from the composition public void Delete(IGraphic graphic) { _graphics.Remove(graphic); }
public XStatefulGraphic(IGraphic subject) : base(subject) { }
public void Remove(IGraphic graphic) { graphics.Remove(graphic); }
public CompositeGraphic(IGraphic bg) { _layers.Add(bg); }
/// <summary> /// Constructor. /// </summary> /// <remarks> /// The <paramref name="graphic"/>'s <see cref="IGraphic.ParentGraphic"/> must not be null. /// </remarks> public RemoveGraphicUndoableCommand(IGraphic graphic) { _command = new RemoveGraphicCommand(graphic); }
public bool Contains(IGraphic shape) { return(Left <= shape.Bounds.Left && Right >= shape.Bounds.Right && Top <= shape.Bounds.Top && Bottom >= shape.Bounds.Bottom); }
public void Add(IGraphic item) { base.Add(item as IS3Graphic); }
public GameObject(IGraphic graphic, Rectangle position) { ObjectId = "CUSTOM"; Graphic = graphic; Position = position; }
void StartAnalysis() { //获取输入的view和复制坐标系 IView view = InputCB.SelectedItem as IView; _spatialRef = view.spatialReference; //开始分析 foreach (string SLLayerID in _selectedSLsDict.Keys) { //获取衬砌选中列表 IEnumerable <DGObject> sls = _selectedSLsDict[SLLayerID]; List <DGObject> slList = sls.ToList(); IGraphicsLayer gLayer = _inputView.getLayer(SLLayerID); foreach (DGObject dg in slList) { //获取单个衬砌对象,计算评估等级 SegmentLining sl = dg as SegmentLining; SLConvergenceRecordType slConvergenceRecordType = sl.ConstructionRecord.SLConvergenceRecords; if (slConvergenceRecordType.SLConvergenceItems.Count == 0) { continue; } SLConvergenceItem slConvergenceItem = slConvergenceRecordType.SLConvergenceItems[0]; if (slConvergenceItem.HorizontalDev == double.NaN) { continue; } double raduis = (double)slConvergenceItem.HorizontalRad; double deviation = (double)slConvergenceItem.HorizontalDev; double ratio = deviation / (raduis - deviation) * 1000; int grade; if (ratio <= 3) { grade = 5; } else if (ratio <= 5) { grade = 4; } else if (ratio <= 8) { grade = 3; } else if (ratio <= 10) { grade = 2; } else { grade = 1; } //根据评估等级获取图形样式 ISymbol symbol = GetSymbol(grade); //为了演示,采用了较复杂的方法 //<简便方法 可替换下面代码> //IGraphicCollection gcollection = gLayer.getGraphics(sl); //IGraphic g = gcollection[0]; //g.Symbol = symbol; //IGraphicCollection gc = Runtime.graphicEngine.newGraphicCollection(); //gc.Add(g); //_slsGraphics[sl.id] = gc; //</简便方法> //获取衬砌图形 IGraphicCollection gcollection = gLayer.getGraphics(sl); IGraphic g = gcollection[0]; IPolygon polygon = g.Geometry as IPolygon; IPointCollection pointCollection = polygon.GetPoints(); //获取端点 //衬砌为长方形,故有四个点 IMapPoint p1_temp = pointCollection[0]; IMapPoint p2_temp = pointCollection[1]; IMapPoint p3_temp = pointCollection[2]; IMapPoint p4_temp = pointCollection[3]; //新建新的点,注意复制坐标系 IMapPoint p1 = Runtime.geometryEngine.newMapPoint(p1_temp.X, p1_temp.Y, _spatialRef); IMapPoint p2 = Runtime.geometryEngine.newMapPoint(p2_temp.X, p2_temp.Y, _spatialRef); IMapPoint p3 = Runtime.geometryEngine.newMapPoint(p3_temp.X, p3_temp.Y, _spatialRef); IMapPoint p4 = Runtime.geometryEngine.newMapPoint(p4_temp.X, p4_temp.Y, _spatialRef); //生成新的图形 g = Runtime.graphicEngine.newQuadrilateral(p1, p2, p3, p4); g.Symbol = symbol; IGraphicCollection gc = Runtime.graphicEngine.newGraphicCollection(); gc.Add(g); _slsGraphics[sl.id] = gc; //保存结果 } } }
protected internal override void OnMouseDown(object sender, MouseEventArgs e) { base.OnMouseDown(sender, e); if (canvas.IsResizing || canvas.Layers[canvas.SelectedLayer].Locked) { return; } var query = canvas.SelectedLayer .Where(x => x.Contains(new PointF(e.X / canvas.ZoomFactor, e.Y / canvas.ZoomFactor))) .OrderBy(x => x.Z) .LastOrDefault(); if (e.Button == MouseButtons.Left) { if (canvas.Cursor == Cursors.Hand && query != null) { _moving = true; canvas.Cursor = Cursors.SizeAll; Position1 = e.Location; canvas.DeselectAll(); Target = query; Target.Selected = true; canvas.PropertyGridReference.SelectedObject = Target; canvas.PropertyGridReference.Invalidate(); canvas.Invalidate(); } else if (resizeCursorMap.ContainsValue(canvas.Cursor)) { _resizing = true; switch (_resizeHandle.Anchor) { case DragHandleAnchor.MiddleRight: case DragHandleAnchor.BottomCenter: case DragHandleAnchor.BottomRight: Position1 = new PointF(Target.Bounds.Left, Target.Bounds.Top); break; case DragHandleAnchor.MiddleLeft: case DragHandleAnchor.BottomLeft: Position1 = new PointF(Target.Bounds.Right, Target.Bounds.Top); break; case DragHandleAnchor.TopLeft: Position1 = new PointF(Target.Bounds.Right, Target.Bounds.Bottom); break; case DragHandleAnchor.TopCenter: case DragHandleAnchor.TopRight: Position1 = new PointF(Target.Bounds.Left, Target.Bounds.Bottom); break; } } else { canvas.DeselectAll(); canvas.PropertyGridReference.SelectedObject = canvas; } } if (e.Button == MouseButtons.Right) { if (query != null && query.Selected) { Menu.Show(canvas, e.Location); } } }