Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication38
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void Form1_Paint(object sender, PaintEventArgs e)
- {
- Graphics g = e.Graphics;
- Font verFont = new Font("Verdana", 10, FontStyle.Bold);
- Font horzFont = new Font("Verdana", 10, FontStyle.Bold);
- SolidBrush vertBrush = new SolidBrush(Color.Black);
- SolidBrush horzBrush = new SolidBrush(Color.Blue);
- Pen blackPen = new Pen(Color.Black, 2);
- Pen bluePen = new Pen(Color.Blue, 2);
- g.DrawLine(blackPen, 50, 250, 50, 25);
- g.DrawLine(bluePen, 50, 220, 250, 220);
- for (int i = 0; i < 11; i++)
- {
- g.DrawString(i.ToString(),
- horzFont, horzBrush, 30 + i * 20, 220);
- }
- StringFormat vertStrFormat = new StringFormat();
- vertStrFormat.FormatFlags = StringFormatFlags.DirectionVertical;
- for (int i = 0; i < 11; i++)
- {
- g.DrawString("-", horzFont, horzBrush,
- 50 + i * 20, 212, vertStrFormat);
- }
- int x = 0;
- g.DrawString("100-", verFont, vertBrush, 20, 20);
- for (int i = 90; i > 0; i -= 10)
- {
- x += 20;
- g.DrawString(i.ToString() + " -", verFont, vertBrush, 25, 20 + x);
- }
- // Odbacivanje predmeta
- verFont.Dispose();
- horzFont.Dispose();
- vertBrush.Dispose();
- horzBrush.Dispose();
- blackPen.Dispose();
- bluePen.Dispose();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Graphics g = this.CreateGraphics();
- Font verFont = new Font("Verdana", 10, FontStyle.Bold);
- Font horzFont = new Font("Verdana", 10, FontStyle.Bold);
- SolidBrush vertBrush = new SolidBrush(Color.Black);
- SolidBrush horzBrush = new SolidBrush(Color.Blue);
- Pen blackPen = new Pen(Color.Black, 2);
- Pen bluePen = new Pen(Color.Blue, 2);
- g.Clear(Color.White);
- g.DrawLine(blackPen, 50, 220, 50, 25);
- g.DrawLine(bluePen, 50, 220, 250, 220);
- // Crtanje po x-osi
- for (int i = 0; i < 11; i++)
- {
- g.DrawString(i.ToString(),
- horzFont, horzBrush, 30 + i * 20, 220);
- }
- // Crtanje vertikalnih stringova
- StringFormat vertStrFormat = new StringFormat();
- vertStrFormat.FormatFlags = StringFormatFlags.DirectionVertical;
- for (int i = 0; i < 10; i++)
- {
- g.DrawString("-", horzFont, horzBrush,
- 50 + i * 20, 212, vertStrFormat);
- }
- // Crtanje po y-osi
- int x = 0;
- g.DrawString("100-", verFont, vertBrush, 20, 20);
- for (int i = 90; i > 0; i -= 10)
- {
- x += 20;
- g.DrawString(i.ToString() + " -", verFont, vertBrush, 25, 20 + x);
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- Graphics g = this.CreateGraphics();
- Pen blackPen = new Pen(Color.Black, 2);
- g.DrawLine(blackPen, 70, 120, 150, 200);
- }
- private void button3_Click(object sender, EventArgs e)
- {
- Graphics g = this.CreateGraphics();
- Pen blackPen = new Pen(Color.Black, 2);
- g.DrawLine(blackPen, 150, 200, 150, 150);
- }
- private void button4_Click(object sender, EventArgs e)
- {
- Graphics g = this.CreateGraphics();
- Pen blackPen = new Pen(Color.Black, 2);
- g.DrawLine(blackPen, 150, 150, 70, 120);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement