/***************************************************/ // // /***************************************************/ using System; using System.Drawing; using System.Windows.Forms; using System.Globalization; namespace IPadLibrary.FormsInterfaces { /// /// Collect all general porpouse routines used by forms. /// class GeneralLibrary { /// /// Used to drawing the Form borders only. /// public static void DrawFormBorder(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Form f = (Form) sender; Size drawArea = new Size(f.ClientSize.Width, f.ClientSize.Height); // Drawing the cornice g.DrawRectangle(Pens.Black, 0, 0, drawArea.Width-1, drawArea.Height-1); g.DrawRectangle(Pens.White, 1, 1, drawArea.Width-3, drawArea.Height-3); g.DrawRectangle(Pens.LightGray, 2, 2, drawArea.Width-5, drawArea.Height-5); } public static string float2string(float num) { return String.Format("{0:0.00}", num).Replace(',','.'); } public static float string2float(string text) { return float.Parse( text, new NumberFormatInfo() ); } public static PointF convertStr2Point(string xstr, string ystr) { NumberFormatInfo nfi = new NumberFormatInfo(); // Number Format Info used for '.' float x, y; x = float.Parse( xstr, nfi ); y = float.Parse( ystr, nfi ); return ( new PointF(x, y) ); } public static bool isNegative(float num) { return ( num < 0.0f ); } } // end class } // end namespace