C#インタフェースデザインメモ
4341 ワード
顧客領域の図面:
winprocをリロードして、WM_を遮蔽しますNCPAINT等:
フォームの最大化、最小化、閉じる:
- public partial class MyForm : Form
- {
-
- public MyForm()
- {
- InitializeComponent();
- BackColor = Color.Red;
- Text = "Hello World";
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- //base.OnPaint(e);
- e.Graphics.DrawString("Hello,WinForm .", Font, Brushes.White, 0, 0);
- }
- }
winprocをリロードして、WM_を遮蔽しますNCPAINT等:
- protected override void WndProc(ref Message m)
- {
- if (m.Msg == 0x83 || m.Msg == 0x85 || m.Msg==0x86)
- return;
- base.WndProc(ref m);
- }
フォームの最大化、最小化、閉じる:
- private void btnMin_Click(object sender, EventArgs e)
- {
- WindowState = FormWindowState.Minimized;
- }
-
- private void btnMaxNormal_Click(object sender, EventArgs e)
- {
- if (WindowState == FormWindowState.Normal)
- {
- WindowState = FormWindowState.Maximized;
- button2.Text = " ";
- }
- else
- {
- WindowState = FormWindowState.Normal;
- button2.Text = " ";
- }
- }
-
- private void btnClose_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }