小程序里的图标怎么转出来

小程序里的图标怎么转出来,第1张

答案如下。首先需要把微老滚迅信升级到最侍此新版本。在最上方的搜索框里搜索“小程序示例”,然后进入最上面的备渣S形图标,此时已经成功的把小程序接入了微信中。在微信的“发现”栏里就可以死...

这些问题……看我这个网址吧,MSDN这么大个库你却来百度问

http://social.msdn.microsoft.com/Forums/zh-CN/visualcshartzhchs/thread/c08fd375-e269-4c4b-af19-974e03cacee6/

using System

using System.Collections.Generic

using System.ComponentModel

using System.Data

using System.Drawing

using System.Text

using System.Windows.Forms

using System.Runtime.InteropServices

using System.IO

namespace WindowsApplication1

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent()

}

[StructLayout(LayoutKind.Sequential)]

public struct SHFILEINFO

{

public IntPtr hIcon

public IntPtr iIcon

public uint dwAttributes

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]

public string szDisplayName

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]

public string szTypeName

}

class Win32

{

public const uint SHGFI_ICON = 0x100

public const uint SHGFI_LARGEICON = 0x0// 'Large icon

public const uint SHGFI_SMALLICON = 0x1// 'Small icon

[DllImport("shell32.dll")]

public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags)

[DllImport("shell32.dll")]

public static extern uint ExtractIconEx(string lpszFile, int nIconIndex, int[] phiconLarge, int[] phiconSmall, uint nIcons)

}

private void button1_Click(object sender, EventArgs e)

{

openFileDialog1.ShowDialog()

SHFILEINFO shinfo = new SHFILEINFO()

Win32.SHGetFileInfo(openFileDialog1.FileName, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON)

Icon myIcon = Icon.FromHandle(shinfo.hIcon)

FileStream fileStream = new FileStream("E:\\1.ico",FileMode.Create)

myIcon.Save(fileStream)

fileStream.Close()

}

}

}

拿分了,哈哈


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/12341613.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存