Exemplo n.º 1
0
 /// <summary>
 /// Initialisiert das Spiel.
 /// </summary>
 public virtual void Initialize()
 {
     screen.Focus();
     screen.SizeMode    = PictureBoxSizeMode.StretchImage;
     screen.MouseMove  += new MouseEventHandler(OnMouseMove);
     screen.MouseDown  += new MouseEventHandler(OnMouseButtonDown);
     screen.MouseUp    += new MouseEventHandler(OnMouseButtonUp);
     screen.MouseWheel += new MouseEventHandler(OnMouseWheel);
     form.KeyDown      += new KeyEventHandler(KeyDown);
     form.KeyUp        += new KeyEventHandler(KeyUp);
     gameTimer          = new Timer();
     gameTimer.Interval = 100 / 30;
     gameTimer.Tick    += new EventHandler(OnTimerTick);
     gameTime.Start();
     gameTimer.Start();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Make sure that the PicBox have the focus, otherwise it doesnґt receive
 /// mousewheel events !.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PicBox_MouseEnter(object sender, EventArgs e)
 {
     if (PicBox.Focused == false)
     {
         PicBox.Focus();
     }
 }
Exemplo n.º 3
0
        private void About()
        {
            MenuVisiable(false);
            Label DLab = new Label();

            DLab.AutoSize  = true;
            DLab.Font      = new Font("Microsoft Sans Serif", 15.75F, ((FontStyle)((FontStyle.Bold | FontStyle.Italic))), GraphicsUnit.Point, ((byte)(204)));
            DLab.ForeColor = Color.Lime;
            DLab.Location  = new Point(20, 50);
            FileStream   strim = new FileStream(@"Source\Description.desc", FileMode.Open, FileAccess.Read);
            StreamReader sr    = new StreamReader(strim);

            DLab.Text = sr.ReadToEnd();
            sr.Close();
            strim.Close();
            descriptionpan           = new PictureBox();
            descriptionpan.BackColor = Color.Transparent;
            descriptionpan.Image     = Properties.Resources.Description;
            descriptionpan.SizeMode  = PictureBoxSizeMode.StretchImage;
            descriptionpan.Location  = new Point(30, 30);
            descriptionpan.Size      = new Size(580, 420);
            descriptionpan.Controls.Add(DLab);
            descriptionpan.PreviewKeyDown += new PreviewKeyDownEventHandler(DescKeyPress);
            this.Controls.Add(descriptionpan);
            descriptionpan.Focus();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Aqui es donde pinto la imagen con el zoom
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pic_Zoom(object sender, MouseEventArgs e)
        {
            this.Cursor = Cursors.Cross;

            PictureBox pic = (PictureBox)sender;

            if (pic.Image != null)
            {
                double dAumento = (double)tbarZoom.Value / (double)AumentoZoom;

                int zoomAncho = Convert.ToInt16(pbZoom.Width / dAumento);
                //(Math.Pow(AumentoZoom,
                //(double) (tbarZoom.Value - 1) / (double) (tbarZoom.SmallChange))));
                int zoomAlto = Convert.ToInt16(pbZoom.Height / dAumento);
                //(Math.Pow(AumentoZoom,
                //(double) (tbarZoom.Value - 1) / (double) (tbarZoom.SmallChange))));

                lblZoom.Text = dAumento + "X";

                Point cursor = xy_projection(pic.Image, pic, e.X, e.Y);

                Bitmap tmpBitMap = new Bitmap(pbZoom.Width, pbZoom.Height);

                Graphics gr = Graphics.FromImage(tmpBitMap);

                gr.Clear(Color.Transparent);
                gr.InterpolationMode = InterpolationMode.HighQualityBicubic;

                gr.DrawImage(pic.Image,
                             new Rectangle(0, 0, pbZoom.Width, pbZoom.Height),
                             new Rectangle(
                                 cursor.X - (zoomAncho / 2),
                                 cursor.Y - (zoomAlto / 2),
                                 zoomAncho,
                                 zoomAlto),
                             GraphicsUnit.Pixel);

                int ptoMedioAlto  = pbZoom.Height / 2;
                int ptoMedioAncho = pbZoom.Width / 2;

                gr.DrawLine(Pens.Black,
                            new Point(ptoMedioAncho - 10, ptoMedioAlto),
                            new Point(ptoMedioAncho + 10, ptoMedioAlto));

                gr.DrawLine(Pens.Black,
                            new Point(ptoMedioAncho, ptoMedioAlto - 10),
                            new Point(ptoMedioAncho, ptoMedioAlto + 10));

                pbZoom.Image = tmpBitMap;

                gr.Dispose();



                if (!pic.Focused)
                {
                    pic.Focus();
                }
            }
        }
Exemplo n.º 5
0
        private void SelectCard()
        {
            pctrBxCard.Enabled    = true;
            pctrBxCard.ClientSize = selectedSize;

            pctrBxCard.BackColor = Color.Yellow;

            // setting the padding to five makes the card look
            // like it is outlined in the  background color
            pctrBxPadding     = new Padding();
            pctrBxPadding.All = SELECTION_LINE_THICKNESS;

            pctrBxCard.Padding = pctrBxPadding;

            // relocate the card
            //Point pctrBxPointS = new Point();

            pctrBxPoint.X = pctrBxCard.Location.X - SELECTION_LINE_THICKNESS;
            pctrBxPoint.Y = pctrBxCard.Location.Y - SELECTION_LINE_THICKNESS;

            pctrBxCard.Location = pctrBxPoint;

            pctrBxCard.Focus();

            _selected = true;
        }
Exemplo n.º 6
0
        private void StartGame_Click(object sender, EventArgs e)
        {
            Car.Focus();
            timer2.Tick += new EventHandler(Down);

            timer2.Start();
        }
Exemplo n.º 7
0
        private void CheckedListBoxMaps_SelectedIndexChanged(object sender, EventArgs e) //obsluga eventu podczas zmiany zaznaczonej warstwy na liscie
        {
            // jezeli zaznaczamy warstwe to wlaczamy przyciski i suwak do przezroczystosci
            var selected = CheckedListBoxMaps.SelectedIndex;

            OpacityScrollBar.Enabled = true;
            ButtonUp.Enabled         = true;
            ButtonDown.Enabled       = true;
            OpacityLabel.Show();
            if (selected >= 0)
            {
                //obsluga layeru z wartoscia przezroczystosci
                OpacityScrollBar.Value = (int)(mapLayersInfo[selected].GetOpacity() * 100);
                OpacityLabel.Text      = $"Opacity: {OpacityScrollBar.Value}%";
                mapLayers.Focus(); //ustawienie koncetracji na warstwach
            }
        }
Exemplo n.º 8
0
        private void ConnectButton_Click(object sender, EventArgs e)
        {
            //check if client is connected
            if (client == null)
            {
                //create picturebox to receive remote screen
                PictureBox picture = new PictureBox();
                picture.Anchor   = ImageHolderPanel.Anchor;
                picture.Size     = ImageHolderPanel.Size;
                picture.SizeMode = PictureBoxSizeMode.StretchImage;

                //add input handlers
                picture.MouseDown  += HandleScreenClick;
                picture.MouseUp    += HandleScreenUnclick;
                picture.MouseMove  += HandleScreenMove;
                picture.MouseEnter += delegate { if (MouseInputBox.Checked)
                                                 {
                                                     Cursor.Hide();
                                                 }
                };
                picture.MouseLeave += delegate { Cursor.Show(); };

                //add picturebox to panel
                ImageHolderPanel.Controls.Clear();
                ImageHolderPanel.Controls.Add(picture);
                picture.Focus();

                try
                {
                    //create client and connect
                    client = new ScreenShareClient(picture);
                    client.Connect(IPAddress.Parse(IPBox.Text));
                } catch (Exception ex)
                {
                    //show error on screen and remove picture box
                    MessageBox.Show("Cannot connect: " + ex.Message);
                    client = null;
                    ImageHolderPanel.Controls.Clear();
                    return;
                }
                //add disconnect handler
                client.ClientDisconnected += HandleDisconnected;
                ConnectButton.Text         = "Disconnect";
                IPBox.Enabled              = false;
                ShareScreenButton.Enabled  = false;
            }
            else
            {
                //close connection
                client.Close();
                client = null;
                //remove picture and change connect button
                ImageHolderPanel.Controls.Clear();
                ConnectButton.Text        = "Connect";
                IPBox.Enabled             = true;
                ShareScreenButton.Enabled = true;
            }
        }
Exemplo n.º 9
0
        public void MouseDown(Object sender, System.Windows.Forms.MouseEventArgs e)
        {
            //m_PictureBox.Parent.Select();
            m_PictureBox.Focus();

            bool flag = false; //是否有點到物件的標記

            if (m_SelectedItem == null)
            {
                foreach (IDrawItem item in m_IDrawItemList)
                {
                    if (item.IsContains(e.Location))
                    {
                        m_SelectedItem = item;
                        m_SelectedItem.IsControlPointVisible = true;
                        flag = true;
                        break;
                    }
                }
            }
            else
            {
                //有選取物件

                foreach (IDrawItem item in m_IDrawItemList)
                {
                    if (item.Equals(m_SelectedItem) == false && item.IsContains(e.Location))
                    {
                        m_SelectedItem.IsControlPointVisible = false;
                        m_SelectedItem = item;
                        m_SelectedItem.IsControlPointVisible = true;
                        flag = true;
                        break;
                    }
                    else if (item.Equals(m_SelectedItem) == true && item.IsCtlContains(e.Location))
                    {
                        //控制點
                        if (item.SetCurrentCtl(e.Location) == true)
                        {
                            IsCtlPoint = true;
                            //oldPrePoint = e.Location;   //記錄物體坐標
                            oldPoint = e.Location;
                            flag     = true;
                            break;
                        }
                    }
                }
            }

            if (flag == false && m_SelectedItem != null)
            {
                m_SelectedItem.IsControlPointVisible = false;
                m_SelectedItem = null;
            }

            ((PictureBox)sender).Refresh();
        }
Exemplo n.º 10
0
 /// <summary>
 /// 鼠标中键
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PictureBox_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Middle)
     {      //如果中键点下    初始化计算要用的临时数据
         m_ptMouseDown = e.Location;
         m_ptCanvasBuf = m_ptCanvas;
     }
     PictureBox.Focus();
 }
