for Push.
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace KssSmaPlaLib.Forms.Controls
|
||||
{
|
||||
public class PoiDgv : DataGridView
|
||||
{
|
||||
private IContainer components;
|
||||
|
||||
[Category("Poi拡張"), Description("共通メニューを自動で追加するかどうか")]
|
||||
public bool EnablePoiMenu { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// コンストラクタ
|
||||
/// </summary>
|
||||
public PoiDgv()
|
||||
{
|
||||
// これが今回の本命!
|
||||
this.DoubleBuffered = true;
|
||||
|
||||
// DGB初期設定
|
||||
this.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
this.RowHeadersVisible = false;
|
||||
this.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
this.AllowUserToAddRows = false;
|
||||
this.AllowUserToDeleteRows = false;
|
||||
this.AllowUserToOrderColumns = true;
|
||||
this.AllowUserToResizeColumns = true;
|
||||
this.AllowUserToResizeRows = false;
|
||||
this.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// コンテキストメニュー設定時
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnContextMenuStripChanged(EventArgs e)
|
||||
{
|
||||
base.OnContextMenuStripChanged(e);
|
||||
|
||||
// ユーザーがデザイナーでセットしたメニューに「Poi」のスパイスを加える
|
||||
if (EnablePoiMenu && this.ContextMenuStrip != null)
|
||||
{
|
||||
var menu = this.ContextMenuStrip;
|
||||
|
||||
//// 重複防止チェック
|
||||
//if (menu.Items.Find("poiItem_AutoFit", true).Length == 0)
|
||||
//{
|
||||
// if (menu.Items.Count > 0) menu.Items.Add(new ToolStripSeparator());
|
||||
|
||||
// var fitItem = new ToolStripMenuItem("列幅をぽいっと自動調整");
|
||||
// fitItem.Name = "poiItem_AutoFit";
|
||||
// fitItem.Click += (s, ev) => this.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
|
||||
|
||||
// menu.Items.Add(fitItem);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// PoiDgv
|
||||
//
|
||||
this.RowTemplate.Height = 21;
|
||||
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user