728x90
반응형
728x170
▶ MainForm.cs
using System;
using System.Windows.Forms;
namespace TestProject
{
/// <summary>
/// 메인 폼
/// </summary>
public partial class MainForm : Form
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainForm()
/// <summary>
/// 생성자
/// </summary>
public MainForm()
{
InitializeComponent();
#region 이벤트를 설정한다.
Load += Form_Load;
this.backgroundColorButton.Click += backgroundColorButton_Click;
this.foregroudColorButton.Click += foregroudColorButton_Click;
#endregion
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
//////////////////////////////////////////////////////////////////////////////// Event
#region 폼 로드시 처리하기 - Form_Load(sender, e)
/// <summary>
/// 폼 로드시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void Form_Load(object sender, EventArgs e)
{
int[] backgroundColorArray =
{
0xffffff, 0xffc0c0, 0xffe0c0, 0xffffc0, 0xc0ffc0,
0xc0ffff, 0xc0c0ff, 0xffc0ff, 0xe0e0e0, 0xff8080,
0xffc080, 0xffff80, 0x80ff80, 0x80ffff, 0x8080ff,
0xff80ff
};
this.backgroundColorDialog.CustomColors = backgroundColorArray;
int[] foregroundColorArray =
{
0x808080, 0xff0000, 0xff8000, 0xffff00, 0x00ff00,
0x00ffff, 0x0000ff, 0xff00ff, 0x000000, 0xc00000,
0x804000, 0xc0c000, 0x008000, 0x00c0c0, 0x0000c0,
0x800080
};
this.foregroundColorDialog.CustomColors = foregroundColorArray;
this.backgroundColorDialog.FullOpen = true;
this.foregroundColorDialog.FullOpen = false;
}
#endregion
#region 전경색 버튼 클릭시 처리하기 - foregroudColorButton_Click(sender, e)
/// <summary>
/// 전경색 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void foregroudColorButton_Click(object sender, EventArgs e)
{
this.foregroundColorDialog.Color = this.ForeColor;
if(this.foregroundColorDialog.ShowDialog() == DialogResult.OK)
{
ForeColor = this.foregroundColorDialog.Color;
}
}
#endregion
#region 배경색 버튼 클릭시 처리하기 - backgroundColorButton_Click(sender, e)
/// <summary>
/// 배경색 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void backgroundColorButton_Click(object sender, EventArgs e)
{
this.backgroundColorDialog.Color = this.BackColor;
if(this.backgroundColorDialog.ShowDialog() == DialogResult.OK)
{
this.BackColor = this.backgroundColorDialog.Color;
this.backgroundColorButton.BackColor = this.backgroundColorDialog.Color;
this.foregroudColorButton.BackColor = this.backgroundColorDialog.Color;
}
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] 실시간 그래프 그리기 (0) | 2018.12.21 |
---|---|
[C#/WINFORM] 타원과 타원 교차점 구하기 (0) | 2018.12.21 |
[C#/WINFORM] PictureBox 클래스 : SizeMode 속성에 따라 이미지 구하기 (0) | 2018.12.19 |
[C#/WINFORM] 다항식 최소 제곱법(Polynomial Least Squares Method) 사용하기 (0) | 2018.12.19 |
[C#/WINFORM] 선형 최소 제곱법(Linear Least Squares Method) 사용하기 (0) | 2018.12.19 |
[C#/WINFORM] ImageAttributes 클래스 : 무지개 색상 이미지 구하기 (0) | 2018.12.19 |
[C#/WINFORM] ImageAttributes 클래스 : 색상 이미지 구하기 (0) | 2018.12.19 |
[C#/WINFORM] ImageAttributes 클래스 : 채널 이미지 구하기 (0) | 2018.12.18 |
[C#/WINFORM] ImageAttributes 클래스 : 세피아 이미지 구하기 (0) | 2018.12.18 |
[C#/WINFORM] ImageAttributes 클래스 : 모노크롬 이미지 구하기 (0) | 2018.12.18 |
댓글을 달아 주세요