Exemplo n.º 11
0
        private void frame_MouseDown(object sender, MouseEventArgs e)
        {
            if (PlaybackSequence.IsBusy)
            {
                return;
            }
            PictureBox frame = (PictureBox)sender;

            frame.Focus();
            index = (int)frame.Tag;
        }
Exemplo n.º 12
0
        //Image Required Validation

        private bool IsImageNull(PictureBox box, bool ok, int tabIndex)
        {
            if (box.Image == null)
            {
                ok = false;
                box.Focus();
                tabControl1.SelectedIndex = tabIndex;
                errorProvider1.SetError(box, "Please select an Image");
            }
            return(ok);
        }
Exemplo n.º 13
0
 //Метод активации картинки pictBox
 private void setActive(PictureBox pictBox)
 {
     if (activePBox != null)
     {
         activePBox.BorderStyle = BorderStyle.None;
     }
     activePBox             = pictBox;
     activePBox.BorderStyle = BorderStyle.FixedSingle;
     activePBox.Tag         = activePBox.Location.X + "," + activePBox.Location.Y;
     drawXY(activePBox);
     activePBox.Focus();
 }
Exemplo n.º 14
0
        private void pictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            PictureBox pictureBox = sender as PictureBox;

            if (e.Button == MouseButtons.Left)
            {
                mouseDownPoint.X = Cursor.Position.X; //记录鼠标左键按下时位置
                mouseDownPoint.Y = Cursor.Position.Y;
                isMove           = true;
                pictureBox.Focus(); //鼠标滚轮事件(缩放时)需要picturebox有焦点
            }
        }
