/// <summary> /// 絵文字対応の TextBox - KeyDown /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EmojiTextBox_KeyDown(object sender, KeyEventArgs e) { EmojiTextBox emojiTextBox = (EmojiTextBox)sender; switch (e.KeyCode) { case Keys.Enter: if (e.Control) { Emoji emoji = this.emojiList.GetCurrentEmoji(); if (emoji != null) { emojiTextBox.SelectedText = new string(emoji.Unicode, 1); emojiTextBox.SelectionLength = 0; // 履歴へ登録する this.emojiList.RegistEmojiHistory(emoji.Jiscode); } e.SuppressKeyPress = true; e.Handled = true; } break; case Keys.Up: if (!e.Shift && e.Control) { this.emojiList.ChangeEmojiSelectionOnCurrentGroup(EmojiList.ChangeCurrentDirection.Up); e.Handled = true; } break; case Keys.Down: if (!e.Shift && e.Control) { this.emojiList.ChangeEmojiSelectionOnCurrentGroup(EmojiList.ChangeCurrentDirection.Down); e.Handled = true; } break; case Keys.Left: if (!e.Shift && e.Control) { this.emojiList.ChangeEmojiSelectionOnCurrentGroup(EmojiList.ChangeCurrentDirection.Left); e.Handled = true; } else if (e.Shift && e.Control) { this.emojiList.ChangeEmojiGroupSelection(EmojiList.ChangeCurrentDirection.Left); e.Handled = true; } break; case Keys.Right: if (!e.Shift && e.Control) { this.emojiList.ChangeEmojiSelectionOnCurrentGroup(EmojiList.ChangeCurrentDirection.Right); e.Handled = true; } else if (e.Shift && e.Control) { this.emojiList.ChangeEmojiGroupSelection(EmojiList.ChangeCurrentDirection.Right); e.Handled = true; } break; } if (e.Handled) { emojiTextBox.Focus(); } }
/// <summary> /// 絵文字アイコン - MouseClick /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pictureEmojiGroupX_MouseClick(object sender, MouseEventArgs e) { PictureBox pictureEmojiGroupX = (PictureBox)sender; string tag = (string)pictureEmojiGroupX.Tag; if (tag == null || string.Empty == tag) { return; } int emojiGroupNo; if (!int.TryParse(tag, out emojiGroupNo)) { return; } int numEmojiInGroup; if (emojiGroupNo == 0) { numEmojiInGroup = this.maxEmojiHistoryCount; } else { numEmojiInGroup = DataBags.Emojis.NumIconInGroupList[emojiGroupNo - 1]; } int rows = this.GetGroupRows(numEmojiInGroup); int col = e.X / Commons.FRAME_WIDTH; int row = e.Y / Commons.FRAME_HEIGHT; if (0 <= col && col < DataBags.Config.MaxEmojiListCols) { // OK } else { return; } if (0 <= row && row < rows) { // OK } else { return; } List <int> emojiGroupJiscodeMap = this.emojiGroupJiscodeMaps[emojiGroupNo]; int emojiId = this.GetEmojiIdFromColAndRow(col, row); if (emojiId < emojiGroupJiscodeMap.Count) { // OK } else { return; } int jiscode = emojiGroupJiscodeMap[emojiId]; Emoji emoji = null; if (jiscode != 0) { emoji = DataBags.Emojis.GetFromJiscode(jiscode); } if (emoji != null) { // タブ上の絵文字の選択表示を変更する this.ChangeEmojiSelection(emojiGroupNo, emojiId); if (this.PlaybackFocusTextBox != null) { EmojiTextBox emojiTextBox = this.PlaybackFocusTextBox; emojiTextBox.Focus(); emojiTextBox.SelectedText = new string(emoji.Unicode, 1); emojiTextBox.SelectionLength = 0; } // 履歴へ登録する this.RegistEmojiHistory(jiscode); } this.PlaybackFocus(); }