c#使用多线程动态在多张图上画图和写字

本文介绍如何在C#中利用多线程动态地在多张图片上绘制曲线,并实现鼠标悬停时图片放大及持续绘图的效果。通过创建一个DrawString类来处理绘图操作,并结合timer组件每秒刷新图像。
摘要由CSDN通过智能技术生成

最近有个需求就是在多张图上动态的画曲线,并且鼠标放在图上的时候图片放大且此时图上还是继续的画曲线。于是这里就做了个小Test

一、新建一个窗口,添加三张图和一个timer,此处timer是为了每一秒刷新图片

效果图如下:


二、添加一个类 DrawString,用来画图

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Threading;
namespace ImageAndThread
{
    class DrawString
    {
        private string strToShow=null;
        private System.Drawing.Image mImage =null;
        public DrawString(string str,System.Drawing.Image mImage)
        {
            this.strToShow = str;
            this.mImage = mImage;
        }
        public void draw()
        {
            Graphics g = Graphics.Fro
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值