private void StopAnimate() { if (nowgif == null) { return; } if (ImageAnimator.CanAnimate(nowgif)) { ImageAnimator.StopAnimate(nowgif, m_evthdlAnimator); } }
private void StopAnimate() { if (m_imgImage == null) { return; } if (ImageAnimator.CanAnimate(m_imgImage)) { ImageAnimator.StopAnimate(m_imgImage, m_evthdlAnimator); } }
/// <summary> /// 重置动画,使之停止在第0帧位置上。 /// </summary> public void Reset() { if (mCanAnimate) { ImageAnimator.StopAnimate(image, new EventHandler(FrameChanged)); lock (image) { image.SelectActiveFrame(frameDimension, 0); mCurrentFrame = 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); } }
protected override void OnLayerDisable() { if (_hasGif) { foreach (Bitmap b in images) { if (ImageAnimator.CanAnimate(b)) { ImageAnimator.StopAnimate(b, OnFrameChanged); } } } }
public override void Dispose() { if (_fileHandle == null) { return; } ImageAnimator.StopAnimate(_fileHandle, OnFrameChanged); _fileHandle.Dispose(); _fileHandle = null; _frame = null; }
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; }
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); } } } }
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; } } } // управление машинкой
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); } } } }
/// <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; }
internal override void Dispose() { base.Dispose(); if (DisplayImage != null) { #if !PocketPC if (DisplayImage.Tag != null) { ImageAnimator.StopAnimate(DisplayImage, this.OnFrameChanged); } #endif DisplayImage.Dispose(); } }
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)); } } }
/*播放歌曲函数*/ 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(); }
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); }
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(); }
/// <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(); } }
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++; } }
/// <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); }
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; }
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(); }
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(); }
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); } } }
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); } }
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(); }
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); } } }
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); } }
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; } } }
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); }