Exemplo n.º 15
0
        //외부함수
        public void Render()
        {
            if (attachedLayer != null && !attachedLayer.isPeriodPressed)
            {
                SuspendLayout();

                Visible = true;

                textBoxBG.Visible = isEditing;
                int   textWidth = attachedLayer.mainText.Width;
                Point layerPos  = new Point(Layer.LeftPadding, (int)(attachedLayer.IndexY * Layer.Height) + MainForm.instance.layerArea.Location.Y);
                BackColor = attachedLayer.BGColor;

                if (isEditing)
                {
                    Location = new Point(
                        layerPos.X + attachedLayer.LeftSpace + Layer.textPadding,
                        layerPos.Y + (int)((Layer.Height - textBoxBG.Height) * 0.5f));
                    int textBoxBGWidth = 0;
                    if (attachedLayer.mainText.Width > MaxWidth)
                    {
                        textBoxBGWidth = textWidth;
                    }
                    else
                    {
                        textBoxBGWidth = Math.Min(MaxWidth, attachedLayer.mainText.maxWidth);
                    }
                    textBoxBG.SetWidth(textBoxBGWidth);
                    textBox.Size = new Size(textBoxBG.Width - 10, Height);
                    textBox.Text = attachedLayer.mainText.Text;
                    textBox.Select(textBox.Text.Length, 0);
                    renameBtn.Location = new Point(textBoxBG.Width, 0);
                    Size = new Size(renameBtn.Location.X + renameBtn.Width, Height);
                    textBox.Focus();
                }
                else
                {
                    Location = new Point(
                        layerPos.X + attachedLayer.LeftSpace + Layer.textPadding + textWidth,
                        layerPos.Y + (int)((Layer.Height - textBoxBG.Height) * 0.5f));
                    renameBtn.Location = new Point(0, 0);
                    Size = new Size(renameBtn.Width, Height);
                    renameBtn.Focus();
                }
                ResumeLayout();
                Refresh();
            }
            else
            {
                Visible = false;
            }
        }
