Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Globalization;
  8. using System.Threading;
  9.  
  10. namespace WindowsFormsApplication1
  11. {
  12.  
  13. public partial class Form1 : Form
  14. {
  15.  
  16. int scale = 15;
  17. public Form1()
  18.  
  19. {
  20. InitializeComponent();
  21. }
  22.  
  23. StreamReader file = new StreamReader("D:\\zadanie.txt");
  24. private void panel1_Paint(object sender, PaintEventArgs e)
  25.  
  26. {
  27.  
  28. Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");
  29. Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
  30.  
  31. e.Graphics.DrawLine(Pens.BlueViolet, panel1.Width / 2, 0, panel1.Width / 2, panel1.Height); //os y
  32. e.Graphics.DrawLine(Pens.BlueViolet, 0, panel1.Height / 2, panel1.Width, panel1.Height / 2); //os x
  33. Point absZero = new Point(panel1.Width / 2, panel1.Height / 2);
  34. int i = absZero.X;
  35. while (i < panel1.Width)
  36.  
  37. {
  38. i += scale;
  39. e.Graphics.DrawLine(Pens.BlueViolet, i, absZero.Y - 4, i, absZero.Y + 4);
  40. }
  41.  
  42. //Point absZero = new Point(panel1.Width / 2, panel1.Height / 2);
  43. e.Graphics.DrawLine(Pens.BlueViolet, absZero.X, 0, absZero.X, panel1.Height);
  44. e.Graphics.DrawLine(Pens.BlueViolet, 0, absZero.Y, 0, absZero.Y);
  45. //int i = absZero.X;
  46. while (i < panel1.Width)
  47.  
  48. {
  49. i += scale;
  50. e.Graphics.DrawLine(Pens.BlueViolet, i, absZero.Y - 4, i, absZero.Y + 4);
  51. }
  52.  
  53. i = absZero.X;
  54. while (i > 0)
  55.  
  56. {
  57. i -= scale;
  58. e.Graphics.DrawLine(Pens.BlueViolet, i, absZero.Y - 4, i, absZero.Y + 4);
  59. }
  60.  
  61. i = absZero.Y;
  62. while (i < panel1.Height)
  63.  
  64. {
  65. i += scale;
  66. e.Graphics.DrawLine(Pens.BlueViolet, absZero.X - 4, i, absZero.X + 4, i);
  67. }
  68. i = absZero.Y;
  69. while (i > 0)
  70.  
  71. {
  72.  
  73. i -= scale;
  74. e.Graphics.DrawLine(Pens.BlueViolet, absZero.X - 4, i, absZero.X + 4, i);
  75.  
  76. }
  77.  
  78. String line;
  79. float X ;
  80. float Y ;
  81.  
  82. while ((line = file.ReadLine()) != null)
  83. {
  84. X = float.Parse(line.Split(' ')[0]);
  85. Y = float.Parse(line.Split(' ')[1]);
  86. e.Graphics.FillEllipse(Brushes.Red, (absZero.X + (X * scale)) - 2, (absZero.Y - (Y * scale)) - 2, 4, 4);
  87. }
  88. }
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement