internal int WidthCalc(Report rpt, Graphics g) { WorkClass wc = GetWC(rpt); int width; if (this._TC != null) { // must be part of a table Table t = _TC.OwnerTable; int colindex = _TC.ColIndex; // Calculate width: add up all columns within the column span width = 0; TableColumn tc; for (int ci = colindex; ci < colindex + _TC.ColSpan; ci++) { tc = (TableColumn)(t.TableColumns.Items[ci]); width += tc.Width.ToPixels(); } } else if (wc.MC != null) { // must be part of a matrix width = g == null? Measurement.PixelsFromPoints(wc.MC.Width, Measurement.STANDARD_DPI_X) : Measurement.PixelsFromPoints(wc.MC.Width, g.DpiX); } else { // not part of a table or matrix if (Width != null) { width = Width.ToPixels(); } else { width = Measurement.PixelsFromPoints(WidthOrOwnerWidth(rpt), Measurement.STANDARD_DPI_X); } } return(width); }
/// <summary> /// Converts the size into pixels. /// </summary> /// <param name="dpi">The dpi to be used in the convertion.</param> /// <returns>An int containing the size in pixels.</returns> internal int ToPixels(decimal dpi) { return(RSize.ToPixels(_Size, dpi)); }
/// <summary> /// Converts the size into pixels, assuming a 96 DPI. /// </summary> /// <param name="size">The size to be converted.</param> /// <returns>An int containing the size in pixels with a 96 DPI assumed.</returns> static public int ToPixels(int size) { return(RSize.ToPixels(size, (decimal)Measurement.STANDARD_DPI_X)); }
// Return value as if specified as px //internal int PixelsX //{ // get // { // For now assume 96 dpi; TODO: what would be better way; shouldn't use server display pixels // decimal p = _Size; // p = p / PARTS_PER_INCH; // get it in inches // p = p * 96; // // if (p != 0) // return (int) p; // return (_Size > 0) ? 1 : (int) p; // } //} //static internal readonly float POINTSIZED = 72.27f; //static internal readonly decimal POINTSIZEM = 72.27m; //static internal int PixelsFromPoints(float x) //{ // int result = (int) (x * 96 / POINTSIZED); // convert to pixels // if (result == 0 && x > .0001f) // return 1; // return result; //} //static internal int PixelsFromPoints(Graphics g, float x) //{ // int result = (int) (x * g.DpiX / POINTSIZED); // convert to pixels // if (result == 0 && x > .0001f) // return 1; // return result; //} /// <summary> /// Converts the size into pixels, assuming Measurement.STANDARD_DPI_X. /// </summary> /// <returns>An int containing the size in pixels with Measurement.STANDARD_DPI_X assumed.</returns> internal int ToPixels() { return(RSize.ToPixels(_Size, (decimal)Measurement.STANDARD_DPI_X)); }