Exemplo n.º 16
0
        private void pictureBoxStart_Click(object sender, EventArgs e)
        {
            pbEroe.Focus();
            pbEroe.PreviewKeyDown += OnPreviewKeyDown;
            pbEroe.KeyDown        += OnKeyDown;

            lblSpiegazione.Visible = false;
            lblControl.Visible     = true;
            lblControl.Text        = "FORZA INSUFFICIENTE !";
            lblControl.ForeColor   = Color.DarkRed;
            timer1.Start();
            timer1.Interval = 300;
        }
Exemplo n.º 17
0
 public static void ValidirajPictureBox(CancelEventArgs e, ErrorProvider errorProvider, PictureBox pictureBox, string message)
 {
     if (pictureBox.Image == null)
     {
         e.Cancel = true;
         pictureBox.Focus();
         errorProvider.SetError(pictureBox, message);
     }
     else
     {
         e.Cancel = false;
         errorProvider.SetError(pictureBox, null);
     }
 }
Exemplo n.º 18
0
 public void loadGameControlls()
 {
     this.lobbyForm.Controls.Add(canvas);
     this.lobbyForm.Controls.Add(stoperica);
     this.lobbyForm.Controls.Add(scoreLabel);
     this.lobbyForm.Controls.Add(ukupniPoeni);
     this.lobbyForm.Controls.Add(ammoLabel);
     stoperica.BringToFront();
     scoreLabel.BringToFront();
     ukupniPoeni.BringToFront();
     ammoLabel.BringToFront();
     canvas.BringToFront();
     canvas.Focus();
 }
Exemplo n.º 19
0
        public void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                mCameraInputActive = true;

                //Activate Camera input
                Cursor.Hide();

                //center the cursor
                PictureBox pictureBox = sender as PictureBox;
                centerCursor(pictureBox);

                //allows us to receive mouse wheel events
                pictureBox.Focus();
            }
        }
Exemplo n.º 20
0
 public static bool IsImagePresent(Control control)
 {
     if (control.GetType().ToString() == "System.Windows.Forms.PictureBox")
     {
         PictureBox pictureBox = (PictureBox)control;
         if (pictureBox.Image == null)
         {
             errProvider.SetError(pictureBox, pictureBox.Tag + @" is a required.");
             pictureBox.Focus();
             return(false);
         }
         else
         {
             return(true);
         }
     }
     return(true);
 }
 public static bool IsImagePresent(Control control)
 {
     if (control.GetType().ToString() == "System.Windows.Forms.PictureBox")
     {
         PictureBox pictureBox = (PictureBox)control;
         if (pictureBox.Image == null)
         {
             MessageBox.Show(pictureBox.Tag.ToString() + " is a required.", Title);
             pictureBox.Focus();
             return(false);
         }
         else
         {
             return(true);
         }
     }
     return(true);
 }
Exemplo n.º 22
0
        private void pictureBox_MouseMove(object sender, MouseEventArgs e)
        {
            PictureBox pictureBox = sender as PictureBox;

            pictureBox.Focus(); //鼠标在picturebox上时才有焦点,此时可以缩放
            if (isMove)
            {
                int x, y;         //新的pictureBox.Location(x,y)
                int moveX, moveY; //X方向,Y方向移动大小。
                moveX = Cursor.Position.X - mouseDownPoint.X;
                moveY = Cursor.Position.Y - mouseDownPoint.Y;
                x     = pictureBox.Location.X + moveX;
                y     = pictureBox.Location.Y + moveY;
                pictureBox.Location = new Point(x, y);
                mouseDownPoint.X    = Cursor.Position.X;
                mouseDownPoint.Y    = Cursor.Position.Y;
            }
        }
