-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddToDoForm.cs
75 lines (67 loc) · 2.16 KB
/
AddToDoForm.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
namespace NaskoShell
{
public partial class AddToDoForm : Form
{
public AddToDoForm()
{
InitializeComponent();
}
public string ToDoText
{
get
{
return todoTextBox.Text;
}
}
public DateTime ToDoDate
{
get
{
return todoDate.Value.Date;
}
}
public int ToDoPriority
{
get
{
return priorityBar.Value;
}
}
private void AddToDoForm_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)System.Windows.Forms.Keys.Enter)
{
this.DialogResult = DialogResult.OK;
}
else if (e.KeyChar == (char)System.Windows.Forms.Keys.Escape)
this.DialogResult = DialogResult.Cancel;
}
private void AddToDoForm_Load(object sender, EventArgs e)
{
todoDate.Value = DateTime.Now;
}
private void AddToDoForm_Paint(object sender, PaintEventArgs e)
{
Graphics graphics = e.Graphics;
int CornerRadius = 10;
Pen pen = new Pen(Color.Black, 2);
pen.EndCap = pen.StartCap = LineCap.Round;
System.Drawing.Drawing2D.GraphicsPath gfxPath = new System.Drawing.Drawing2D.GraphicsPath();
gfxPath.AddArc(0, 0, CornerRadius, CornerRadius, 180, 90);
gfxPath.AddArc(0 + this.Width - CornerRadius, 0, CornerRadius, CornerRadius, 270, 90);
gfxPath.AddArc(0 + this.Width - CornerRadius, 0 + this.Height - CornerRadius, CornerRadius, CornerRadius, 0, 90);
gfxPath.AddArc(0, 0 + Bounds.Height - CornerRadius, CornerRadius, CornerRadius, 90, 90);
gfxPath.CloseAllFigures();
graphics.DrawPath(pen,gfxPath);
this.Region = new Region(gfxPath);
}
}
}