Advertisement
bartigames

Untitled

Apr 15th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Drawing;
  11.  
  12.  
  13. namespace WindowsFormsApplication3
  14. {
  15.    
  16.  
  17.     public partial class Form1 : Form
  18.     {
  19.         Graphics g;
  20.         SolidBrush pedzel;
  21.         Pen pioro;
  22.  
  23.  
  24.  
  25.         public Form1()
  26.         {
  27.             g = CreateGraphics();
  28.             pedzel = new SolidBrush(Color.DarkBlue);
  29.             pioro = new Pen(Color.Pink, 9);
  30.             InitializeComponent();
  31.         }
  32.  
  33.         private void okragłeToolStripMenuItem_Click(object sender, EventArgs e)
  34.         {
  35.             g.Clear(BackColor);
  36.                 g.DrawEllipse(pioro, 60, 60, 100, 100);
  37.            
  38.            
  39.         }
  40.  
  41.         private void prostakatToolStripMenuItem_Click(object sender, EventArgs e)
  42.         {
  43.             g.Clear(BackColor);
  44.            Rectangle pr = new Rectangle(60,60,100,100);
  45.            g.DrawRectangle(pioro, pr);
  46.         }
  47.  
  48.         private void zakończToolStripMenuItem_Click(object sender, EventArgs e)
  49.         {
  50.             Application.Exit();
  51.         }
  52.  
  53.         private void liniaToolStripMenuItem_Click(object sender, EventArgs e)
  54.         {
  55.             g.Clear(BackColor);
  56.             pioro.Color = Color.LimeGreen;
  57.             g.DrawLine(pioro, 50, 100, 200, 250);
  58.         }
  59.  
  60.         private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
  61.         {
  62.  
  63.         }
  64.  
  65.         private void kółToolStripMenuItem_Click(object sender, EventArgs e)
  66.         {
  67.             Random r = new Random();
  68.             int x, y;
  69.             g.Clear(BackColor);
  70.  
  71.             for (int i = 0; i < 101; i++)
  72.             {
  73.                 x = r.Next(this.ClientRectangle.Height - 100);
  74.                 y = r.Next(this.ClientRectangle.Width - 100);
  75.                 g.DrawEllipse(pioro, x, y, 100, 100);
  76.  
  77.             }
  78.            
  79.    
  80.            
  81.         }
  82.  
  83.         private void buźkaToolStripMenuItem_Click(object sender, EventArgs e)
  84.         {
  85.            
  86.            
  87.            
  88.             g.Clear(BackColor);
  89.             g.DrawEllipse(pioro, 80, 80, 120, 140);
  90.             g.DrawEllipse(pioro, 100, 130, 10, 10);
  91.             g.DrawEllipse(pioro, 155, 130, 10, 10);
  92.             g.DrawLine(pioro, 200, 100, 100, 100);
  93.        
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.         }    
  102.  
  103.         private void Form1_MouseDown(object sender, MouseEventArgs e)
  104.         {
  105.             g.Clear(BackColor);
  106.             g.DrawEllipse(pioro, 5, 5, e.X, e.Y);
  107.         }
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement