如何使用 Telerik 检索放入 RadImageEditor 中的图像

发布于 2025-01-09 01:04:26 字数 321 浏览 5 评论 0原文

所以我使用的是 Telerik Framework,这就是打开 Image 并传递给 RadImageEditor 时使用的内容。但我的问题是,当我完成编辑后,我想再次将图像传递到 PictureBox 而不是将其保存到本地。

我用于将 Image 传递给 RadImageEditor 的是:

radImageEditor1.OpenImage((Bitmap)e.Data.GetData(typeof(Bitmap)));< /code>

有人可以帮助我吗?谢谢

So I was using Telerik Framework and this is what is used when opening Image and pass to RadImageEditor. But my problem is that when I finished editing, I want to pass again the image to the PictureBox and not save it to the Local.

What I used for passing the Image to RadImageEditor is this:

radImageEditor1.OpenImage((Bitmap)e.Data.GetData(typeof(Bitmap)));

Is there anyone who help me? Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ぺ禁宫浮华殁 2025-01-16 01:04:26

工具栏上的保存按钮会触发一个事件,为您提供当前图像。您也可以使用客户端 API 调用它

The save button on the toolbar fires an event that will give you the current image. You can invoke that with the client side API too

此岸叶落 2025-01-16 01:04:26

您需要的一切都在 RadImageEditor ImageSaving 事件传递的参数中。但是你必须小心,因为它会返回一个名为“Image”的属性,这会导致猜测它是图像本身,而它只是一个拥有图像的类(以及其他数据,如宽度、高度等) 。我花了一段时间才弄清楚。

因此,在以下代码中:

Protected Sub RadImageEditor1_ImageSaving(sender As Object, e As ImageEditorSavingEventArgs)
    Dim imgw As Integer = e.Image.Width
    Dim imgh As Integer = e.Image.Height

    Dim theimage As New System.Drawing.Bitmap(e.Image.Image, imgw, imgh)

    Dim stream As New System.IO.MemoryStream
    theimage.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg)
    stream.Position = 0
    Dim Image(stream.Length) As Byte
    stream.Read(Image, 0, stream.Length)
End Sub

请注意,在函数的第三行中,图像参数不在 e.Image 中,而是在 e.Image.Image 中。

Everything you need is in the args passed by the RadImageEditor ImageSaving event. However you must be carefull because it will return a property called "Image" that induct to guess that it is the image itself, while it is just a class that owns the image (as well other data such as its width, height, etc). It took me a while to figure it out.

So in the following code:

Protected Sub RadImageEditor1_ImageSaving(sender As Object, e As ImageEditorSavingEventArgs)
    Dim imgw As Integer = e.Image.Width
    Dim imgh As Integer = e.Image.Height

    Dim theimage As New System.Drawing.Bitmap(e.Image.Image, imgw, imgh)

    Dim stream As New System.IO.MemoryStream
    theimage.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg)
    stream.Position = 0
    Dim Image(stream.Length) As Byte
    stream.Read(Image, 0, stream.Length)
End Sub

Notice in the third line of the function the image parameter is not in e.Image but in e.Image.Image.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文