/// <summary> /// Converts an existing object from one unit into another unit type. /// </summary> public void ConvertType(XGraphicsUnit type) { if (this.type == type) { return; } switch (type) { case XGraphicsUnit.Point: this.value = this.Point; this.type = XGraphicsUnit.Point; break; case XGraphicsUnit.Centimeter: this.value = this.Centimeter; this.type = XGraphicsUnit.Centimeter; break; case XGraphicsUnit.Inch: this.value = this.Inch; this.type = XGraphicsUnit.Inch; break; case XGraphicsUnit.Millimeter: this.value = this.Millimeter; this.type = XGraphicsUnit.Millimeter; break; case XGraphicsUnit.Pixel: this.value = this.Pixel; this.type = XGraphicsUnit.Pixel; break; // case XGraphicsUnit.Pica: // this.value = this.Pc; // this.type = XGraphicsUnit.Pica; // break; // // case XGraphicsUnit.Line: // this.value = this.Li; // this.type = XGraphicsUnit.Line; // break; default: throw new ArgumentException("Unknown unit type: '" + type.ToString() + "'"); } }
/// <summary> /// Converts an existing object from one unit into another unit type. /// </summary> public void ConvertType(XGraphicsUnit type) { if (this.type == type) return; switch (type) { case XGraphicsUnit.Point: this.value = this.Point; this.type = XGraphicsUnit.Point; break; case XGraphicsUnit.Centimeter: this.value = this.Centimeter; this.type = XGraphicsUnit.Centimeter; break; case XGraphicsUnit.Inch: this.value = this.Inch; this.type = XGraphicsUnit.Inch; break; case XGraphicsUnit.Millimeter: this.value = this.Millimeter; this.type = XGraphicsUnit.Millimeter; break; case XGraphicsUnit.Pixel: this.value = this.Pixel; this.type = XGraphicsUnit.Pixel; break; // case XGraphicsUnit.Pica: // this.value = this.Pc; // this.type = XGraphicsUnit.Pica; // break; // // case XGraphicsUnit.Line: // this.value = this.Li; // this.type = XGraphicsUnit.Line; // break; default: throw new ArgumentException("Unknown unit type: '" + type.ToString() + "'"); } }