B2017-024 Added a context menu with windows clipboard options

This commit is contained in:
John Jenko 2017-02-13 19:24:52 +00:00
parent ac103b0f77
commit f933b59e5f
3 changed files with 85 additions and 13 deletions

View File

@ -28,18 +28,25 @@ namespace VEPROMS
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.btnOk = new System.Windows.Forms.Button(); this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button();
this.panelSI = new System.Windows.Forms.Panel(); this.panelSI = new System.Windows.Forms.Panel();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.fwdCMClipBoard = new System.Windows.Forms.ToolStripMenuItem();
this.fwdCMCbCut = new System.Windows.Forms.ToolStripMenuItem();
this.fwdCMCbCopy = new System.Windows.Forms.ToolStripMenuItem();
this.fwdCMCbPaste = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// btnOk // btnOk
// //
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOk.Location = new System.Drawing.Point(12, 222); this.btnOk.Location = new System.Drawing.Point(9, 180);
this.btnOk.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnOk.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnOk.Name = "btnOk"; this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23); this.btnOk.Size = new System.Drawing.Size(56, 19);
this.btnOk.TabIndex = 0; this.btnOk.TabIndex = 0;
this.btnOk.Text = "Ok"; this.btnOk.Text = "Ok";
this.btnOk.UseVisualStyleBackColor = true; this.btnOk.UseVisualStyleBackColor = true;
@ -47,36 +54,76 @@ namespace VEPROMS
// //
// btnCancel // btnCancel
// //
this.btnCancel.Location = new System.Drawing.Point(109, 222); this.btnCancel.Location = new System.Drawing.Point(82, 180);
this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnCancel.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.Size = new System.Drawing.Size(56, 19);
this.btnCancel.TabIndex = 1; this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel"; this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
// //
// panelPSI // panelSI
// //
this.panelSI.AutoScroll = true; this.panelSI.AutoScroll = true;
this.panelSI.Location = new System.Drawing.Point(12, 12); this.panelSI.Location = new System.Drawing.Point(9, 10);
this.panelSI.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.panelSI.Name = "panelSI"; this.panelSI.Name = "panelSI";
this.panelSI.Size = new System.Drawing.Size(349, 205); this.panelSI.Size = new System.Drawing.Size(262, 167);
this.panelSI.TabIndex = 2; this.panelSI.TabIndex = 2;
// //
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fwdCMClipBoard});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(153, 48);
//
// fwdCMClipBoard
//
this.fwdCMClipBoard.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fwdCMCbCut,
this.fwdCMCbCopy,
this.fwdCMCbPaste});
this.fwdCMClipBoard.Name = "fwdCMClipBoard";
this.fwdCMClipBoard.Size = new System.Drawing.Size(152, 22);
this.fwdCMClipBoard.Text = "Clip Board";
//
// fwdCMCbCut
//
this.fwdCMCbCut.Name = "fwdCMCbCut";
this.fwdCMCbCut.Size = new System.Drawing.Size(152, 22);
this.fwdCMCbCut.Text = "Cut";
this.fwdCMCbCut.Click += new System.EventHandler(this.fwdCMCbCut_Click);
//
// fwdCMCbCopy
//
this.fwdCMCbCopy.Name = "fwdCMCbCopy";
this.fwdCMCbCopy.Size = new System.Drawing.Size(152, 22);
this.fwdCMCbCopy.Text = "Copy";
this.fwdCMCbCopy.Click += new System.EventHandler(this.fwdCMCbCopy_Click);
//
// fwdCMCbPaste
//
this.fwdCMCbPaste.Name = "fwdCMCbPaste";
this.fwdCMCbPaste.Size = new System.Drawing.Size(152, 22);
this.fwdCMCbPaste.Text = "Paste";
this.fwdCMCbPaste.Click += new System.EventHandler(this.fwdCMCbPaste_Click);
//
// frmSI // frmSI
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true; this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(373, 257); this.ClientSize = new System.Drawing.Size(280, 209);
this.Controls.Add(this.panelSI); this.Controls.Add(this.panelSI);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk); this.Controls.Add(this.btnOk);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "frmSI"; this.Name = "frmSI";
this.Text = "frmSI"; this.Text = "frmSI";
this.TopMost = true; this.TopMost = true;
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -86,5 +133,10 @@ namespace VEPROMS
private System.Windows.Forms.Button btnOk; private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Panel panelSI; private System.Windows.Forms.Panel panelSI;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem fwdCMClipBoard;
private System.Windows.Forms.ToolStripMenuItem fwdCMCbCut;
private System.Windows.Forms.ToolStripMenuItem fwdCMCbCopy;
private System.Windows.Forms.ToolStripMenuItem fwdCMCbPaste;
} }
} }

View File

@ -66,9 +66,10 @@ namespace VEPROMS
string mystr = tb.FontTable; string mystr = tb.FontTable;
_DicStepRtb.Add(fld.name, tb); _DicStepRtb.Add(fld.name, tb);
tb.MyItemInfo = null; // pi as ItemInfo; tb.MyItemInfo = null; // pi as ItemInfo;
tb.FieldToEdit = E_FieldToEdit.PSI; tb.FieldToEdit = E_FieldToEdit.Text;//E_FieldToEdit.PSI;
tb.BorderStyle = BorderStyle.FixedSingle; tb.BorderStyle = BorderStyle.FixedSingle;
tb.Enter += new System.EventHandler(this.FieldStepRTB_Enter); tb.Enter += new System.EventHandler(this.FieldStepRTB_Enter);
tb.ContextMenuStrip = contextMenuStrip1; // B2017-024 clipboard context menu
// see if config has data for this field, i.e. search for the 'name' // see if config has data for this field, i.e. search for the 'name'
string val = DoFolder ? folderConfig.GetValue("SI", fld.name) : dvConfig.GetValue("SI", fld.name); string val = DoFolder ? folderConfig.GetValue("SI", fld.name) : dvConfig.GetValue("SI", fld.name);
DisplayText dt = new DisplayText(val, new VE_Font("Arial", 10, E_Style.None, 12), false); DisplayText dt = new DisplayText(val, new VE_Font("Arial", 10, E_Style.None, 12), false);
@ -193,5 +194,21 @@ namespace VEPROMS
DialogResult = DialogResult.Cancel; DialogResult = DialogResult.Cancel;
this.Close(); this.Close();
} }
// B2017-024 - added a clip board context menu
private void fwdCMCbCut_Click(object sender, EventArgs e)
{
SendKeys.Send("^x"); // <cltr><x>
}
private void fwdCMCbCopy_Click(object sender, EventArgs e)
{
SendKeys.Send("^c"); // <cltr><c>
}
private void fwdCMCbPaste_Click(object sender, EventArgs e)
{
SendKeys.Send("^v"); // <cltr><v>
}
} }
} }

View File

@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>