CSharp

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
テンプレート
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#if (true)
#else
#endif

#if DEBUG
#endif


Console.WriteLine("tableDataGridView_ColumnHeaderMouseClick");


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
非同期処理
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

Action func = async () =>
{
    // UI処理(タスク開始前)



    await Task.Run(() =>
    {
        // タスク処理



    });

    // UI処理(タスク終了後)



};

func();


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
フォームサイズを固定とする (ロード時に実装する)
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

// フォームサイズを固定とする
this.MaximumSize = this.Size;
this.MinimumSize = this.Size;

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
プロセス終了
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

例) Adobe Reader を終了させる

Process[] ps = Process.GetProcessesByName("AcroRd32");
foreach (Process p in ps)
{
    // 印刷終了まで待つ
    int cnt = 0;
    while (!p.HasExited)
    {
        if (cnt > 10)
        {
            // 20(2*10)秒待機しても終了しない場合、強制終了させる
            p.Kill();
            break;
        }

        p.CloseMainWindow();
        p.WaitForExit(2000);

        cnt++;
    }

    p.Close();
    p.Dispose();
}


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
フォント設定(グリッドビュー)
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// ただし、UI上で設定可能である。

Font font = new Font("MS UI Gothic", 14.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(128)));
for (int i = 0; i < this.dgvMain.ColumnCount; i++)
{
    this.dataGridView.Columns[i].HeaderCell.Style.Font = font;
}
this.dataGridView.DefaultCellStyle.Font = font;
this.dataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
最終更新:2017年10月06日 10:23