mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-06-02 23:34:13 -05:00
parent
a2c5870deb
commit
1253ac1bc8
1
PKHeX/Subforms/frmReport.Designer.cs
generated
1
PKHeX/Subforms/frmReport.Designer.cs
generated
|
|
@ -43,6 +43,7 @@ private void InitializeComponent()
|
|||
this.dgData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dgData.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
this.dgData.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
|
||||
this.dgData.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
|
||||
this.dgData.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dgData.Location = new System.Drawing.Point(0, 0);
|
||||
this.dgData.Name = "dgData";
|
||||
|
|
|
|||
|
|
@ -164,6 +164,35 @@ private void Export_CSV(string path)
|
|||
|
||||
File.WriteAllText(path, sb.ToString(), Encoding.UTF8);
|
||||
}
|
||||
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
bool cp = keyData == (Keys.Control | Keys.C) && ActiveControl is DataGridView;
|
||||
if (!cp)
|
||||
return base.ProcessCmdKey(ref msg, keyData);
|
||||
|
||||
string data = dgData.GetClipboardContent().GetText();
|
||||
var dr = Util.Prompt(MessageBoxButtons.YesNo, "Copy as formatted table?");
|
||||
if (dr != DialogResult.Yes)
|
||||
{
|
||||
Clipboard.SetText(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reformat datagrid clipboard content
|
||||
string[] lines = data.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
||||
int tabcount = lines[0].Count(c => c == '\t');
|
||||
|
||||
string[] newlines = new string[lines.Length + 1];
|
||||
newlines[0] = lines[0].Replace('\t', '|');
|
||||
newlines[1] = string.Join(":--:", new int[tabcount + 2].Select(t => '|')); // 2 pipes for each end
|
||||
for (int i = 1; i < lines.Length; i++)
|
||||
newlines[i + 1] = lines[i].Replace('\t', '|');
|
||||
|
||||
Clipboard.SetText(string.Join(Environment.NewLine, newlines));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public class PokemonList : SortableBindingList<Preview> { }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user