不錯的文章
https://www.twblogs.net/a/5b8d8fb72b717718833ef4a92021年3月1日 星期一
[C#] [Flags] setlasterror
不錯的文章
https://igouist.github.io/post/2020/06/bit-flags-and-enum/2021年2月28日 星期日
[C#] 攔截系通資訊/限制滑鼠活動範圍/拖檔案進入
攔截系統資訊取的滑鼠或鍵盤操作
本來以為只能透過 WndProc,原來還有其他做法,學起來,.....
{
public partial class Form1 : Form
{
MessageFilter mf = new MessageFilter();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Application.AddMessageFilter(mf);
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Application.RemoveMessageFilter(mf);
}
}
public class MessageFilter : IMessageFilter
{
public bool PreFilterMessage(ref Message m)
{
switch (m.Msg)
{
case 513:
MessageBox.Show("LEF_BUTTON!", "SYS");
return true;
case 516:
MessageBox.Show("RIGHT_BUTTON!", "SYS");
return false;
default:
return true;
}
}
}
}
namespace mouse_area
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y);
Cursor.Clip = new Rectangle(this.Location,this.Size);
}
private void button2_Click(object sender, EventArgs e)
{
Screen[] screens = Screen.AllScreens;
this.Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Clip = screens[0].Bounds;
}
private void Form1_Load(object sender, EventArgs e)
{
this.AllowDrop = true;
}
private void Form1_DragEnter(object sender, DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
for(int i=0;i<files.Length;i++)
{
listBox1.Items.Add(files[i]);
}
}
}
}
}
2021年2月18日 星期四
[C#]GitHub代碼一鍵轉VS Code:只需+1s
看起來蠻不錯的,不知使用起來如何...
https://bangqu.com/6f87QG.html
2021年2月1日 星期一
[C#]Tuple 語法與參數陣列
感覺不錯,學一下,持續進步!!!
https://www.huanlintalk.com/2017/04/c-7-tuple-syntax.htmlhttps://dotblogs.com.tw/hung-chin/2011/10/03/38682
訂閱:
文章 (Atom)