ImageAnimator.Animate メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ImageAnimator.Animate メソッドの意味・解説 

ImageAnimator.Animate メソッド

多重フレーム イメージアニメーション表示します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Shared Sub Animate
 ( _
    image As Image, _
    onFrameChangedHandler As EventHandler _
)
Dim image As Image
Dim onFrameChangedHandler As EventHandler

ImageAnimator.Animate(image, onFrameChangedHandler)
public static void Animate
 (
    Image image,
    EventHandler onFrameChangedHandler
)
public:
static void Animate (
    Image^ image, 
    EventHandler^ onFrameChangedHandler
)
public static void Animate
 (
    Image image, 
    EventHandler onFrameChangedHandler
)
public static function Animate
 (
    image : Image, 
    onFrameChangedHandler : EventHandler
)

パラメータ

image

アニメーション化する Image オブジェクト

onFrameChangedHandler

アニメーション フレーム変更されたときに呼び出されるメソッド指定する EventHandler オブジェクト

戻り値
このメソッドは値を返しません。

使用例使用例

この Windows フォーム アプリケーションは、アニメーション イメージ画面どのように描画されるかを示します。このイメージは、アプリケーションと同じフォルダ保存されているアニメーション GIF ファイルの SampleAnimation.gif から作成されます。

Imports System
Imports System.Drawing
Imports System.Windows.Forms

Public Class animateImage
    Inherits Form

    'Create a Bitmpap Object.
    Private animatedImage As New
 Bitmap("SampleAnimation.gif")
    Private currentlyAnimating As Boolean
 = False

    'This method begins the animation.
    Public Sub AnimateImage()
        If Not currentlyAnimating Then

            'Begin the animation only once.
            ImageAnimator.Animate(animatedImage, _
            New EventHandler(AddressOf Me.OnFrameChanged))
            currentlyAnimating = True
        End If
    End Sub

    Private Sub OnFrameChanged(ByVal
 o As Object, ByVal e As
 EventArgs)

        'Force a call to the Paint event handler.
        Me.Invalidate()
    End Sub

    Protected Overrides Sub
 OnPaint(ByVal e As PaintEventArgs)

        'Begin the animation.
        AnimateImage()

        'Get the next frame ready for rendering.
        ImageAnimator.UpdateFrames()

        'Draw the next frame in the animation.
        e.Graphics.DrawImage(Me.animatedImage, New
 Point(0, 0))
    End Sub

    Public Shared Sub Main()
        Application.Run(New AnimateImage)
    End Sub
End Class
using System;
using System.Drawing;
using System.Windows.Forms;

public class animateImage : Form 
{
                     
    //Create a Bitmpap Object.
    Bitmap animatedImage = new Bitmap("SampleAnimation.gif");
    bool currentlyAnimating = false;
                     
    //This method begins the animation.
    public void AnimateImage() 
    {
        if (!currentlyAnimating) 
        {
                     
            //Begin the animation only once.
            ImageAnimator.Animate(animatedImage, new EventHandler(this.OnFrameChanged));
            currentlyAnimating = true;
        }
    }

    private void OnFrameChanged(object o, EventArgs
 e) 
    {
                     
        //Force a call to the Paint event handler.
        this.Invalidate();
    }

    protected override void OnPaint(PaintEventArgs
 e) 
    {
                     
        //Begin the animation.
        AnimateImage();
                     
        //Get the next frame ready for rendering.
        ImageAnimator.UpdateFrames();
                     
        //Draw the next frame in the animation.
        e.Graphics.DrawImage(this.animatedImage, new
 Point(0, 0));
    }

    public static void Main()
 
    {
        Application.Run(new animateImage());
    }
}
#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;

public ref class AnimateImageForm : public
 Form 
{

    // Create a Bitmap Object.
private:
    Bitmap^ animatedImage;
private:
    bool currentlyAnimating;

public:
    AnimateImageForm()
    {
        try
        {
            animatedImage = gcnew Bitmap("SampleAnimation.gif");
        }
        catch (ArgumentException^)
        {
            MessageBox::Show("Could not read the image file " +
                "\"SampleAnimation.gif\",\n" +
                "or it is not a valid image file.");
        }
    }

    // This method begins the animation.
public:
    void AnimateImage() 
    {
        // Begin the animation only once.
        // Make sure to animate only if animatedImage was
        // successfully initialised.
        if (!currentlyAnimating && animatedImage != nullptr)
        {
            ImageAnimator::Animate(animatedImage,
                gcnew EventHandler(this, &AnimateImageForm::OnFrameChanged));
            currentlyAnimating = true;
        }
    }

private:
    void OnFrameChanged(Object^ , EventArgs^ ) 
    {
        // Force a call to the Paint event handler.
        this->Invalidate();
    }

protected:
    virtual void OnPaint(PaintEventArgs^ e) override
    {
        // Begin the animation.
        AnimateImage();

        // Get the next frame ready for rendering.
        ImageAnimator::UpdateFrames();

        if (animatedImage != nullptr)
        {
            // Draw the next frame in the animation.
            e->Graphics->DrawImage(this->animatedImage
,
                Point(0, 0));
        }
    }
};

[STAThread]
int main()
{
    Application::Run(gcnew AnimateImageForm());
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からImageAnimator.Animate メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からImageAnimator.Animate メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からImageAnimator.Animate メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ImageAnimator.Animate メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ImageAnimator.Animate メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS