Exemple #1
0
        /// <summary>
        /// 履歴の1つ前の写真を表示する。
        /// </summary>
        public void Back()
        {
            try
            {
                // 閲覧履歴のインデックスを1つ前に戻す
                if (--historyIndex == -1)
                {
                    historyIndex = PhotoChat.HistorySize - 1;
                }
                form.RightButtonEnabled = true;

                // 履歴の先頭まで戻ったときは戻るボタン無効
                if (historyIndex == historyFrom)
                {
                    form.LeftButtonEnabled = false;
                }

                // 写真表示
                historyJumpFlag = true;
                form.ShowPhoto(historyList[historyIndex]);
            }
            catch (Exception e)
            {
                PhotoChat.WriteErrorLog(e.ToString());
            }
        }
        private void photoListBox_MouseUp(object sender, MouseEventArgs e)
        {
            try
            {
                // ドラッグが開始されていなければ写真選択
                if (mouseDownPoint != Point.Empty)
                {
                    // 選択中の写真をクリックしたのであれば写真表示
                    if (photoListBox.IndexFromPoint(mouseDownPoint) == selectedIndex)
                    {
                        form.ShowPhoto(((Thumbnail)photoListBox.SelectedItem).PhotoName);
                    }
                    else
                    {
                        // 選択されたサムネイルの画像と表示位置を取得
                        selectedIndex = photoListBox.IndexFromPoint(mouseDownPoint);
                        string photoName = ((Thumbnail)photoListBox.SelectedItem).PhotoName;
                        selectedImage = Thumbnail.GetImage(
                            photoName, PhotoChat.ThumbnailWidth, PhotoChat.ThumbnailHeight);
                        Rectangle rect = photoListBox.GetItemRectangle(photoListBox.SelectedIndex);
                        selectedPoint = new Point(rect.Right, rect.Top);
                        photoListBox.Refresh();
                    }
                }

                // リセット
                mouseDownPoint = Point.Empty;
            }
            catch (Exception ex)
            {
                PhotoChat.WriteErrorLog(ex.ToString());
            }
        }