c#
[c#, customForm] winform customizing 1
퐁퐁
2020. 11. 12. 17:24
* 결과물
* 소스
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
|
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
private bool _isMouseDown = false;
private Point _lastLocation;
public Form1()
{
InitializeComponent();
pnlFormTitle.BackColor = Color.FromArgb(60, 63, 65);
this.BackColor = Color.FromArgb(75, 75, 75);
pnlFormTitle.Paint += (sender, e) =>
{
Graphics g = e.Graphics;
g.FillRectangle(new SolidBrush(Color.FromArgb(68, 221, 136)), new Rectangle(0, pnlFormTitle.Height - 1, pnlFormTitle.Width, 1));
};
}
private void pnlFormTitle_MouseDown(object sender, MouseEventArgs e)
{
_isMouseDown = true;
_lastLocation = e.Location;
}
private void pnlFormTitle_MouseMove(object sender, MouseEventArgs e)
{
if (!_isMouseDown) return;
this.Location = new Point(this.Location.X - _lastLocation.X + e.X, this.Location.Y - _lastLocation.Y + e.Y);
this.Update();
}
private void pnlFormTitle_MouseUp(object sender, MouseEventArgs e)
{
_isMouseDown = false;
}
}
}
|
cs |
시간이 없어 일단 올리고 다음에 icon, form text, close button등 작업해서 다시 올릴예정