在图片框内添加图片 [英] Append a picture within picturebox

查看:98
本文介绍了在图片框内添加图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将图片添加到图片框时遇到问题.
有一个面板,其中包含FORMNAME-文本框,FORM-Picturebox.保存按钮.
在菜单栏中,我有一个组合框,用于显示已保存在数据库中的图片模板的名称.如果选择其中之一,则其对应的图像将出现在PictureBox中.

以上所有方法都运行良好. 我一直想做的是,如果我在组合框中打开项目,则要附加一个签名生成的图像(也可能是图片). 我有一个特定的位置将其放置在FORM图片中,但我不能将其放置在此处,因为vb.design仅显示了将FORM放置在其中的Panel和Picturebox(自动缩放).

有人有主意吗?请帮帮我.

我可以在vb中提供该项目,以便您可以了解我的问题,我无法在此处上传它..

Hi, i have a problem regarding appending a picture within a picturebox.
There is a a panel, that contains FORMNAME-textbox, FORM-Picturebox. Save-button.
in the menu strip, I have a combobox that displays the names of the picture-templates that have been saved in database. If you choose one of them, its corresponding image appears in the PictureBox.

all of the above is working well. What i have been trying to do is to append a generated image from a signature(that would be a picture too) if i opened the items in the combobox. I have a specific place where to put it in the FORM-picture but i cant put it there because the vb.design only show the Panel and the Picturebox(which is Auto SIzed btw) in which i put the FORM.

anyone have an idea? please help me.

I can give the project in vb so that you can see what my problem is, i cant upload it here..

推荐答案

帮个忙,不要虐待自己滥用PictureBox.这是一个非常常见的错误.

此控件只适合做一些非常简单的事情,例如仅显示一张图片(嗯,也许可以更改它,但不经常更改).当您尝试做一些更棘手的事情(例如动态,交互,动画等)时,事实证明,这更多的是障碍,而不是帮助,这会占用您的开发时间,计算机性能和额外的资源,但没有任何有用的回报.

比起什么?对于从System.Windows.Forms.Control派生的自定义控件,该控件具有在事件Paint的处理程序中呈现的图形,或者更好的是,重写了虚拟方法OnPaint.

我会解释过去的答案:
如何从旧图纸中清除面板 [ ^ ],
在C#中绘制矩形 [ Paint是一种哪种好玩的方法? (DataGridViewImageCell.Paint(...)) [在mdi子表单之间画线 [在面板上捕获图形 [
Do yourself a favor, don''t torture yourself abusing PictureBox. This is a very usual mistake.

This control is only good to do something very simple, like showing just one picture (well, maybe changing it, but not often). When you try to do anything more tricky, such as dynamic, interactive, animated, etc., it turns out to be more of an obstacle then a help, eating up your development time, computer performance and extra resources, giving nothing useful in return.

Compared to what? To a custom control derived from System.Windows.Forms.Control with graphics rendered in the handler of the event Paint, or, better yet, overridden virtual method OnPaint.

I explain how in my past answers:
How do I clear a panel from old drawing[^],
draw a rectangle in C#[^].

See also other answers:
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^].

—SA


这篇关于在图片框内添加图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