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的变量,保存图片的路径,到那个窗口直接用就行了

Raksmart:香港高防服务器/20Mbps带宽(cn2+bgp)/40G-100Gbps防御

RAKsmart怎么样?RAKsmart香港机房新增了付费的DDoS高防保护服务,香港服务器默认接入20Mbps的大陆优化带宽(电信走CN2、联通和移动走BGP)。高防服务器需要在下单页面的IP Addresses Option里面选择购买,分:40Gbps大陆优化高防IP-$461/月、100Gbps国际BGP高防IP-$692/月,有兴趣的可以根据自己的需求来选择!点击进入:RAKsmart官...

数脉科技:六月优惠促销,免备案香港物理服务器,E3-1230v2处理器16G内存,350元/月

数脉科技六月优惠促销发布了!数脉科技对香港自营机房的香港服务器进行超低价促销,可选择30M、50M、100Mbps的优质bgp网络。更大带宽可在选购时选择同样享受优惠,目前仅提供HKBGP、阿里云产品,香港CN2、产品优惠码续费有效,仅限新购,每个客户可使用于一个订单。新客户可以立减400元,或者选择对应的机器用相应的优惠码,有需要的朋友可以尝试一下。点击进入:数脉科技官方网站地址数脉科技是一家成...

2021年全新Vultr VPS主机开通云服务器和选择机房教程(附IP不通问题)

昨天有分享到"2021年Vultr新用户福利注册账户赠送50美元"文章,居然还有网友曾经没有注册过他家的账户,薅过他们家的羊毛。通过一阵折腾居然能注册到账户,但是对于如何开通云服务器稍微有点不对劲,对于新人来说确实有点疑惑。因为Vultr采用的是预付费充值方式,会在每月的一号扣费,当然我们账户需要存留余额或者我们采用自动扣费支付模式。把笔记中以前的文章推送给网友查看,他居然告诉我界面不同,看的不对...

picturebox为你推荐
订房系统什么是酒店客房控制系统?中国学生网如何在中国高等教育学生信息网填学生信息郭列90后的杰出代表有那些?renderpartialrenderHtml和render有什么区别shoujiao手机板aoblox怎么从英文变成中文gbk内码Gbk内码查询怎么查微信注册时间怎么知道微信上次登录时间在线沟通什么是在线状态?泛微协同办公系统泛微软件怎么样?做协同办公的,我要来这做销售前景怎么样?请大家对这个行业或公司了解的给些建议。元宝汇传奇续章开了几个区?
arvixe 国外服务器 圣迭戈 哈喽图床 tightvnc 国外空间 e蜗牛 web服务器的架设 网站卫士 卡巴斯基试用版 绍兴电信 电信主机 能外链的相册 免费的asp空间 中国域名 lamp怎么读 服务器托管价格 开心online windowsserver2012r2 空间排行榜 更多