Пример #1
0
        private void Run()
        {
            videoStream.GetFrameOpen();

            for (currentFrameIndex = 0; (currentFrameIndex < videoStream.CountFrames) && isRunning; currentFrameIndex++)
            {
                currentBitmap = videoStream.GetBitmap(currentFrameIndex);
                picDisplay.Invoke(new SimpleDelegate(SetDisplayPicture));
                picDisplay.Invoke(new SimpleDelegate(picDisplay.Refresh));

                if (ctlFrameIndexFeedback != null)
                {
                    ctlFrameIndexFeedback.Invoke(new SimpleDelegate(SetLabelText));
                }

                Thread.Sleep(millisecondsPerFrame);
            }

            videoStream.GetFrameClose();
            isRunning = false;

            if (Stopped != null)
            {
                Stopped(this, EventArgs.Empty);
            }
        }
Пример #2
0
        private void Testing()
        {
            Position = -1;
            SeasonPictureBox.Invoke((MethodInvoker)(delegate { SeasonPictureBox.Visible = true; }));

            for (int i = 0; i < SeasonImages.Length; i++)
            {
                if (TestIsOn == true)
                {
                    Position++;
                    SeasonPictureBox.Invoke((MethodInvoker)(delegate { SeasonPictureBox.Image = SeasonImages[Position]; }));
                    SetSeasonToRecognize();
                }
                else
                {
                    while (true)
                    {
                        if (TestIsOn == true)
                        {
                            break;
                        }
                        Thread.Sleep(1);
                    }
                }
            }

            SeasonPictureBox.Invoke((MethodInvoker)(delegate { SeasonPictureBox.Visible = false; }));

            TestIsOn    = false;
            TestStarted = false;
            TestControlButton.Invoke((MethodInvoker)(delegate { TestControlButton.Text = "Start"; }));
        }
Пример #3
0
        public void paintAll(Graphics graphics)
        {
            try
            {
                _pictureBox.Invoke((MethodInvoker) delegate
                {
                    // Projection.SetX_Limit(_graphList[0].GetFirstPoint().X, _graphList[0].GetLastPoint().X);

                    PaintCommonGraph(graphics);

                    _graphList[0].PaintLines(graphics);
                    _graphList[1].PaintPoints(graphics);
                    _graphList[2].PaintLines(graphics);
                    _graphList[3].PaintLines(graphics);
                    _graphList[4].PaintLines(graphics);
                    _graphList[5].PaintLines(graphics);

                    /*
                     * foreach (Graph graph in _graphList)
                     * {
                     *  graph.PaintLines(graphics);
                     * }
                     */
                    _pictureBox.Invalidate();
                });
            }
            catch { }
        }
Пример #4
0
        private void meteorStart(PictureBox pictureBox)
        {
            int left = this.Width;

            while (true)
            {
                left = pictureBox.Location.X;
                pictureBox.Invoke(new Action(() => {
                    pictureBox.Location = new Point(pictureBox.Location.X - rand.Next(25, 100), pictureBox.Location.Y);
                }));
                Thread.Sleep(rand.Next(200));
                if (left < 0)
                {
                    pictureBox.Invoke(new Action(() => {
                        pictureBox.Location = new Point(pictureBox.Location.X + this.Width, pictureBox.Location.Y);
                    }));
                    count++;
                }
                if (pictureBox.Bounds.IntersectsWith(pictureBox1.Bounds))
                {
                    MessageBox.Show("Вы проиграли. Ваш счет - " + count);
                    this.Close();
                }
            }
        }
Пример #5
0
 void LightChange(PictureBox red, PictureBox green, bool token)
 {
     if (red.InvokeRequired == true && green.InvokeRequired == true)
     {
         if (token)
         {
             red.Invoke(new del(LightOnOff), new object[] { red, false });
             green.Invoke(new del(LightOnOff), new object[] { green, true });
         }
         else
         {
             red.Invoke(new del(LightOnOff), new object[] { red, true });
             green.Invoke(new del(LightOnOff), new object[] { green, false });
         }
     }
     else
     {
         if (token)
         {
             red.Visible   = false;
             green.Visible = true;
         }
         else
         {
             red.Visible   = true;
             green.Visible = false;
         }
     }
 }
