Advertisement
MusicFreak

Grafika

Dec 6th, 2013
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.78 KB | None | 0 0
  1.                                                     GRAFIKA
  2.  
  3. Graphics g = e.Graphics;
  4. Pen olovka = new Pen(Color.Red, 10);
  5.  
  6. //ClientRectangle     int x = ClientRectangle.Width;
  7.                     int y = ClientRectangle.Height;
  8.  
  9. Point A = new Point (50, 50);
  10. Point B = new Point (100, 100);
  11. g.DrawLine(olovka, A, B);
  12.  
  13. ========================
  14.  
  15. using System;
  16. using System.Collections.Generic;
  17. using System.ComponentModel;
  18. using System.Data;
  19. using System.Drawing;
  20. using System.Linq;
  21. using System.Text;
  22. using System.Windows.Forms;
  23.  
  24. namespace _06112013_Prav__elip__dija
  25. {
  26.     public partial class Form1 : Form
  27.     {
  28.         public Form1()
  29.         {
  30.             InitializeComponent();
  31.         }
  32.  
  33.         private void button1_Click(object sender, EventArgs e)
  34.         {
  35.             pictureBox1.Refresh();
  36.             Graphics g = pictureBox1.CreateGraphics();
  37.             Pen olovka = new Pen(Color.Blue, 5);
  38.             g.DrawRectangle(olovka, 100, 50, 200, 100);
  39.  
  40.         }
  41.  
  42.         private void button2_Click(object sender, EventArgs e)
  43.         {
  44.             pictureBox1.Refresh();
  45.             Graphics g = pictureBox1.CreateGraphics();
  46.             Pen olovka2 = new Pen(Color.Blue, 5);
  47.             g.DrawEllipse(olovka2, 100, 50, 200, 100);
  48.         }
  49.  
  50.         private void button3_Click(object sender, EventArgs e)
  51.         {
  52.             pictureBox1.Refresh();
  53.             Graphics g = pictureBox1.CreateGraphics();
  54.             Pen olovka3 = new Pen(Color.Blue, 5);
  55.             Point A = new Point(100, 50);
  56.             Point B = new Point(300, 150);
  57.             Point C = new Point(300, 50);
  58.             Point D = new Point(100, 150);
  59.             g.DrawLine(olovka3, A, B);
  60.             g.DrawLine(olovka3, C, D);
  61.         }
  62.     }
  63. }
  64.  
  65. =======================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement