当前位置: 首页 > news >正文

如何用鼠标点击在picturebox的图像上做标记

在这里插入图片描述
鼠标点击图像,在点击处画一个圆。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace PictureDemo
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void pictureBox1_Click(object sender, EventArgs e){//得到鼠标相对于pictureBox左上角的位置Point p1=pictureBox1.PointToClient(Control.MousePosition);Image imageBmp = pictureBox1.Image;using (Graphics g = Graphics.FromImage(imageBmp)){g.SmoothingMode = SmoothingMode.AntiAlias;         //抗锯齿g.PixelOffsetMode = PixelOffsetMode.HighQuality;   //高质量g.InterpolationMode = InterpolationMode.High;      //差值算法Color penColor = Color.Green;Pen pens = new Pen(penColor, 1);                //定义画笔(线条)Brush brushs = new SolidBrush(penColor);        //定义画刷(填充)g.DrawEllipse(pens, p1.X, p1.Y, 50, 50);//画圆弧线条g.FillEllipse(brushs, p1.X, p1.Y, 50, 50);//填充圆弧}pictureBox1.Image = imageBmp;}}
}
http://www.lryc.cn/news/347830.html

相关文章:

  • k8s介绍
  • K-means聚类模型:深入解析与应用指南
  • CTF-密码学基础
  • 代码随想录算法训练营day22 | 654.最大二叉树、617.合并二叉树、700.二叉搜索树中的搜索、98.验证二叉搜索树
  • 企业信息防泄漏软件分析:盘点常用企业信息防泄漏软件
  • Rancher-Kubewarden-保姆级教学-含Demo测试
  • Lumerical Script ------ array 数组类型 和 matrix 矩阵类型
  • Springboot自动装配源码分析
  • Visual Transformer (ViT)模型详解 动图讲解
  • C++:完美转发(一)(std::forward)
  • 西部首个全域直播基地,打造西部直播基地领军形象
  • 钟表——蓝桥杯十三届2022国赛大学B组真题
  • CSS 之 圆形波浪进度条效果
  • 按下鼠标进行拖拽,让元素跟随鼠标进行移动,鼠标抬起,元素停止移;js鼠标拖拽 (鼠标按下事件:onmousedown、鼠标移动事件:onmousemove、鼠标抬起事件:onmouseup)
  • 第十二章 项目采购管理
  • PSFR-GAN复现
  • 函数和数组
  • docker安装时报错:Error: Nothing to do
  • 白盒测试:覆盖测试及测试用例设计
  • Java高级开发2024高频面试提问题目
  • Kamailio openssl 3.0.x 需要注意的事项
  • SpringAMQP Work Queue 工作队列
  • 一分钟带你了解什么是等保测评
  • 宝塔面板怎么解决nginx跨域问题
  • Python 自动化脚本系列:第1集
  • 基于PHP开发的图片高清无损在线压缩源码系统 带完整源代码以及搭建教程
  • Linux提权--SUDO(CVE-2021-3156)Polkit(CVE-2021-4034)
  • nodejs里面的 http 模块介绍和使用
  • MVC框架简易实现【精细】
  • Java入门基础学习笔记18——赋值运算符