/// <summary> /// Dato un punto, determina quale resize handle è disponibile su quel punto. /// </summary> /// <param name="p">Punto in coordinate relative alla View</param> /// <returns></returns> public Direction WhatResizeHandle(PointF p) { SkinnableControls.SkinnableControl c = this.control; if (c == null) { return(Direction.None); } Direction dir = Direction.None; var loc = c.GetAbsoluteLocation(); if (loc.X + c.Size.Width - 5 <= p.X && p.X <= loc.X + c.Size.Width + 5 && loc.Y + c.Size.Height - 5 <= p.Y && p.Y <= loc.Y + c.Size.Height + 5) { dir = Direction.Right | Direction.Down; } else if (loc.X - 6 <= p.X && p.X <= loc.X + 5 && loc.Y - 6 <= p.Y && p.Y <= loc.Y + 5) { dir = Direction.Left | Direction.Up; } else if (loc.X + c.Size.Width - 5 <= p.X && p.X <= loc.X + c.Size.Width + 5 && loc.Y - 6 <= p.Y && p.Y <= loc.Y + 5) { dir = Direction.Right | Direction.Up; } else if (loc.X - 6 <= p.X && p.X <= loc.X + 5 && loc.Y + c.Size.Height - 5 <= p.Y && p.Y <= loc.Y + c.Size.Height + 5) { dir = Direction.Left | Direction.Down; } else if (loc.X + c.Size.Width - 2 <= p.X && p.X <= loc.X + c.Size.Width + 5 && loc.Y <= p.Y && p.Y <= loc.Y + c.Size.Height) { dir = Direction.Right; } else if (loc.Y + c.Size.Height - 2 <= p.Y && p.Y <= loc.Y + c.Size.Height + 5 && loc.X <= p.X && p.X <= loc.X + c.Size.Width) { dir = Direction.Down; } else if (loc.Y - 6 <= p.Y && p.Y <= loc.Y + 2 && loc.X <= p.X && p.X <= loc.X + c.Size.Width) { dir = Direction.Up; } else if (loc.X - 6 <= p.X && p.X <= loc.X + 2 && loc.Y <= p.Y && p.Y <= loc.Y + c.Size.Height) { dir = Direction.Left; } return(dir); }
public override void FromXmlElement(System.Xml.XmlElement element, Dictionary <string, System.IO.MemoryStream> resources) { base.FromXmlElement(element, resources); SerializationHelper.LoadBitmapFromResources(element, "backgroundNormal9P", resources, s => this.BackgroundNormal9P = s); foreach (System.Xml.XmlElement child in element.ChildNodes) { SkinnableControls.SkinnableControl c = SerializationHelper.GetPlayerControlInstanceFromTagName(child.Name); this.OnControlAdded(c); c.FromXmlElement(child, resources); } }