public static void AssertAlmostEqual (PointF expected, PointF actual) { string msg = String.Format("\nExpected : {0} \n Actual : {1}",expected.ToString(),actual.ToString()); AssertAlmostEqual (expected.X, actual.X, DEFAULT_FLOAT_TOLERANCE, msg); AssertAlmostEqual (expected.Y, actual.Y, DEFAULT_FLOAT_TOLERANCE, msg); }
protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; PointF drawPoint = new PointF(0.0f, 0.0f); using( Brush brush = new SolidBrush(ForeColor) ) { StringFormat format = StringFormat.GenericTypographic; SizeF size = g.MeasureString(Text, Font); g.DrawString( Text, Font, brush, drawPoint, format ); foreach(string item in items) { string str = BulletCharacter + " " + item; drawPoint.Y += size.Height;// + (float) Font.FontFamily.GetLineSpacing(Font.Style); size = g.MeasureString(str, Font); System.Diagnostics.Trace.WriteLine(drawPoint.ToString()); g.DrawString( str, Font, brush, drawPoint, format); } } }
private Road NearXRoad() { Road[] roadz = Map.Roads.Where(r => r != _road && !r.SensAngle.Equals(_angle)).ToArray(); //StrucRectangle sr = new StrucRectangle(PosX, PosX, Length, Height); //Road ro = roadz.FirstOrDefault(road => road.StructRect.IntersectsWith(sr)); Road ro = null; //foreach (Road road in roadz) //{ // //if (road.StructRect.IntersectsWith(this.RectF)) // if (IsOverRoad(road)) // { // ro = road; // break; // } //} //if (ro != null) // Debug.WriteLine("its okay ;)"); PointF middle = new PointF((float)((this.PosX + this._height) / 2), (float)((this.PosX - this._height) / 2)); Debug.WriteLine(middle.ToString()); if (XRoad.Rect.Contains(new Point(PosX, PosY))) { Debug.WriteLine("ok bro"); ro = roadz.ElementAt(0); if (PosY < XRoad.Rect.Top + XRoad.Rect.Height) ro = roadz.ElementAt(1); } return ro; }
private void PerformToStringTest(CultureInfo culture) { // set current culture Thread.CurrentThread.CurrentCulture = culture; // perform tests Assert.AreEqual (GetExpectedToString (culture, pt0_11), pt0_11.ToString (), "TS#1-" + culture.Name); Assert.AreEqual (GetExpectedToString (culture, pt11_0), pt11_0.ToString (), "TS#2-" + culture.Name); Assert.AreEqual (GetExpectedToString (culture, pt11_99), pt11_99.ToString (), "TS#3-" + culture.Name); PointF pt = new PointF (float.NaN, float.NegativeInfinity); Assert.AreEqual (GetExpectedToString (culture, pt), pt.ToString (), "TS#4-" + culture.Name); }
private void frm3DSurfaceGraphViewer_MouseDown(object sender, MouseEventArgs e) { /*if (e.Button == MouseButtons.Left) { // rotate this.Cursor = GenerateCursor("Turn"); } else if (e.Button == MouseButtons.Right) { // pan this.Cursor = GenerateCursor("Pan"); } m_IsDragging = true; m_p = e.Location; //Invalidate();*/ double d = 0.0; PointF p = new PointF(); bool b = sr.GetMousePoint(e.X, e.Y, out p, out d); string s = b.ToString() + " | " + p.ToString() + " | " + d.ToString(); // if (b) System.Diagnostics.Debug.Write("\nMouseDown: " + s + "\n"); if (e.Button == MouseButtons.Left) { // rotate this.Cursor = GenerateCursor("Turn"); } else if (e.Button == MouseButtons.Right) { // pan this.Cursor = GenerateCursor("Pan"); } m_IsDragging = true; m_p = e.Location; }