C#完成將窗體固定在顯示器的左上角且不克不及挪動的辦法。本站提示廣大學習愛好者:(C#完成將窗體固定在顯示器的左上角且不克不及挪動的辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是C#完成將窗體固定在顯示器的左上角且不克不及挪動的辦法正文
本文實例講述了C#完成將窗體固定在顯示器的左上角且不克不及挪動的辦法。分享給年夜家供年夜家參考。詳細完成辦法以下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.InteropServices;
namespace App
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(0, 0);
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == 0x84 && m.Result == (IntPtr)2) //不讓拖動題目欄
{
m.Result = (IntPtr)1;
}
if (m.Msg == 0xA3) //雙擊題目欄無反響
{
m.WParam = System.IntPtr.Zero;
}
}
}
}
願望本文所述對年夜家的C#法式設計有所贊助。