/// <summary> /// 絵文字一覧のタブ用のイメージに現在の選択マークを表示/非表示する /// </summary> /// <param name="selected">選択する場合 true、解除の場合 false</param> /// <param name="emojiGroupNo">絵文字グループ番号</param> private void DrawSelectedEmojiFrame(bool selected, int emojiGroupNo) { int emojiIdCurrent = this.currentEmojiIds[emojiGroupNo]; if (emojiIdCurrent < 0) { return; } (int col, int row) = this.GetColAndRowFromEmojiId(emojiIdCurrent); Image image = this.emojiGroupImages[emojiGroupNo]; using (Graphics graphics = Graphics.FromImage(image)) { DrawUtils.DrawFrame(selected, col, row, graphics); } }
/// <summary> /// 絵文字一覧の履歴を描画する /// </summary> private void RedrawEmojiListHistory() { List <int> emojiGroupJiscodeMapHistory = this.emojiGroupJiscodeMaps[0]; Image emojiGroupHistoryImage = this.emojiGroupImages[0]; using (Graphics graphics = Graphics.FromImage(emojiGroupHistoryImage)) { graphics.FillRectangle(Brushes.White, 0, 0, this.emojiHistoryMaxWidth, this.emojiHistoryMaxHeight); for (int emojiId = 0; emojiId < emojiGroupJiscodeMapHistory.Count; ++emojiId) { int jiscode = emojiGroupJiscodeMapHistory[emojiId]; Emoji emoji = DataBags.Emojis.GetFromJiscode(jiscode); if (emoji == null) { continue; } (int col, int row) = this.GetColAndRowFromEmojiId(emojiId); DrawUtils.DrawImage(emoji.Image, col, row, graphics); } } this.pictureEmojiGroup0.Image = emojiGroupHistoryImage; }
/// <summary> /// 絵文字一覧に絵文字アイコンと対応する文字コードをロードする /// </summary> private void LoadEmojiList() { // // 絵文字アイコン(履歴) // { List <int> emojiGroupJiscodeMapHistory = DataBags.Config.GetEmojiHistory(); int emojiHistoryCount = emojiGroupJiscodeMapHistory.Count; emojiGroupJiscodeMapHistory.AddRange(new int[this.maxEmojiHistoryCount]); emojiGroupJiscodeMapHistory.RemoveRange(this.maxEmojiHistoryCount, emojiHistoryCount); this.emojiGroupJiscodeMaps.Add(emojiGroupJiscodeMapHistory); } { Image emojiGroupHistoryImage = new Bitmap(this.emojiHistoryMaxWidth, this.emojiHistoryMaxHeight); using (Graphics graphics = Graphics.FromImage(emojiGroupHistoryImage)) { graphics.FillRectangle(Brushes.White, 0, 0, this.emojiHistoryMaxWidth, this.emojiHistoryMaxHeight); } this.emojiGroupImages.Add(emojiGroupHistoryImage); } this.currentEmojiIds.Add(-1); // インデックス 0 は履歴用で未使用 // // 絵文字アイコン // for (int emojiGroupNo = 1; emojiGroupNo <= DataBags.Emojis.NumIconInGroupList.Length; ++emojiGroupNo) { int numEmojiInGroup = DataBags.Emojis.NumIconInGroupList[emojiGroupNo - 1]; int rows = this.GetGroupRows(numEmojiInGroup); int maxWidth = Commons.FRAME_WIDTH * DataBags.Config.MaxEmojiListCols; int maxHeight = Commons.FRAME_HEIGHT * rows; List <int> emojiGroupJiscodeMap = new List <int>(); emojiGroupJiscodeMap.AddRange(new int[numEmojiInGroup]); // 個数分作成する。初期値は 0 Image emojiGroupImage = new Bitmap(maxWidth, maxHeight); using (Graphics graphics = Graphics.FromImage(emojiGroupImage)) { graphics.FillRectangle(Brushes.White, 0, 0, maxWidth, maxHeight); // 絵文字ID: グループ内でのID int firstEmojiId = -1; // 有効な最初の絵文字ID for (int emojiId = 0; emojiId < numEmojiInGroup; ++emojiId) { Emoji emoji = DataBags.Emojis.Get(emojiGroupNo, emojiId); if (emoji == null) { continue; } emojiGroupJiscodeMap[emojiId] = emoji.Jiscode; (int col, int row) = this.GetColAndRowFromEmojiId(emojiId); DrawUtils.DrawImage(emoji.Image, col, row, graphics); if (firstEmojiId == -1) { firstEmojiId = emojiId; } } this.currentEmojiIds.Add(firstEmojiId); } this.emojiGroupImages.Add(emojiGroupImage); this.emojiGroupJiscodeMaps.Add(emojiGroupJiscodeMap); } }