pictureboxc#如何在picturebox上显示图片

picturebox  时间:2021-06-17  阅读:()

(c#)操作picturebox

当然是通过定义边界了,Rectangle类,在mousemove事件中判断是否移到边界,下面给你一些简单的代码,具体实现还要看你自己,当然要实现扭曲旋转这种效果,要用到GDI+ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { Point postion = new Point(100,100); //显示图片的左上角位置 Size size = new Size(100,100); //图片显示大小 //定义四个区域 Rectangle LeftTop; //左上 Rectangle RightTop; //右上 Rectangle LeftBottom; //左下 Rectangle RightBottom; //右下 public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { LeftTop = new Rectangle(postion.X, postion.Y, 5, 5); RightTop = new Rectangle(postion.X + size.Width - 5, postion.Y, 5, 5); LeftBottom = new Rectangle(postion.X, postion.Y + size.Height - 5, 5, 5); RightBottom = new Rectangle(postion.X + size.Width - 5, postion.Y + size.Height - 5, 5, 5); } //在Paint事件中,画出图形 private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Brush brush = new SolidBrush(Color.Blue); g.FillRectangle(brush, postion.X, postion.Y, size.Width, size.Height); } private void Form1_MouseMove(object sender, MouseEventArgs e) { if (LeftTop.Contains(e.Location) || RightTop.Contains(e.Location) || LeftBottom.Contains(e.Location) || RightBottom.Contains(e.Location)) { Cursor.Current = Cursors.Hand; } } } }

picturebox 怎样显示文字

利用c#的GDI+技术,PictureBox.CreateGraphics()绘图,利用g.DrawString写文字。

利用this.Invalidate()刷新Form窗体,或者利用PictureBox.Invalidate()刷新PictureBox.。

代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace CCDTest { public partial class Form1 : Form { string filename; //Label lblResult; public Form1() { InitializeComponent(); filename = Application.StartupPath + ""; } private void Form1_Load(object sender, EventArgs e) { pbCCD.Load(filename); } private void pbCCD_MouseDown(object sender, MouseEventArgs e) { PointF pf = e.Location; using (Graphics g = pbCCD.CreateGraphics()) { Console.WriteLine("Beg MyDraw...."); Font f = new Font("Arial", 12); g.DrawString("Hello!", f, Brushes.Violet, pf); Console.WriteLine("End MyDraw....."); } } private void pbCCD_MouseUp(object sender, MouseEventArgs e) { pbCCD.Invalidate(); } } }

c#如何在picturebox上显示图片

看你在哪个窗口里执行了,要是就在当前窗口,那就把别的窗口那个picturebox的modifier属性设置成public,然后直接设置就行了,要是在别的窗口,就定义一个public的变量,保存图片的路径,到那个窗口直接用就行了

CUBECLOUD:香港服务器、洛杉矶服务器、全场88折,69元/月

CUBECLOUD(魔方云)成立于2016年,亚太互联网络信息中心(APNIC)会员,全线产品均为完全自营,专业数据灾备冗余,全部产品均为SSD阵列,精品网络CN2(GIA) CU(10099VIP)接入,与当今主流云计算解决方案保持同步,为企业以及开发者用户实现灵活弹性自动化的基础设施。【夏日特促】全场产品88折优惠码:Summer_2021时间:2021年8月1日 — 2021年8月8日香港C...

RAKsmart:美国圣何塞服务器限量秒杀$30/月起;美国/韩国/日本站群服务器每月189美元起

RAKsmart怎么样?RAKsmart是一家由华人运营的国外主机商,提供的产品包括独立服务器租用和VPS等,可选数据中心包括美国加州圣何塞、洛杉矶、中国香港、韩国、日本、荷兰等国家和地区数据中心(部分自营),支持使用PayPal、支付宝等付款方式,网站可选中文网页,提供中文客服支持。本月商家继续提供每日限量秒杀服务器月付30.62美元起,除了常规服务器外,商家美国/韩国/日本站群服务器、1-10...

香港E3 16G 390元/ 香港E5*2 32G 600元/ 香港站群 4-8C 1200元/ 美国200G高防 900/ 日本100M 700元

3C云国内IDC/ISP资质齐全商家,与香港公司联合运营, 已超6年运营 。本次为大家带来的是双12特惠活动,香港美国日本韩国|高速精品|高防|站群|大带宽等产品齐全,欢迎咨询问价。3C云科技有限公司官方网站:http://www.3cccy.com/客服QQ:937695003网页客服:点击咨询客户QQ交流群:1042709810价目表总览升级内存 60元 8G内存升级硬盘 1T机械 90元 2...

picturebox为你推荐
ipv6电视什么是ipv6网络电视 有什么好处windowsmedia电脑的大部分软件打开方式变为了Windows media centeravc是什么格式电厂AVC啥意思?暴力破解rar求暴力破解rar压缩包软件shoujiao手机板aoblox怎么从英文变成中文za是哪个国家的IE是哪个国家的缩写yui3YUI最详细的资料爱码验证码平台接码验证码接收平台如何使用?云家政网腾讯网的网址是多少?手机在线客服vivo人工客服电话多少
短域名 西安服务器租用 com域名价格 vps代购 腾讯云盘 bandwagonhost rackspace unsplash anylink admit的用法 稳定免费空间 免备案cdn加速 97rb 腾讯服务器 免费网站加速 电脑主机声音大 qq空间打开慢 元旦促销方案 北京共有产权房申请网站 lickme 更多