private string GetMapgginData() { StringBuilder builder = new System.Text.StringBuilder(); builder.Append("00,00,00,00"); // ヘッダー(バージョン番号) builder.Append(",00,00,00,00"); // ヘッダー(フラグ) builder.Append("," + this.cKeyList.RowCount.ToString("X2") + ",00,00,00"); // エントリー数 for (int i = 0; i < this.cKeyList.RowCount; i++) { DataGridViewRowEx row = this.cKeyList.GetRow(i); builder.Append("," + row.getValue(Col.ScanCode2)); if (0 == row.getValue(Col.Flags2).Length) { builder.Append(",00"); } else { builder.Append(",E0"); } builder.Append("," + row.getValue(Col.ScanCode1)); if (0 == row.getValue(Col.Flags1).Length) { builder.Append(",00"); } else { builder.Append(",E0"); } } builder.Append(",00,00,00,00"); // NULLターミネーター return(builder.ToString().Replace("0x", "")); }
private void cSave_Click(object sender, EventArgs e) { if (0 == this.cScanCode1.Text.Length || 0 == this.cScanCode2.Text.Length) { return; } DataGridViewRowEx row = this._row; if (null == row) { row = this.cKeyList.FindRow(Col.ScanCode1, this.cScanCode1.Text); if (row == null) { row = this.cKeyList.NewRow(); } } row.setValue(Col.ScanCode1, this.cScanCode1.Text); row.setValue(Col.WindowsKey1, this.cWindowsKey1.Text); row.setValue(Col.Flags1, this.cFlags1.Text); row.setValue(Col.ScanCode2, this.cScanCode2.Text); row.setValue(Col.WindowsKey2, this.cWindowsKey2.Text); row.setValue(Col.Flags2, this.cFlags2.Text); row.setValue(Col.Edit, "edit"); row.setValue(Col.Delete, "delete"); this._changed = true; }
/// <summary> /// edit click /// </summary> /// <param name="index"></param> private void KeyList_Edit_Click(int index) { this._row = this.cKeyList.GetRow(index); this.cScanCode1.Text = this._row.getValue(Col.ScanCode1); this.cScanCode2.Text = this._row.getValue(Col.ScanCode2); this.cWindowsKey1.Text = this._row.getValue(Col.WindowsKey1); this.cWindowsKey2.Text = this._row.getValue(Col.WindowsKey2); this.cFlags1.Text = this._row.getValue(Col.Flags1); this.cFlags2.Text = this._row.getValue(Col.Flags2); }