Пример #6
0
 public void drawString(string s, double depth, double x, double y)
 {
     if (picBox.InvokeRequired)
     {
         picBox.Invoke(new DrawStringDelegate(drawString), new Object[] { s, depth, x, y }); // вызываем эту же функцию обновления состояния, но уже в UI-потоке
     }
     else
     {
         if (x > picBox.Width)
         {
             picBox.Width = Convert.ToInt16(x);
         }
         else
         if (y > picBox.Height)
         {
             picBox.Height = Convert.ToInt16(y);
         }
         else
         {
             try
             {
                 g.DrawString(s, new Font(form1.logBox.Font.Name, Convert.ToInt16(depth)), Brushes.White, new Point(Convert.ToInt16(Math.Round(x)), Convert.ToInt16(Math.Round(y))));
             }
             catch { }
         }
     }
 }
Пример #7
0
        public void MoverTiro()
        {
            PictureBox _pbTiro = new PictureBox
            {
                Image   = pBTiro.Image,
                Visible = true
            };

            _pbTiro.Visible = true;

            var posicaoTiro = pBNave.Left + 25;
            var alturaTiro  = 320;

            _pbTiro.Location = pBNave.Location;

            this.Invoke(new MethodInvoker(delegate { this.Controls.Add((Control)_pbTiro); }));

            Boolean verifica = true;

            totalTiros += 1;

            while (_pbTiro.Location.Y < 10000)
            {
                _pbTiro.Invoke(new MethodInvoker(delegate { lBTiro.Text = "ToTal De Tiros    " + Convert.ToString(totalTiros); }));

                _pbTiro.Invoke(new MethodInvoker(delegate { _pbTiro.Location = new Point(posicaoTiro, alturaTiro); }));
                alturaTiro -= 20;
                Application.DoEvents();

                System.Threading.Thread.Sleep(50);

                foreach (Button buttao in ListaBotao)
                {
                    var LimiteBt = buttao.Location.X - buttao.Size.Width;
                    var meioTiro = _pbTiro.Location.X - (_pbTiro.Size.Width / 10);

                    if (buttao.Visible)
                    {
                        if (meioTiro > LimiteBt && meioTiro < buttao.Location.X)
                        {
                            if (_pbTiro.Location.Y <= buttao.Location.Y)
                            {
                                buttao.Invoke(new MethodInvoker(delegate { buttao.Visible = false; }));
                                verifica      = false;
                                totalAcertos += 1;
                                lBacerto.Invoke(new MethodInvoker(delegate { lBacerto.Text = "Total De Acertos " + Convert.ToString(totalAcertos); }));
                                break;
                            }
                        }
                    }
                }

                if (!verifica)
                {
                    break;
                }
            }
            _pbTiro.Invoke(new MethodInvoker(delegate { _pbTiro.Dispose(); }));
        }
Пример #8
0
        void draw_START()
        {
            time_of_start = total_time;

            stringDelegate = new AutoMiner.StringDelegate(log);
            richTextBox1.Invoke(stringDelegate, DateTime.Now.TimeOfDay.ToString().Substring(0, 8) + "  started", Color.MediumSpringGreen);

            drawDelegate = new AutoMiner.DrawDelegate(drawLine);
            picBox.Invoke(drawDelegate, Color.Black, time_of_stop, 10 + day * 20 + day, total_time, 10 + day * 20 + day);
        }
        internal void Redraw()
        {
            var ret = DrawSegmentationMap(orig, Detections, VisThreshold);

            //var ret = DrawSegmentationMap(net.lastReadedMat, dets, VisThreshold);
            LastMat = ret;
            Pbox.Invoke((Action)(() =>
            {
                Pbox.Image = BitmapConverter.ToBitmap(ret);
            }));
        }
Пример #10
0
 internal void flyBee()
 {
     if (bee.InvokeRequired)
     {
         bee.Invoke(new mueveAbeja(flyBee));
     }
     else
     {
         bee.Location = p;
     }
 }
Пример #11
0
 private void RenderCard(Card card, PictureBox box)
 {
     if (card != null)
     {
         box.Invoke(new MethodInvoker(delegate() { box.ImageLocation = card.Image; }));
     }
     else
     {
         box.Invoke(new MethodInvoker(delegate() { box.ImageLocation = @"CardImages/red_back.png"; }));
     }
 }
Пример #12
0
 public void AsyncAnim()
 {
     Thread.Sleep(100);
     for (int i = 1; i < 5; i++)
     {
         Thread.Sleep(50);
         pic.Invoke(new Action(() => { pic.Image = sprHor[h, i]; }));
     }
     Thread.Sleep(50);
     pic.Invoke(new Action(() => { pic.Image = null; }));
 }
Пример #13
0
 private void ChangerCouleur(Color couleur)
 {
     if (_pb.InvokeRequired)
     {
         MAJColordel a = new MAJColordel(ChangerCouleur);
         _pb.Invoke(a, new object[] { couleur });
     }
     else
     {
         _pb.BackColor = couleur;
     }
 }
Пример #14
0
 private void Wait()
 {
     if (FileUtils.CheckPath())
     {
         try
         {
             File.WriteAllBytes(FileUtils.StaticPath + "\\load.gif", Resources.load);
         }
         catch
         {
         }
     }
     _gif = new FrameGIF(_pathGIF);
     _gif.ReverseAtEnd = false;
     pictureBox1.Invoke((MethodInvoker) delegate
     {
         pictureBox1.Visible = true;
     });
     pictureBox1.Invoke((MethodInvoker) delegate
     {
         pictureBox1.Image = _gif.GetNextFrame();
     });
     while (!Scan.IsFinish)
     {
         Thread.Sleep(10);
     }
     try
     {
         bunifuCustomLabel3.Invoke((MethodInvoker) delegate
         {
             bunifuCustomLabel3.Text = Scan.RateResult;
         });
         if (Scan.RateResult == "0/35")
         {
             bunifuCustomLabel3.ForeColor = Color.ForestGreen;
         }
         else
         {
             bunifuCustomLabel3.ForeColor = Color.Red;
         }
     }
     catch
     {
     }
     pictureBox1.Invoke((MethodInvoker) delegate
     {
         pictureBox1.Visible = false;
     });
     bunifuCustomTextbox1.Invoke((MethodInvoker) delegate
     {
         bunifuCustomTextbox1.Text = Scan.ScanURL;
     });
 }
Пример #15
0
        /****************************************
        *
        *              Delegate
        *
        ****************************************/

        private void ChangerTailleBalle(int x, int y)
        {
            if (_balleConteneur.InvokeRequired)
            {
                MAJIntIntdel a = new MAJIntIntdel(ChangerTailleBalle);
                _balleConteneur.Invoke(a, new object[] { x, y });
            }
            else
            {
                _balleConteneur.Size = new Size(x, y);
            }
        }
Пример #16
0
 private void SetImage(Bitmap img)
 {
     if (screen.InvokeRequired)
     {
         var invoke = new SetImageDelegate(SetImage);
         screen.Invoke(invoke, new object[] { img });
     }
     else
     {
         screen.Image = img;
     }
 }
        public static void HideImage()
        {
            if (image.InvokeRequired)
            {
                image.Invoke(new MethodInvoker(delegate { image.Image = null; image.Visible = false; }));
            }

            if (progressLabel.InvokeRequired)
            {
                progressLabel.Invoke(new MethodInvoker(delegate { progressLabel.Text = "Training data processed."; }));
            }
        }
Пример #18
0
        static public void ico()
        {
            MAKEPICYCH.Image = null;
            gif.Image        = null;
            //для выявления новой погоды и ошибок в программе.

            if (temperatures.stating == "ясно")
            {
                MAKEPICYCH.Invoke((MethodInvoker)(() => MAKEPICYCH.Image = Properties.Resources.d));
                gif.Invoke((MethodInvoker)(() => gif.Image = Properties.Resources.clear));
                //делегат для изменение picture box из разных потоков
            }

            if (temperatures.stating == "небольшая облачность")
            {
                MAKEPICYCH.Invoke((MethodInvoker)(() => MAKEPICYCH.Image = Properties.Resources.d_c1));
                gif.Invoke((MethodInvoker)(() => gif.Image = Properties.Resources.fyCe));
            }

            if (temperatures.stating == "облачно с прояснениями")
            {
                MAKEPICYCH.Invoke((MethodInvoker)(() => MAKEPICYCH.Image = Properties.Resources.d_c2));
                gif.Invoke((MethodInvoker)(() => gif.Image = Properties.Resources.fyCe));
            }

            if (temperatures.stating == "переменная облачность")
            {
                MAKEPICYCH.Invoke((MethodInvoker)(() => MAKEPICYCH.Image = Properties.Resources.d_c2));
                gif.Invoke((MethodInvoker)(() => gif.Image = Properties.Resources.fyCe));
            }

            if (temperatures.stating == "облачно")
            {
                MAKEPICYCH.Invoke((MethodInvoker)(() => MAKEPICYCH.Image = Properties.Resources.c3));
                gif.Invoke((MethodInvoker)(() => gif.Image = Properties.Resources.totoro));
            }

            if (temperatures.stating == "пасмурно")
            {
                MAKEPICYCH.Invoke((MethodInvoker)(() => MAKEPICYCH.Image = Properties.Resources.c3));
                gif.Invoke((MethodInvoker)(() => gif.Image = Properties.Resources.CZk));
            }
            if (temperatures.stating == "гроза")
            {
                MAKEPICYCH.Invoke((MethodInvoker)(() => MAKEPICYCH.Image = Properties.Resources.c3_st));
                gif.Invoke((MethodInvoker)(() => gif.Image = Properties.Resources._7STV));
            }
            if (temperatures.stating == "плотный туман")
            {
                MAKEPICYCH.Invoke((MethodInvoker)(() => MAKEPICYCH.Image = Properties.Resources.mist));
                gif.Invoke((MethodInvoker)(() => gif.Image = Properties.Resources.GXHc));
            }
            if (temperatures.stating == "небольшой дождь")
            {
                MAKEPICYCH.Invoke((MethodInvoker)(() => MAKEPICYCH.Image = Properties.Resources.c3));
                gif.Invoke((MethodInvoker)(() => gif.Image = Properties.Resources.CZk));
            }
        }
        void solver_OnSolutionStepCompleted(object sender, SolutionStepCompletedEventArgs e)
        {
            if (!e.Finished)
            {
                PictureBox currentStepImg = stepImgs[currentIndex];
                Label      currentStep    = stepLabels[currentIndex];
                if (currentStepImg.InvokeRequired)
                {
                    currentStepImg.Invoke((MethodInvoker) delegate() { currentStepImg.Image = Properties.Resources.ok; });
                }
                if (currentStep.InvokeRequired)
                {
                    currentStep.Invoke((MethodInvoker) delegate() { currentStep.Text = e.Type == SolutionStepType.Standard ? string.Format("{0} moves", e.Algorithm.Moves.Count) : string.Empty; });
                }
                currentIndex++;

                if (currentIndex < stepImgs.Count)
                {
                    currentStepImg = stepImgs[currentIndex];
                    currentStep    = stepLabels[currentIndex];
                    if (currentStepImg.InvokeRequired)
                    {
                        currentStepImg.Invoke((MethodInvoker) delegate() { currentStepImg.Image = Properties.Resources.refresh; });
                    }
                    if (currentStep.InvokeRequired)
                    {
                        currentStep.Invoke((MethodInvoker) delegate() { currentStep.Text = "In progress ..."; });
                    }
                }
            }
            else
            {
                if (lblTimeHeader.InvokeRequired)
                {
                    lblTimeHeader.Invoke((MethodInvoker) delegate() { lblTime.Text = string.Format("{0:f2}s", e.Milliseconds / 1000.0); });
                }
                if (lblMovesHeader.InvokeRequired)
                {
                    lblMovesHeader.Invoke((MethodInvoker) delegate() { lblMoves.Text = string.Format("{0} moves", e.Algorithm.Moves.Count); });
                }
                if (lblHeader.InvokeRequired)
                {
                    lblHeader.Invoke((MethodInvoker) delegate() { lblHeader.Text = "Solution found."; });
                }
                if (btnAdd.InvokeRequired)
                {
                    btnAdd.Invoke((MethodInvoker) delegate() { btnAdd.Enabled = true; });
                }
                solver.OnSolutionStepCompleted -= solver_OnSolutionStepCompleted;
                this.Algorithm = e.Algorithm;
            }
        }
