🐥
WinFormメモ
Popup Menu
{
ContextMenuStrip _popup = new ContextMenuStrip();
ToolStripButton b1 = new ToolStripButton("New");
m_popup.Items.Add(b1);
}
private void xxx_MouseDown(object? sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
m_popup.Show(this, e.X, e.Y);
}
}
Form を閉じないようにする
{
FormClosing += MyForm_FormClosing;
}
private void MyForm_FormClosing(object? sender, FormClosingEventArgs e)
{
e.Cancel = true;
}
Graphics オブジェクト
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs pe)
{
Graphics g = pe.Graphics;
}
イメージから Graphics オブジェクトを作成する
Bitmap myBitmap = new Bitmap(@".\image.png");
Graphics g = Graphics.FromImage(myBitmap);
Discussion