* 程序的版权和版本声明部分
* Copyright (c) 2012, 烟台大学计算机学院学生
* All rights reserved.
* Copyright (c) 2012, 烟台大学计算机学院学生
* All rights reserved.
* 作 者: 刘镇
* 完成日期: 2012 年 11 月 18 日
* 版 本 号: 3.022
* 对任务及求解方法的描述部分
* 问题描述:该窗体中有一个图片框,显示一副图片。要求:1)在窗体打开时,动态加载图片;2)设置图片显示模式为根据图片框大小缩放图片;3)图片自己找;4)当鼠标停留在图片框时,显示“**风光”提示
*代码部分:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Win10_1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Text = "窗口1---图片处理";
this.pictureBox1.Image = Image.FromFile("guiqi1.jpg");//动态加载图片
this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;//设置图片显示方式
this.toolTip1.SetToolTip(pictureBox1, "鬼泣之但丁风光");
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void toolTip1_Popup(object sender, PopupEventArgs e)
{
}
}
}
测试结果: