[英]Get thumbnail of Network DWG file by Windows API Code Pack
I use the below code to get the DWG file thumbnail using the Windows API Code Pack: 我使用以下代码通过Windows API代码包获取DWG文件缩略图:
ShellFile shellFile = ShellFile.FromFilePath(mediaInfo.Filename);
return shellFile.Thumbnail.LargeBitmap;
But this works for local DWG files only, and returns the blank document thumbnails for network based files. 但这仅适用于本地DWG文件,并返回基于网络的文件的空白文档缩略图。
However I see the thumbnails of network files via the Windows Explorer (I am on Win 8.1). 但是,我可以通过Windows资源管理器看到网络文件的缩略图(我在Win 8.1上)。
Any advice would be appreciated. 任何意见,将不胜感激。
There must be something wrong happening on your side because the following code works here: 您的身边一定有什么问题,因为以下代码在这里起作用:
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Microsoft.WindowsAPICodePack.Shell;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string fileName = @"\\PC\Users\Public\bitmap.bmp";
ShellFile shellFile = ShellFile.FromFilePath(fileName);
ShellThumbnail thumbnail = shellFile.Thumbnail;
var pictureBox = new PictureBox
{
Image = thumbnail.Bitmap,
Dock = DockStyle.Fill
};
Controls.Add(pictureBox);
}
}
}
Check the following: 检查以下内容:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.