C # Animated image display

Source: Internet
Author: User
Tags class definition

PPT to animate the slide show is a very important feature, I believe there must be your favorite animation way, today I take you to know several animation to show the way the production of slides, because it is GDI + programming, Here's an image instead of a slide (actually the principle is interlinked) to show how to animate an image.

Description: Because it is animated to display images, there is no way to directly paste a static screenshot, so decided to give the garden friends open source, all the running code attached to the case, because all the animated image objects are placed in the PictureBox control, while the definition of classes are similar, So here first of all the following cases to be used in the class and load the image of the code to everyone, run with the code here Add any one of the following instances of code to run the program! At the same time the landlord to ensure that each case code is compiled, never fooled!

Drawing class definition and opening image file code

Code

[Copy to Clipboard]

CODE:

private Bitmap SourceBitmap;
private Bitmap MyBitmap;
private void button2_Click(object sender, EventArgs e)
{
//打开图像文件
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "图像文件(JPeg, Gif, Bmp, etc.)
|*.jpg;*.jpeg;*.gif;*.bmp;*.tif; *.tiff; *.png| JPeg 图像文件(*.jpg;*.jpeg)
|*.jpg;*.jpeg |GIF 图像文件(*.gif)|*.gif |BMP图像文件(*.bmp)|*.bmp
|Tiff图像文件(*.tif;*.tiff)|*.tif;*.tiff|Png图像文件(*.png)| *.png |所有文件(*.*)|*.*";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
//得到原始大小的图像
SourceBitmap = new Bitmap(openFileDialog.FileName);
//得到缩放后的图像
MyBitmap = new Bitmap(SourceBitmap, this.pictureBox1.Width, this.pictureBox1.Height);
this.pictureBox1.Image = MyBitmap;
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.