将System.Drawing.Bitmap转换为stdole.StdPicture [英] Convert System.Drawing.Bitmap to stdole.StdPicture

查看:434
本文介绍了将System.Drawing.Bitmap转换为stdole.StdPicture的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个System.Drawing.Bitmap,我需要将其转换为stdole.StdPicture.
目前,我正在使用:

I have a System.Drawing.Bitmap currently and I need to convert it into an stdole.StdPicture.
Currently I'm using:

var pic = (stdole.StdPicture)Microsoft.VisualBasic.Compatibility.VB6.Support.ImageToIPicture
                   (MyDLL.Properties.Resources.Img); // this is a System.Drawing.Bitmap

但是我收到了编译器警告:

but I get a Compiler Warning:

警告'Microsoft.VisualBasic.Compatibility.VB6.Support.ImageToIPicture(System.Drawing.Image)'已过时:'"Microsoft.VisualBasic.Compatibility.*类已过时,仅在32位进程中受支持. ="http://go.microsoft.com/fwlink/?linkid=160862"> http://go.microsoft.com/fwlink/?linkid=160862

那该怎么用呢?我还找不到其他解决方案...

So what to use instead? I couldn't find another solution yet...

推荐答案

取自NetOffice http://netoffice.codeplex.com Office插件示例

taken from NetOffice http://netoffice.codeplex.com Office Addin Example

public class IconConverter : System.Windows.Forms.AxHost
{
   private IconConverter(): base(string.Empty)
   {
   }

   public static stdole.IPictureDisp GetIPictureDispFromImage(System.Drawing.Image image)
   {

      return (stdole.IPictureDisp)GetIPictureDispFromPicture(image);
   }
} 

这篇关于将System.Drawing.Bitmap转换为stdole.StdPicture的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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