public AnimeGifFrame InsertFromFile(int index, string path, float delay = 1) {
     var newItem = new AnimeGifFrame(path, delay);
     newItem.PrepareThumbnail();
     newItem.IndexProbider = this;
     if (FrameIndexExist(index)) {
         _listBox.Items.Insert(index, newItem);
     }
     else {
         _listBox.Items.Add(newItem);
     }
     return newItem;
 }
Esempio n. 2
0
        /// <summary>テキストの設定</summary>
        private void setFrameText(AnimeGifFrame targetFrame, string text) {
            if (targetFrame.CaptionText == text) return;

            bool found = false;
            string replaceSrcText = string.Empty;
            foreach(var frame in _frameList.Items) {
                if (!found) {
                    if (frame == targetFrame) {
                        replaceSrcText = frame.CaptionText;
                        frame.CaptionText = text;
                        found = true;
                    }
                }
                else {
                    if (frame.CaptionText == replaceSrcText) {
                        frame.CaptionText = text;
                    }
                    else {
                        break;
                    }
                }
            }
            frameListBox.Invalidate();
        }
Esempio n. 3
0
        private void DeleteButton_Click(object sender, EventArgs e) {
            var count = frameListBox.SelectedItems.Count;
            if (count <= 0) return;

            // 確認
            var answer = MessageBox.Show(
                count + " 個のフレームを削除します。", Application.ProductName, 
                MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);

            if (answer == DialogResult.OK) {
                // 削除
                var frameArray = new AnimeGifFrame[frameListBox.SelectedItems.Count];
                frameListBox.SelectedItems.CopyTo(frameArray, 0);
                foreach (var frame in frameArray) {
                    frameListBox.Items.Remove(frame);
                }
            }
        }
 public int IndexOf (AnimeGifFrame item) {
     return _listBox.Items.IndexOf(item);
 }