public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (culture == null) { culture = System.Globalization.CultureInfo.CurrentCulture; } UIDim dim = (UIDim)value; if (destinationType == typeof(string) && dim != null) { string separator = culture.TextInfo.ListSeparator + " "; TypeConverter converter = TypeDescriptor.GetConverter(typeof(float)); string[] stringArray = new string[2]; stringArray[0] = converter.ConvertToString(context, culture, dim.scale); stringArray[1] = converter.ConvertToString(context, culture, dim.offest); return(String.Join(separator, stringArray)); } return(base.ConvertTo(context, culture, value, destinationType)); }
protected internal override bool OnMouseMove(GUIMouseEventArgs e) { bool ret = base.OnMouseMove(e); if (isBeingDragged) { Vector2 delta = e.Position - dragPosition; dragPosition = e.Position; if (horzFree) { UIDim newX = this.X; newX.offest += delta.x; // limit value to within currently set range newX.offest = (newX.offest < horzMin) ? horzMin : (newX.offest > horzMax) ? horzMax : newX.offest; if (newX != this.X) { this.X = newX; // send notification as required if (hotTrack) { OnPositionChanged(new WindowEventArgs(this)); } } } if (vertFree) { UIDim newY = this.Y; newY.offest += delta.y; // limit new position to within currently set range newY.offest = (newY.offest < vertMin) ? vertMin : (newY.offest > vertMax) ? vertMax : newY.offest; if (newY != this.Y) { this.Y = newY; // send notification as required if (hotTrack) { OnPositionChanged(new WindowEventArgs(this)); } } } return(true); } return(ret); }
protected internal override bool OnMouseMove(GUIMouseEventArgs e) { bool ret = base.OnMouseMove(e); if (SizingEnabled && isBeingSized && sizingLocation != SizingLocation.None) { Vector2 deltaVector = e.Position - dragStartPosition; dragStartPosition = e.Position; // 左边 UIDim xOffest = new UIDim(0, deltaVector.x); UIDim yOffest = new UIDim(0, deltaVector.y); if (sizingLocation == SizingLocation.Left || sizingLocation == SizingLocation.TopLeft || sizingLocation == SizingLocation.BottomLeft) { this.X += xOffest; this.Width -= xOffest; } // 右边 if (sizingLocation == SizingLocation.Right || sizingLocation == SizingLocation.TopRight || sizingLocation == SizingLocation.BottomRight) { this.Width += xOffest; } // 上方 if (sizingLocation == SizingLocation.Top || sizingLocation == SizingLocation.TopLeft || sizingLocation == SizingLocation.TopRight) { this.Y += yOffest; this.Height -= yOffest; } // 下方 if (sizingLocation == SizingLocation.Bottom || sizingLocation == SizingLocation.BottomLeft || sizingLocation == SizingLocation.BottomRight) { this.Height += yOffest; } return(true); } return(ret); }
public CommandSetWindowDimCenterX(Window wnd) { TargetWindow = wnd; OldDimX = TargetWindow.X; OldDimWidth = TargetWindow.Width; }
public CommandSetWindowDimX(Window wnd, UIDim newX) { TargetWindows = wnd; OldDim = TargetWindows.X; TargetDim = newX; }
public CommandSetWindowDimY(Window wnd, UIDim newY) { TargetWindows = wnd; OldDim = TargetWindows.Y; TargetDim = newY; }
public CommandSetWindowDimFullY(Window wnd) { TargetWindows = wnd; OldDimY = TargetWindows.Y; OldDimHeight = TargetWindows.Height; }
public CommandSetWindowDimCenterY(Window wnd) { TargetWindow = wnd; OldDimY = TargetWindow.Y; OldDimHeight = TargetWindow.Height; }