加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ToolTip控件

发布时间:2020-12-16 02:23:03 所属栏目:百科 来源:网络整理
导读:题目要求: 窗体中有一个图片框,显示一副图片。要求:1)在窗体打开时,动态加载图片;2)设置图片显示模式为根据图片框大小缩放图片;3)图片自己找;4)当鼠标停留在图片框时,显示如“北京风光”的文本提示(使用ToolTip控件)。 输入代码: using Syste

题目要求:

窗体中有一个图片框,显示一副图片。要求:1)在窗体打开时,动态加载图片;2)设置图片显示模式为根据图片框大小缩放图片;3)图片自己找;4)当鼠标停留在图片框时,显示如“北京风光”的文本提示(使用ToolTip控件)。


输入代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 第12周上机3_1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender,EventArgs e)
        {
            this.pictureBox1.Image = Image.FromFile("4.jpg");
            this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            toolTip1.SetToolTip(pictureBox1,"北京风光");
        }

        private void toolTip1_Popup(object sender,PopupEventArgs e)
        {

        }
    }
}


运行截图:


(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读