Пример #20
0
 public void MouseEnter(Pen p)
 {
     canvas.DrawRectangle(p, 0, 0, imageSize.Width - 1, imageSize.Height - 1);
     if (control.InvokeRequired)
     {
         control.Invoke(new Action(() => { control.Refresh(); }));
     }
     else
     {
         control.Refresh();
     }
     mouseEnter = true;
 }
Пример #21
0
 internal void ActorCar()
 {
     if (actor.InvokeRequired)
     {
         actor.Invoke(new DelActorCar(ActorCar));
     }
     else
     {
         actor.BringToFront();
         actor.BackColor       = Color.Transparent;
         actor.BackgroundImage = pic.Image;
     }
 }
Пример #22
0
        public void RecolorBars(List <int> numbers, int i, int j)
        {
            RedrawBar(i, numbers, Brushes.Red);
            RedrawBar(j, numbers, Brushes.Red);
            SwapValues(numbers, i, j);

            BlackBox.Invoke(new MethodInvoker(delegate { BlackBox.Refresh(); }));

            Thread.Sleep(SortingSpeed);
            RedrawBar(i, numbers, Brushes.White);
            RedrawBar(j, numbers, Brushes.White);
            BlackBox.Invoke(new MethodInvoker(delegate { BlackBox.Refresh(); }));
        }
Пример #23
0
        private void InitializeComponent()
        {
            Text = "Keypad: 1-4, Q-R, A-F, Y-V, Restart: F5, Emulation speed: +/-";

            image = new PictureBoxWithInterpolationMode
            {
                SizeMode          = PictureBoxSizeMode.StretchImage,
                InterpolationMode = InterpolationMode.NearestNeighbor,
                Dock = DockStyle.Fill
            };
            CreateBitmap();
            BackColor = Color.Black;
            Controls.Add(image);

            bool isDisplayUpdating = false;

            machine.GraphicsUnit.DoDraw = displayData =>
            {
                if (isDisplayUpdating)
                {
                    return;
                }
                isDisplayUpdating = true;

                var bmpData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, bitmap.PixelFormat);
                try
                {
                    Marshal.Copy(displayData, 0, bmpData.Scan0, displayData.Length);
                }
                finally
                {
                    bitmap.UnlockBits(bmpData);
                }

                if (image.IsDisposed)
                {
                    return;
                }
                image.Invoke((Action) delegate
                {
                    image.Invalidate();
                    image.Update();
                });

                isDisplayUpdating = false;
            };
            machine.GraphicsUnit.ChangeResolution = _ =>
            {
                image.Invoke((Action)CreateBitmap);
            };
        }
Пример #24
0
 private void RefreshImage()
 {
     if (wc.InvokeRequired)
     { // after we've done all the processing,
         wc.Invoke(new MethodInvoker(delegate
         {
             wc.Refresh();
         }));
     }
     else
     {
         wc.Refresh();
     }
 }
Пример #25
0
        public void drawGameState()
        {
            this.pieceSize = Math.Min(box.Width / game.sizeX, box.Height / game.sizeY);
            g.Clear(background);
            int[] triplets = AlphaBetaEngine.getTripletsCount(game);
            int[] bonuses  = AlphaBetaEngine.getPositionBonuses(game);
            int   score    = triplets[0] * 100 + bonuses[0] - triplets[1] * 100 - bonuses[1];

            drawGrid();
            g.DrawString((triplets[0] * 100 + bonuses[0]) + "\t" + (triplets[1] * 100 + bonuses[1]) + "\t" + (score > 0 ? "+" : "") + score, new Font("Arial", 12), Brushes.Black, 0, 0);
            for (int i = 0; i < game.sizeX; i++)
            {
                for (int j = 0; j < game.sizeY; j++)
                {
                    if (game.board[i, j] != null)
                    {
                        Brush b = game.board[i, j] == true ? FirstPlayer : SecondPlayer;
                        g.FillEllipse(b, i * pieceSize, (game.sizeY - j - 1) * pieceSize, pieceSize, pieceSize);
                    }
                }
            }
            for (int i = game.sizeY - 1; i >= 0; i--)
            {
                if (game.board[game.lastMove, i] != null)
                {
                    g.FillEllipse(Brushes.Black, (game.lastMove + 0.25f) * pieceSize, (game.sizeY - i - 0.75f) * pieceSize, pieceSize / 2, pieceSize / 2);
                    break;
                }
            }
            box.Invoke(rm);
        }
