LoginSignup
0
0

More than 1 year has passed since last update.

cscの作法 その275

Posted at

概要

cscの作法、調べてみた。
練習問題やってみた。

練習問題

フォームの位置を固定せよ。

方針

  • WndProc使って、メッセージを捨てる。

サンプルコード

using System;
using System.Windows.Forms;
using System.Drawing;

class form1: Form {
	form1() {
		Text = "hello";
		ClientSize = new Size(300, 300);
	}
	protected override void WndProc(ref Message m) {
		const int WM_SYSCOMMAND = 0x0112;
		const long SC_MOVE = 0xF010L;
		if (m.Msg == WM_SYSCOMMAND && (m.WParam.ToInt64() & 0xFFF0L) == SC_MOVE)
		{
			m.Result = IntPtr.Zero;
			return;
		}
		base.WndProc(ref m);
	}
	[STAThread]
	public static void Main() {
		Application.Run(new form1());
	}
}





以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0