Exemplo n.º 23
0
 private void PictureBox_MouseHover(object sender, EventArgs e)
 {
     try
     {
         PictureBox pic = (PictureBox)sender;
         pic.Focus();
     }
     catch (EException exc)
     {
         StackFrame[] stackFrames = new StackTrace(true).GetFrames();
         clsLogFile.LogTryCatch(stackFrames, exc.Message, true, true);
     }
     catch (Exception ex)
     {
         StackFrame[] stackFrames = new StackTrace(true).GetFrames();
         clsLogFile.LogTryCatch(stackFrames, ex.Message, true, true);
     }
 }
Exemplo n.º 24
0
        private void frame_Paint(object sender, PaintEventArgs e)
        {
            PictureBox frame = (PictureBox)sender;

            if ((int)frame.Tag >= sequenceImages.Count)
            {
                return;
            }
            if (molds.ShowBG)
            {
                e.Graphics.Clear(Color.FromArgb(animation.PaletteSet.Palette[0]));
            }
            Rectangle dst = new Rectangle(0, 0, frame.Width, frame.Height);
            Rectangle src = new Rectangle(0, 0, width, height);

            e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bicubic;
            e.Graphics.DrawImage(sequenceImages[(int)frame.Tag], dst, src, GraphicsUnit.Pixel);
            //
            if (sequence.Frames[(int)frame.Tag].Mold >= animation.Molds.Count)
            {
                Font  font  = new Font("Tahoma", 10F, FontStyle.Bold);
                SizeF size  = e.Graphics.MeasureString("(INVALID MOLD INDEX)", font, new PointF(0, 0), StringFormat.GenericDefault);
                Point point = new Point((frame.Width - (int)size.Width) / 2, (frame.Height - (int)size.Height) / 2);
                Do.DrawString(e.Graphics, point, "(INVALID MOLD INDEX)", Color.Black, Color.Red, font);
            }
            if (index == (int)frame.Tag)
            {
                e.Graphics.DrawRectangle(
                    new Pen(new SolidBrush(Color.Red)),
                    new Rectangle(0, 0, frame.Width - 1, frame.Height - 1));
                if (!molds.Picture.Focused)
                {
                    frame.Focus();
                }
            }
            else
            {
                e.Graphics.DrawRectangle(
                    new Pen(new SolidBrush(SystemColors.ControlDark)),
                    new Rectangle(0, 0, frame.Width - 1, frame.Height - 1));
            }
        }
Exemplo n.º 25
0
        private void frame_Paint(object sender, PaintEventArgs e)
        {
            if (sequence.Frames.Count == 0)
            {
                return;
            }
            e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bicubic;
            PictureBox frame = sender as PictureBox;
            int        index = (int)frame.Tag;

            if (molds.ShowBG)
            {
                e.Graphics.Clear(Color.FromArgb(palette[0]));
            }
            if (index < sequence.Frames.Count && sequence.Frames[index].Mold < animation.Molds.Count)
            {
                if (index < sequenceImages.Count)
                {
                    e.Graphics.DrawImage(sequenceImages[index], -bounds.X, -bounds.Y, 256, 256);
                }
            }
            else
            {
                e.Graphics.DrawImage(global::LazyShell.Properties.Resources.warning, 2, 2);
            }
            if (this.indexes.Contains(index))
            {
                e.Graphics.DrawRectangle(
                    new Pen(new SolidBrush(Color.Red)),
                    new Rectangle(0, 0, bounds.Width - 1, bounds.Height - 1));
                if (!molds.Picture.Focused)
                {
                    frame.Focus();
                }
            }
            else
            {
                e.Graphics.DrawRectangle(
                    new Pen(new SolidBrush(SystemColors.ControlDark)),
                    new Rectangle(0, 0, bounds.Width - 1, bounds.Height - 1));
            }
        }
Exemplo n.º 26
0
        private void fScheme_MouseDown(object sender, MouseEventArgs e)
        {
            pOld = this.panel1.PointToClient(Cursor.Position);
            if (isAddingElement)
            {
                return;
            }
            if (mType == 2)//adding element
            {
                if (Z119.ATK.Common.Const.IsWaitForLRLocation)
                {
                    Z119.ATK.Common.Const.IsWaitForLRLocation = false;
                    foreach (schemePoint p in Z119.ATK.Common.Const.schemePointList)
                    {
                        if (p.Selected)
                        {
                            p.setPosLR(toSchemePos(pOld));//
                        }
                    }
                }
            }
            pictureBox1.ContextMenu = cmNoselect;
            if ((e.Button == System.Windows.Forms.MouseButtons.Right))
            {
                if (CheckPointSelection(pOld))
                {
                    pictureBox1.ContextMenu = cmSelectPoint;
                }
                else if (CheckElementSelection(pOld))
                {
                    pictureBox1.ContextMenu = cmSelectEle;
                }
            }


            _mousePressed = true;
            pictureBox1.Focus();

            this.Refresh();
        }