Пример #26
0
 public void LabelStateEvent(string context, PictureBox pic, PictureBox text, int i)
 {
     if (pic.InvokeRequired)
     {
         InvokeLabelState labelCallback = new InvokeLabelState(LabelStateEvent);
         pic.Invoke(labelCallback, new object[] { context, pic, text, i });
     }
     else
     {
         AnswerCount ac = new AnswerCount();
         ac.ImageWidth     = 40;
         ac.ImagesHeight   = 40;
         ac.FontStyle      = System.Drawing.FontStyle.Bold;
         ac.AnswerFamily   = "微软雅黑";
         ac.AnswerFontSize = 15.75F;
         pic.Image         = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(69, 175, 101), 0, 41, System.Drawing.Color.FromArgb(69, 175, 101));
         text.Image        = ac.DrawingString(Brushes.White, i + "");
         if (Global.Sound())
         {
             System.Media.SystemSounds.Asterisk.Play();
             //sp.Play();
         }
         updateTop3(i, context);
     }
 }
Пример #27
0
        public void CallBack()
        {
            while (_enable)
            {
                _enable = _camera.Read(_frameImage);

                if (_setImage != null)
                {
                    try
                    {
                        _setImage.DynamicInvoke(_frameImage.ToBitmap());
                    }
                    catch { }
                }
                else
                {
                    if (!_imageBox.InvokeRequired)
                    {
                        _imageBox.Image = _frameImage.ToBitmap();
                    }
                    else
                    {
                        _imageBox.Invoke(_refreshMethodInvoker);
                    }
                }
                Thread.Sleep(Interval);
            }
        }
Пример #28
0
 public void LabelStateEvent(string context, PictureBox pic, PictureBox text, int i)
 {
     if (pic.InvokeRequired)
     {
         InvokeLabelState labelCallback = new InvokeLabelState(LabelStateEvent);
         pic.Invoke(labelCallback, new object[] { context, pic, text, i });
     }
     else
     {
         string[]    szItem = context.Split(':');
         AnswerCount ac     = new AnswerCount();
         ac.ImageWidth     = r;
         ac.ImagesHeight   = r;
         ac.FontStyle      = System.Drawing.FontStyle.Bold;
         ac.AnswerFamily   = "微软雅黑";
         ac.AnswerFontSize = 15.75F;
         pic.Image         = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(69, 175, 101), 0, r + 1, System.Drawing.Color.FromArgb(69, 175, 101));
         text.Image        = ac.DrawingString(Brushes.White, szItem[0] + "组");
         if (Global.Sound())
         {
             System.Media.SystemSounds.Asterisk.Play();
             //sp.Play();
         }
         RESULT += (RESULT.Length > 0 ? "," : "") + context;
         Log.Debug("Result=" + RESULT);
     }
 }
Пример #29
0
        public void updatePicture()
        {
            if (!pictureBox.InvokeRequired)
            {
                if (bitmap == null)
                {
                    bitmap = new Bitmap(bitmapWidth, bitmapHeight);
                }

                if (position < 0 || position > (sampleNum - 1))
                {
                    ArrayClear();
                }

                BitmapData CanvasData = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
                IntPtr     ptr        = CanvasData.Scan0;
                Marshal.Copy(dateArray, 0, ptr, bitmapWidth * bitmapHeight * 3);
                bitmap.UnlockBits(CanvasData);

                pictureBox.Image = bitmap;
            }
            else
            {
                if (updatePictureFunc == null)
                {
                    updatePictureFunc = new updatePictureCallBack(updatePicture);
                }

                pictureBox.Invoke(updatePictureFunc);
            }
        }
