/// <summary> /// メニュー - 編集設定 - Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void menuEditSettings_Click(object sender, EventArgs e) { EditSettingsForm dialog = new EditSettingsForm(); EditSettingsFormResult dr = dialog.ShowDialog(this); if (dr == EditSettingsFormResult.Cancel) { return; } else if (dr == EditSettingsFormResult.Ok) { this.textBoxMailBody.ColumnLine = DataBags.Config.MaxBodyCols; this.textBoxMailBody.Invalidate(); // 絵文字一覧を初期設定する this.emojiList.InitializeEmojiList(); this.emojiList.ShowFirstGroupFirstEmoji(); if (this.lastActiveEmojiTextBox == null) { this.lastActiveEmojiTextBox = this.textBoxMailBody; } this.emojiList.PlaybackFocusTextBox = this.lastActiveEmojiTextBox; this.lastActiveEmojiTextBox.Focus(); } }
/// <summary> /// サムネイル画像を作成する /// </summary> /// <returns>Image</returns> private Image CreateThumbnail(List <string> textList) { int width = Commons.FRAME_WIDTH * Commons.TEMPLATE_THUMBNAIL_COLS; int height = Commons.FRAME_HEIGHT * Commons.TEMPLATE_THUMBNAIL_ROWS; Bitmap image = new Bitmap(width, height); using (Graphics graphics = Graphics.FromImage(image)) { graphics.FillRectangle(Brushes.White, 0, 0, width, height); } EmojiTextBox textBox = new EmojiTextBox(); textBox.Font = new Font(Commons.CONTENTS_FONT_NAME, Commons.CONTENTS_FONT_SIZE); textBox.BorderStyle = BorderStyle.None; textBox.Multiline = true; textBox.Width = width; textBox.Height = height; textBox.Text = string.Join("\r\n", textList); textBox.DrawToBitmap(image, new Rectangle(0, 0, textBox.Width, textBox.Height)); return(image); }
/// <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> /// 絵文字対応の TextBox - Enter /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EmojiTextBox_Enter(object sender, EventArgs e) { this.emojiList.PlaybackFocusTextBox = sender as EmojiTextBox; this.lastActiveEmojiTextBox = sender as EmojiTextBox; }
/// <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(); }