-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHoofdscherm.cs
94 lines (90 loc) · 3.05 KB
/
Hoofdscherm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using System.Drawing;
using System.Windows.Forms;
namespace SchetsEditor
{
public class Hoofdscherm : Form
{
MenuStrip menuStrip;
ToolStripDropDownItem menu;
SchetsWin s;
public Hoofdscherm()
{ this.ClientSize = new Size(800, 700);
menuStrip = new MenuStrip();
this.Controls.Add(menuStrip);
this.maakFileMenu();
this.maakHelpMenu();
this.Text = "Schets editor";
this.IsMdiContainer = true;
this.MainMenuStrip = menuStrip;
menuStrip.Items[0].Click += EnableSave;
}
private void maakFileMenu()
{
menu = new ToolStripMenuItem("File");
menu.DropDownItems.Add("Nieuw", null, this.nieuw);
menu.DropDownItems.Add("Opslaan", null, this.opslaan);
menu.DropDownItems[1].Enabled = false;
menu.DropDownItems.Add("Open", null, this.open);
menu.DropDownItems.Add("Exit", null, this.afsluiten);
menuStrip.Items.Add(menu);
}
private void maakHelpMenu()
{ ToolStripDropDownItem menu;
menu = new ToolStripMenuItem("Help");
menu.DropDownItems.Add("Over \"Schets\"", null, this.about);
menuStrip.Items.Add(menu);
}
private void EnableSave(object o, EventArgs ea)
{
if (s != null)
{
menu.DropDownItems[1].Enabled = true;
}
else
{
menu.DropDownItems[1].Enabled = false;
}
}
private void about(object o, EventArgs ea)
{ MessageBox.Show("Schets versie 1.0\n(c) UU Informatica 2010"
, "Over \"Schets\""
, MessageBoxButtons.OK
, MessageBoxIcon.Information
);
}
private void nieuw(object sender, EventArgs e)
{ s = new SchetsWin();
s.MdiParent = this;
s.Show();
}
private void afsluiten(object sender, EventArgs e)
{ this.Close();
}
private void opslaan(object sender, EventArgs e)
{
if (s != null)
{
SaveFileDialog save = new SaveFileDialog();
save.Filter = "JPEG-image|*.jpg|PNG-image|*.png|BMP-image|*.bmp|Project-file|*.sketch";
save.FileName = "*.jpg";
if (save.ShowDialog() == DialogResult.OK)
{
s.Opslaan(save.FileName);
}
}
}
private void open(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "JPEG-image|*.jpg|PNG-image|*.png|BMP-image|*.bmp|Project-file|*.sketch";
if (open.ShowDialog() == DialogResult.OK)
{
s = new SchetsWin();
s.MdiParent = this;
s.Open(open.FileName);
}
s.Show();
}
}
}