Пример #30
0
        public static void Draw()
        {
            // Update grid

            // draws background to image first
            if (drawingArea.InvokeRequired)
            {
                drawingArea.Invoke(new MethodInvoker(delegate
                {
                    imageGfx.DrawImage(Image.FromFile(ClientManager.Instance.ProjectPath + "/Resources/Background.png"), 0, 0);
                }));
            }
            else
            {
                imageGfx.DrawImage(Image.FromFile(ClientManager.Instance.ProjectPath + "/Resources/Background.png"), 0, 0);
            }

            for (int x = 0; x < 13; x++)
            {
                for (int y = 0; y < 13; y++)
                {
                    foreach (Tile tile in ClientManager.Instance.GetGrid().GetTile(x, y))
                    {
                        imageGfx.DrawImage(tile.GetTileGfx(), tile.GetTileGfxPosition());
                    }
                }
            }

            screenGfx.DrawImage(bitmap, 0, 0, 960, 960);
        }
 public void setPictureBox(PictureBox control, bool visible)
 {
     if (control.InvokeRequired)
     {
         control.Invoke(new MethodInvoker(delegate
         {
             control.Visible = visible;
         }));
     }
     else
     {
         control.Visible = visible;
     }
 }
Пример #32
0
 /// <summary>
 /// Sets the text for the specified control in multithreading circumstances.
 /// </summary>
 /// <param name="control"></param>
 /// <param name="text"></param>
 public static void SetControlPicture2(PictureBox control, Image val,int fx)
 {
     if (control != null)
         {
             if (control.InvokeRequired)
             {
                 SetControlPicture2Safe scts = new SetControlPicture2Safe(SetControlPicture2);
                 control.Invoke(scts, new Object[] { control, val, fx });
             }
             else
             {
                 control.Image = val;
                 switch (fx)
                 {
                     case 4:
                         break;
                     case 8:
                         control.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                         break;
                     case 12:
                         control.Image.RotateFlip(RotateFlipType.Rotate180FlipNone);
                         break;
                     case 16:
                         control.Image.RotateFlip(RotateFlipType.Rotate270FlipNone);
                         break;
                         //绿反向
     //                            img.RotateFlip(RotateFlipType.Rotate90FlipNone);
     //顺时针旋转90度 RotateFlipType.Rotate90FlipNone
     //逆时针旋转90度 RotateFlipType.Rotate270FlipNone
     //水平翻转 RotateFlipType.Rotate180FlipY
     //垂直翻转 RotateFlipType.Rotate180FlipX
                     case 104:
                         control.Image.RotateFlip(RotateFlipType.Rotate180FlipY);
                         break;
                     case 108:
                         control.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                         control.Image.RotateFlip(RotateFlipType.Rotate180FlipX);
                         break;
                     case 112:
                         control.Image.RotateFlip(RotateFlipType.Rotate180FlipNone);
                         control.Image.RotateFlip(RotateFlipType.Rotate180FlipY);
                         break;
                     case 116:
                         control.Image.RotateFlip(RotateFlipType.Rotate270FlipNone);
                         control.Image.RotateFlip(RotateFlipType.Rotate180FlipX);
                         break;
                     //绿 45度
                     case 203:
                         control.Image.RotateFlip(RotateFlipType.Rotate180FlipY);
                         control.Image = GetRotateImage(control.Image, -45);
                         break;
                     case 207:
                         control.Image.RotateFlip(RotateFlipType.Rotate180FlipY);
                         control.Image = GetRotateImage(control.Image, 45);
                         break;
                     case 211:
                         control.Image.RotateFlip(RotateFlipType.Rotate180FlipY);
                         control.Image = GetRotateImage(control.Image, -45);
                         break;
                     case 215:
                         control.Image.RotateFlip(RotateFlipType.Rotate180FlipY);
                         control.Image = GetRotateImage(control.Image, 45);
                         break;
                     //绿 45度反向
                     case 303:
                         control.Image = GetRotateImage(control.Image, -45);
                         break;
                     case 307:
                         control.Image = GetRotateImage(control.Image, 45);
                         break;
                     case 311:
                         control.Image = GetRotateImage(control.Image, -45);
                         break;
                     case 315:
                         control.Image = GetRotateImage(control.Image, 45);
                         break;
                     default:
                         break;
                 }
             }
         }
 }
Пример #33
0
 /// <summary>
 /// Sets the text for the specified control in multithreading circumstances.
 /// </summary>
 /// <param name="control"></param>
 /// <param name="text"></param>
 public static void SetControlPicture(PictureBox control, Image val)
 {
     if (control != null)
         {
             if (control.InvokeRequired)
             {
                 SetControlPictureSafe scts = new SetControlPictureSafe(SetControlPicture);
                 control.Invoke(scts, new Object[] { control, val });
             }
             else
             {
                 control.Image = val;
             }
         }
 }