示例#1
0
文件: Form1.cs 项目: cjr3/PhotoViewer
        /// <summary>
        /// Displays the object's image on the preview, over the list.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="ea"></param>
        public void ShowPreviewPicture(object sender, EventArgs ea)
        {
            //Console.WriteLine(sender.GetType());
            //Console.WriteLine(typeof(PictureBox));
            if (sender.GetType() == typeof(PictureBox))
            {
                PictureBox box = (PictureBox)sender;
                //if(box.Image != null && box.Image != bmpBlank)
                {
                    //Console.WriteLine("OK...");
                    //if(this.picView.Image != null)
                    //    this.picView.Image.Dispose();
                    //this.picView.ImageLocation = box.ImageLocation;
                }

                //setup preview window
                if (this.PhotoPreview == null || this.PhotoPreview.IsDisposed)
                {
                    this.PhotoPreview = new PhotoDisplay();
                }
                this.PhotoPreview.StartPosition   = FormStartPosition.CenterScreen;
                this.PhotoPreview.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                this.PhotoPreview.Show();
                this.PhotoPreview.Focus();
                this.PhotoPreview.Disposed += this.PreviewPictureEvents;
                this.PhotoPreview.SetPhoto((Bitmap)box.Image.Clone());
                this.Enabled = false;
            }
        }
示例#2
0
文件: Form1.cs 项目: cjr3/PhotoViewer
        /// <summary>
        /// Initializes the gallery view form.
        /// </summary>
        private void initGallery()
        {
            if (this.GalleryDisplay == null || this.GalleryDisplay.IsDisposed)
            {
                this.GalleryDisplay                 = new PhotoDisplay();
                this.GalleryDisplay.FormClosed     += GalleryActions;
                this.GalleryDisplay.Activated      += GalleryActions;
                this.GalleryDisplay.Disposed       += GalleryActions;
                this.GalleryDisplay.VisibleChanged += GalleryActions;


                AxWMPLib.AxWindowsMediaPlayer player = this.GalleryDisplay.getPlayer();
                player.PlayStateChange += this.GalleryVideoActions;
            }

            int index = this.cbMonitors.SelectedIndex;
            int x     = 0;
            int y     = 0;
            int w     = 0;
            int h     = 0;

            if (Screen.AllScreens.Length <= 1)
            {
                w = Screen.AllScreens[0].Bounds.Width;
                h = Screen.AllScreens[0].Bounds.Height;
            }
            else if (Screen.AllScreens[index] != null)
            {
                w = Screen.AllScreens[index].Bounds.Width;
                h = Screen.AllScreens[index].Bounds.Height;
                x = Screen.AllScreens[index].Bounds.X;
                y = Screen.AllScreens[index].Bounds.Y;
            }

            this.GalleryDisplay.SetBounds(x, y, w, h);
            this.GalleryDisplay.WindowState     = FormWindowState.Maximized;
            this.GalleryDisplay.FormBorderStyle = FormBorderStyle.None;
            this.GalleryDisplay.ResizePane();
            if (this.strCurrentPicture != null)
            {
                this.GalleryDisplay.SetPhoto(this.strCurrentPicture);
            }
        }