コード例 #1
0
        private void StopAnimate()
        {
            if (nowgif == null)
            {
                return;
            }

            if (ImageAnimator.CanAnimate(nowgif))
            {
                ImageAnimator.StopAnimate(nowgif, m_evthdlAnimator);
            }
        }
コード例 #2
0
ファイル: Formwait.cs プロジェクト: tang-xy/Test
        private void StopAnimate()
        {
            if (m_imgImage == null)
            {
                return;
            }

            if (ImageAnimator.CanAnimate(m_imgImage))
            {
                ImageAnimator.StopAnimate(m_imgImage, m_evthdlAnimator);
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: Nemoom/FamilyDay2020_Display
 /// <summary>
 /// 重置动画,使之停止在第0帧位置上。
 /// </summary>
 public void Reset()
 {
     if (mCanAnimate)
     {
         ImageAnimator.StopAnimate(image, new EventHandler(FrameChanged));
         lock (image)
         {
             image.SelectActiveFrame(frameDimension, 0);
             mCurrentFrame = 0;
         }
     }
 }
コード例 #4
0
        /// <summary>
        /// Sets the image gif source.
        /// </summary>
        private void SetImageGifSource()
        {
            if (_bitmap != null)
            {
                ImageAnimator.StopAnimate(_bitmap, OnFrameChanged);

                _bitmap = null;
            }

            if (string.IsNullOrEmpty(GifSource))
            {
                Source = null;

                InvalidateVisual();

                return;
            }

            // Check if this is a file
            if (File.Exists(GifSource))
            {
                _bitmap = (Bitmap)Image.FromFile(GifSource);
            }
            else
            {
                // Support looking for embedded resources
                Assembly assemblyToSearch = Assembly.GetAssembly(GetType());
                _bitmap = GetBitmapResourceFromAssembly(assemblyToSearch);
                if (_bitmap == null)
                {
                    // Search calling assembly
                    assemblyToSearch = Assembly.GetCallingAssembly();
                    _bitmap          = GetBitmapResourceFromAssembly(assemblyToSearch);
                    if (_bitmap == null)
                    {
                        // Get entry assembly
                        assemblyToSearch = Catel.Reflection.AssemblyHelper.GetEntryAssembly();
                        _bitmap          = GetBitmapResourceFromAssembly(assemblyToSearch);
                        if (_bitmap == null)
                        {
                            throw Log.ErrorAndCreateException <FileNotFoundException>("Gif source '{0}' was not found", GifSource);
                        }
                    }
                }
            }

            if (_bitmap != null)
            {
                // Start animating
                ImageAnimator.Animate(_bitmap, OnFrameChanged);
            }
        }
コード例 #5
0
 protected override void OnLayerDisable()
 {
     if (_hasGif)
     {
         foreach (Bitmap b in images)
         {
             if (ImageAnimator.CanAnimate(b))
             {
                 ImageAnimator.StopAnimate(b, OnFrameChanged);
             }
         }
     }
 }
コード例 #6
0
        public override void Dispose()
        {
            if (_fileHandle == null)
            {
                return;
            }

            ImageAnimator.StopAnimate(_fileHandle, OnFrameChanged);
            _fileHandle.Dispose();

            _fileHandle = null;
            _frame      = null;
        }
コード例 #7
0
 private void PlayWin(object o, EventArgs e)
 {
     winImage.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Time, fWin++);
     g.FillRectangle(new SolidBrush(Color.Black), 20, 20, 30 + big, (int)((22 + big) * 1.375));
     g.DrawImage(winImage, 20, 20, 30 + big, (int)(22 + big * 1.375));
     System.Threading.Thread.Sleep(50);
     if (fWin > winImage.GetFrameCount(System.Drawing.Imaging.FrameDimension.Time) - 2)
     {
         fWin = 0;
         ImageAnimator.StopAnimate(winImage, new EventHandler(this.PlayWin));
     }
     big += 5;
 }
コード例 #8
0
        private void GoDown(object o, EventArgs e)
        {
            if (steps < y)
            {
                steps += 4.285F;
                if (steps + 0.5 >= y)
                {
                    ImageAnimator.StopAnimate(downImage, new EventHandler(this.GoDown));
                    for (byte i = 0; i < from.Length; i++)
                    {
                        if (from[i] != null)
                        {
                            from[i].Draw();
                        }
                        if (where[i] != null)
                        {
                            where[i].Draw();
                        }
                    }

                    if (withBox)
                    {
                        if (boxes[0].Id == BlockState.Container)
                        {
                            boxes[1].OnContainer = true;
                        }
                        else
                        {
                            boxes[1].OnContainer = false;
                        }
                        boxes[1].Draw();
                    }
                    steps = 0;
                }
                else
                {
                    fDown = ++fDown % downImage.GetFrameCount(System.Drawing.Imaging.FrameDimension.Time);
                    downImage.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Time, fDown);
                    g.FillRectangle(new SolidBrush(Color.Black), x, steps - 4.285F, width, height + 4.285F);
                    g.DrawImage(downImage, x + 4, steps, 22, 30);
                    if (withBox)
                    {
                        Box.Draw(x, steps + 30);
                    }
                    while (Console.KeyAvailable)
                    {
                        Console.ReadKey(true);
                    }
                }
            }
        }
コード例 #9
0
        private void level1_KeyDown(object sender, KeyEventArgs e)
        {
            if (car_ingame.Location.X >= 551)
            {
                car_ingame.Location = new Point(550, car_ingame.Location.Y);
            }
            else if (car_ingame.Location.X <= 48)
            {
                car_ingame.Location = new Point(49, car_ingame.Location.Y);
            }
            else
            {
                int currentKey = e.KeyValue;
                switch (currentKey)
                {
                case 65:
                    timer1.Enabled = true;
                    break;

                case 68:
                    timer2.Enabled = true;
                    break;

                case 27:
                    resume_button.Visible        = true;
                    settings_button_game.Visible = true;
                    go_menu.Visible = true;
                    game_sound.Pause();
                    ImageAnimator.StopAnimate(this.BackgroundImage, OnFrameChanged);
                    break;

                case 87:

                    speedCar_text.Text = (speedCar + " km/h");
                    if (speedCar < 199)
                    {
                        speedCar++;
                    }
                    break;

                case 83:
                    speedCar_text.Text = (speedCar + " km/h");
                    if (speedCar >= 100)
                    {
                        speedCar--;
                    }
                    break;
                }
            }
        }  // управление машинкой
コード例 #10
0
 private void GoLeft(object o, EventArgs e)
 {
     if (steps > x)
     {
         steps -= 4.285F;
         if (steps - 0.5 <= x)
         {
             ImageAnimator.StopAnimate(leftImage, new EventHandler(this.GoLeft));
             for (byte i = 0; i < from.Length; i++)
             {
                 if (from[i] != null)
                 {
                     from[i].Draw();
                 }
                 if (where[i] != null)
                 {
                     where[i].Draw();
                 }
             }
             if (withBox)
             {
                 if (boxes[0].Id == BlockState.Container)
                 {
                     boxes[1].OnContainer = true;
                 }
                 else
                 {
                     boxes[1].OnContainer = false;
                 }
                 boxes[1].Draw();
             }
             steps = 0;
         }
         else
         {
             fLeft = ++fLeft % upImage.GetFrameCount(System.Drawing.Imaging.FrameDimension.Time);
             leftImage.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Time, fLeft);
             g.FillRectangle(new SolidBrush(Color.Black), steps, y, width + 4.285F, height);
             g.DrawImage(leftImage, steps + 1, y, 27, 30);
             if (withBox)
             {
                 Box.Draw(steps - 30, y);
             }
             while (Console.KeyAvailable)
             {
                 Console.ReadKey(true);
             }
         }
     }
 }
コード例 #11
0
        /// <summary>
        /// 敵の上に技のエフェクトの描写
        /// </summary>
        /// <param name="effectPass">技のパス</param>
        private void Effect(string effectPass)
        {
            _image = new Bitmap(System.IO.Path.Combine(Application.StartupPath, @"C:.\..\..\images\" + effectPass));
            // pictureBox1の背景画像としてセット
            pictureBoxEnemy.Image = _image;

            // 描画(Paint)イベントハンドラを追加
            pictureBoxEnemy.Paint += PictureBoxEnemy_Paint;
            // アニメーション開始
            ImageAnimator.Animate(_image, new EventHandler(Image_FrameChanged));
            Sleep(1400);
            ImageAnimator.StopAnimate(_image, new EventHandler(Image_FrameChanged));
            pictureBoxEnemy.Image = null;
        }
コード例 #12
0
ファイル: LgImage.cs プロジェクト: rinavin/RCJS
        internal override void Dispose()
        {
            base.Dispose();
            if (DisplayImage != null)
            {
#if !PocketPC
                if (DisplayImage.Tag != null)
                {
                    ImageAnimator.StopAnimate(DisplayImage, this.OnFrameChanged);
                }
#endif
                DisplayImage.Dispose();
            }
        }
コード例 #13
0
ファイル: Form1.cs プロジェクト: andylaufzf/Reimu
 public void OnFrameChanged(object o, EventArgs e)
 {
     if (Imageindex == 1)
     {
         if (zhen <= 0)
         {
             ImageAnimator.StopAnimate(imagegif, new EventHandler(this.OnFrameChanged));
         }
         else
         {
             zhen--;
         }
     }
     Invalidate();
 }
                public void RemoveCell(RowCol rowCol)
                {
                    Debug.Assert(_cells.Contains(rowCol));

                    if (_cells.Contains(rowCol))
                    {
                        _cells.Remove(rowCol);

                        if (_cells.Count == 0)
                        {
                            // this was the last cell we were using this image, so stop animation
                            ImageAnimator.StopAnimate(Image, new EventHandler(OnFrameChanged));
                        }
                    }
                }
コード例 #15
0
ファイル: Form1.cs プロジェクト: andylaufzf/Reimu
        /*播放歌曲函数*/
        public void MusicPlay()
        {
            if (My_Music.Count == 0)
            {
                MessageBox.Show("音乐播放列表为空,请先添加音乐!");
                return;
            }
            Random r = new Random();

            MusicPlayer.URL = My_Music[r.Next(My_Music.Count)];
            ImageAnimator.StopAnimate(imagegif, new EventHandler(this.OnFrameChanged));
            imagegif   = imagegif5;
            Imageindex = 2;
            PlayAnimate();
        }
コード例 #16
0
        public void Dispose()
        {
            _isInitialized = false;
            if (_bitmap != null)
            {
                ImageAnimator.StopAnimate(_bitmap, OnFrameChanged);
                _bitmap.Dispose();
                _bitmap = null;
            }

            _source = null;
            GC.Collect();
            GC.WaitForFullGCComplete();
            // Console.WriteLine("Dispose: " + GifSource);
        }
コード例 #17
0
 public void Quit()
 {
     isQuit = true;
     otherMessagesPass.SetKill();
     standardMessagePass.SetKill();
     ImageAnimator.StopAnimate(animationImage, new EventHandler(this.AnimateStep));
     if (form.Created)
     {
         form.Close();
     }
     if (otherForm.Created)
     {
         otherForm.Close();
     }
     this.Close();
 }
コード例 #18
0
ファイル: GameForm.cs プロジェクト: GSO-SW/2DRunner
 /// <summary>
 /// Beended das Spiel bei kontakt mit einem Hinderniss
 /// </summary>
 private void Gamend()
 {
     for (int i = 0; i <= obs.Recs.Count - 1; i++)
     {
         if (player.Hitbox.IntersectsWith(obs.Recs[i]))
         {
             player.Dead = true;
             ImageAnimator.StopAnimate(player.AnimatedImage, new EventHandler(Timer_tick));
         }
     }
     if (player.Dead)
     {
         player.AnimatedImage = Properties.Resources.dead;
         timer.Stop();
     }
 }
コード例 #19
0
 void Frames(int j)
 {
     if (enemy[j].currentlyAnimating)
     {
         enemy[j].tick++;
         if (enemy[j].tick == 93)
         {
             enemy[j].tick = 0;
             ImageAnimator.StopAnimate(enemy[j].explosion, new EventHandler(this.OnFrameChanged));
             enemy[j].currentlyAnimating = false;
         }
         ImageAnimator.UpdateFrames();
         myBuffer.Graphics.DrawImage(enemy[j].explosion, new Point(enemy[j].xExplosion, enemy[j].yExplosion));
         enemy[j].yExplosion++;
     }
 }
コード例 #20
0
ファイル: LgImage.cs プロジェクト: rinavin/RCJS
        /// <summary>
        ///
        /// </summary>
        internal void SetBackgroundImage()
        {
            Rectangle displayRect = getRectangle();

#if !PocketPC
            if (DisplayImage != null)
            {
                if (DisplayImage.Tag != null)
                {
                    ImageAnimator.StopAnimate(DisplayImage, OnFrameChanged);
                    DisplayImage.Dispose();
                }
            }
#endif
            DisplayImage = ImageUtils.GetImageByStyle(OrgImage, ImageStyle, displayRect.Size, false);
        }
コード例 #21
0
        private async void SetupOtpDeviceLink_Load(object sender, EventArgs e)
        {
            _loginRequestIdentifier = await GetLoginIdentifier();

            if (_loginRequestIdentifier == null)
            {
                Invoke((MethodInvoker) delegate
                {
                    MessageBox.Show(@"There was an unknown error registering mobile device with the server");
                    Close();
                });
                return;
            }

            var linkCode = new LinkCodeRegisterInitialOtpDevice(_serverAccount.HttpsEnabled,
                                                                _serverAccount.ServerHost, _serverAccount.ServerPort, _serverAccount.ServerApiVersion,
                                                                _loginRequestIdentifier, _serverAccount.EmailAddress,
                                                                _cryptoKey.PublicKeyPemHash, false);
            var linkCodeString = linkCode.ToString();

            Logger.Verbose("Attempting to link to second device with code: " + linkCodeString);

            // The -1 on the dimensions is due to an issue in Mono where the image won't show
            // unless it is smaller than the label (rather than the same size)
            var barcodeWriter = new BarcodeWriter
            {
                Format  = BarcodeFormat.QR_CODE,
                Options = new ZXing.Common.EncodingOptions
                {
                    Margin = 0,
                    Height = lblQrCode.Height - 1,
                    Width  = lblQrCode.Height - 1
                }
            };

            ImageAnimator.StopAnimate(lblQrCode.Image, AnimateLoader);
            _loadingAnimationRunning = false;

            var barcodeBitmap = barcodeWriter.Write(linkCodeString);

            lblQrCode.Image = barcodeBitmap;

            _checkthread = new Thread(CheckLink);
            _checkthread.Start();

            txtOtpDeviceLinkCode.Text = linkCodeString;
        }
コード例 #22
0
ファイル: ImagePrimitive.cs プロジェクト: configare/hispeed
        protected override void DisposeManagedResources()
        {
            if (this.cachedImage != null)
            {
                if (ImageAnimator.CanAnimate(this.cachedImage))
                {
                    ImageAnimator.StopAnimate(this.cachedImage, OnFrameChanged);
                }
                else if (this.BitState[ImageClonedStateKey])
                {
                    this.cachedImage.Dispose();
                }
                this.cachedImage = null;
            }

            base.DisposeManagedResources();
        }
コード例 #23
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (message != parentForm.message)
            {
                message     = parentForm.message;
                txtMsg.Text = message;
            }

            if (!parentForm.stopWaiting)
            {
                return;
            }

            timer1.Stop();
            ImageAnimator.StopAnimate(waitAnimation, null);
            Close();
        }
コード例 #24
0
ファイル: Mover.cs プロジェクト: wwkkww1983/128_5.6_2010
 public void ReadyForReMove()
 {
     NowIndex       = 1;
     NowDatetime    = 0;
     NowNextStation = 0;
     this.Route     = route;
     this.Routes    = route.Split('|');
     string[] xy = this.Routes[0].Split(',');
     this.X       = float.Parse(xy[0]);
     this.Y       = float.Parse(xy[1]);
     this.Oldleft = float.Parse(xy[0]);
     this.Oldtop  = float.Parse(xy[1]);
     xy           = this.Routes[1].Split(',');
     this.step    = GetSetp(this.X, this.Y, float.Parse(xy[0]), float.Parse(xy[1]));
     if (DataAndTimes.Length > 0)
     {
         labFoot = DataAndTimes[0];
         //NowDatetime++;
     }
     if (NextStations.Length > 0)
     {
         labFoot = labFoot + "\r\n目的地:" + NextStations[0];
         //NowNextStation++;
     }
     if (Step.IsRtoL)
     {
         ImageAnimator.StopAnimate(this.MoverImage, null);
         this.MoverImage  = new System.Drawing.Bitmap(ZFilePath);
         this.NowFilePath = ZFilePath;
         if (ImageAnimator.CanAnimate(this.MoverImage))
         {
             ImageAnimator.Animate(this.MoverImage, null);
         }
     }
     else
     {
         ImageAnimator.StopAnimate(this.MoverImage, null);
         this.MoverImage  = new System.Drawing.Bitmap(FFilePath);
         this.NowFilePath = FFilePath;
         if (ImageAnimator.CanAnimate(this.MoverImage))
         {
             ImageAnimator.Animate(this.MoverImage, null);
         }
     }
 }
コード例 #25
0
        private static void PlayAnimation_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var gic = (GifImage)d;

            if ((bool)e.NewValue)
            {
                //StartAnimation if GIFSource is properly set
                if (null != gic._Bitmap)
                {
                    ImageAnimator.Animate(gic._Bitmap, gic.OnFrameChanged);
                }
            }
            else
            {
                //Pause Animation
                ImageAnimator.StopAnimate(gic._Bitmap, gic.OnFrameChanged);
            }
        }
