使用 C# 中的文本框中的文本保存位图
我希望能够使用文本文件中的文本保存位图图像,这样当我打开它时,文本和位图文件都会打开,并且可以在以后查看。这是我当前用于保存位图图像的代码:
{
//Show a save dialog to allow the user to specify where to save the image file
using (SaveFileDialog dlgSave = new SaveFileDialog())
{
dlgSave.Title = "Save Image";
dlgSave.Filter = "Bitmap Images (*.bmp)|*.bmp|All Files (*.*)|*.*";
if (dlgSave.ShowDialog(this) == DialogResult.OK)
{
//If user clicked OK, then save the image into the specified file
using (Bitmap bmp = new Bitmap(capturebox.Width, capturebox.Height))
{
capturebox.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
bmp.Save(dlgSave.FileName);
}
}
}
}
所以我需要它将文本保存在名为 ExtraNotes 的标签中,然后能够再次打开图片框(捕获框)中的图像和标签中的文本。请帮忙,
谢谢
I want to be able to save a bitmap image with text from a text file so when i open it both the text and bitmap file open and can be viewed at a later date. This is my current code for saving a bitmap image:
{
//Show a save dialog to allow the user to specify where to save the image file
using (SaveFileDialog dlgSave = new SaveFileDialog())
{
dlgSave.Title = "Save Image";
dlgSave.Filter = "Bitmap Images (*.bmp)|*.bmp|All Files (*.*)|*.*";
if (dlgSave.ShowDialog(this) == DialogResult.OK)
{
//If user clicked OK, then save the image into the specified file
using (Bitmap bmp = new Bitmap(capturebox.Width, capturebox.Height))
{
capturebox.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
bmp.Save(dlgSave.FileName);
}
}
}
}
So i need it to save the text in a label called ExtraNotes and then be able to open the image in the picturebox (capturebox) and the text in the label again. Please Help,
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这将绘制一个粗略的文本(你可以使它更漂亮):
只需调用
This will draw a rough text (you can make it prettier):
Just call