Exemplo n.º 27
0
        public BPVPlugin(Form f, PictureBox p)
        {
            //Stores arguments
            this.f = f;
            this.p = p;

            //Sets focus to picturebox
            p.Focus();

            //Gets Photo directory
            var photo = new FileInfo(Environment.GetCommandLineArgs()[1]).Directory.FullName;
            var dir   = new DirectoryInfo(photo);

            //Gets all pictures in directory
            pdir = new List <string>();

            foreach (FileInfo fi in dir.GetFiles("*"))
            {
                var nSP = fi.Name.Split('.');
                if ("png jpg gif jpeg wmf bmp".Contains(nSP[nSP.Length - 1]))
                {
                    Console.WriteLine("DIRFILE: " + fi.DirectoryName + "\\" + fi.Name);
                    pdir.Add(fi.DirectoryName + "\\" + fi.Name);
                }
            }

            //Finds active file
            for (int i = 0; i < pdir.Count; i++)
            {
                if (pdir[i] == photo)
                {
                    activeFile = i;
                }
            }

            //Adds methods for keyboard handling
            f.KeyDown += OnKeyDown;
        }
Exemplo n.º 28
0
        private void frame_MouseDown(object sender, MouseEventArgs e)
        {
            if (PlaybackSequence.IsBusy)
            {
                return;
            }
            PictureBox frame = sender as PictureBox;

            frame.Focus();
            index = (int)frame.Tag;
            if ((Control.ModifierKeys & Keys.Control) == 0) // multi-select if Ctrl pressed
            {
                this.Updating = true;
                listBoxFrames.ClearSelected();
                listBoxFrames.SelectedIndex = index;
                this.Updating = false;
            }
            if (panelFrames.HorizontalScroll.Visible)
            {
                panelFrames.HorizontalScroll.Value = index * (bounds.Width + 4);
            }
            panelFrames.Focus();
        }
Exemplo n.º 29
0
        void PictureBox_MouseDown(Object o, MouseEventArgs e)
        {
            _pictureBox.Focus();

            switch (e.Button)
            {
            case MouseButtons.Left:
                // Text = nameof(MouseButtons.Left); // ※
                if (_bookShelf.MoveNext())
                {
                    Canvas = _bookShelf.Page;

                    if (Text != _bookShelf.BookPath)
                    {
                        Text = _bookShelf.BookPath;
                    }
                }
                break;

            case MouseButtons.Right:
                // Text = nameof(MouseButtons.Right); // ※
                if (_bookShelf.MovePrevious())
                {
                    Canvas = _bookShelf.Page;

                    if (Text != _bookShelf.BookPath)
                    {
                        Text = _bookShelf.BookPath;
                    }
                }
                break;

            default:
                // Text = ""; // ※
                break;
            }
        }
Exemplo n.º 30
0
        private void selected_change()
        {
            foreach (PictureBox pB in panel.Controls.OfType <PictureBox>())
            {
                pB.BackColor = Color.White;
            }

            foreach (Label lbl in panel.Controls.OfType <Label>())
            {
                lbl.ForeColor = Color.White;
                lbl.BackColor = Color.DarkTurquoise;
            }
            PictureBox temppb = panel.Controls["thumbnailBox" + position.ToString()] as PictureBox;
            Label      templb = panel.Controls["thumbnailLabel" + position.ToString()] as Label;

            if (RealSize)
            {
                Image tempImg  = listImg[position].Image();
                Panel pnParent = (picBox.Parent as Panel);
                if (!(pnParent.Height > tempImg.Height && pnParent.Width > tempImg.Width))
                {
                    picBox.Size = tempImg.Size;
                }
                picBox.Image = tempImg;
            }
            else
            {
                picBox.Size  = picBox.Parent.Size;
                picBox.Image = listImg[position].Image(picBox.Size);
            }

            templb.BackColor = Color.LightCoral;
            temppb.BackColor = Color.LightCoral;

            temppb.Focus();
            templb.Focus();
        }