コード例 #26
0
ファイル: Form1.cs プロジェクト: andylaufzf/Reimu
 public void ZhaYan()
 {
     timer1.Stop();
     timer1.Start();
     if (imagegif == imagegif5)      //灵梦专注唱歌的时候不会理你
     {
         return;
     }
     if (Imageindex == 2)
     {
         ImageAnimator.StopAnimate(imagegif, new EventHandler(this.OnFrameChanged));
         imagegif   = imagegif1;
         Imageindex = 1;
     }
     imagegif.SelectActiveFrame(frameDimension, 0);
     zhen = imagegif.GetFrameCount(frameDimension);
     PlayAnimate();
 }
コード例 #27
0
 private void Animate(bool animate)
 {
     if (animate != this.GetFlag(0x10))
     {
         if (animate)
         {
             if (this.image != null)
             {
                 ImageAnimator.Animate(this.image, new EventHandler(this.OnFrameChanged));
                 this.SetFlag(0x10, animate);
             }
         }
         else if (this.image != null)
         {
             ImageAnimator.StopAnimate(this.image, new EventHandler(this.OnFrameChanged));
             this.SetFlag(0x10, animate);
         }
     }
 }
コード例 #28
0
 private void SetImageGIFSource()
 {
     if (null != _Bitmap)
     {
         ImageAnimator.StopAnimate(_Bitmap, OnFrameChanged);
         _Bitmap = null;
     }
     if (String.IsNullOrEmpty(GifSource))
     {
         //Turn off if GIF set to null or empty
         Source = null;
         InvalidateVisual();
         return;
     }
     if (File.Exists(GifSource))
     {
         _Bitmap = (Bitmap)System.Drawing.Image.FromFile(GifSource);
     }
     else
     {
         //Support looking for embedded resources
         Assembly assemblyToSearch = Assembly.GetAssembly(GetType());
         _Bitmap = GetBitmapResourceFromAssembly(assemblyToSearch);
         if (null == _Bitmap)
         {
             assemblyToSearch = Assembly.GetCallingAssembly();
             _Bitmap          = GetBitmapResourceFromAssembly(assemblyToSearch);
             if (null == _Bitmap)
             {
                 assemblyToSearch = Assembly.GetEntryAssembly();
                 _Bitmap          = GetBitmapResourceFromAssembly(assemblyToSearch);
                 if (null == _Bitmap)
                 {
                     throw new FileNotFoundException("GIF Source was not found.", GifSource);
                 }
             }
         }
     }
     if (PlayAnimation)
     {
         ImageAnimator.Animate(_Bitmap, OnFrameChanged);
     }
 }
コード例 #29
0
 private void Animate(bool animate)
 {
     if (animate != this.currentlyAnimating)
     {
         if (animate)
         {
             if (this.image != null)
             {
                 ImageAnimator.Animate(this.image, new EventHandler(this.OnFrameChanged));
                 this.currentlyAnimating = animate;
             }
         }
         else if (this.image != null)
         {
             ImageAnimator.StopAnimate(this.image, new EventHandler(this.OnFrameChanged));
             this.currentlyAnimating = animate;
         }
     }
 }
コード例 #30
0
ファイル: ProgressForm.cs プロジェクト: pangxb/SchoolHealth
        protected override void OnVisibleChanged(EventArgs e)
        {
            if (Image != null)
            {
                if (this.Visible)
                {
                    if (ImageAnimator.CanAnimate(Image))
                    {
                        ImageAnimator.StopAnimate(Image, OnAnimate);
                        ImageAnimator.Animate(Image, OnAnimate);
                    }
                }
                else
                {
                    ImageAnimator.StopAnimate(Image, OnAnimate);
                }
            }

            base.OnVisibleChanged(e);
        }