Private Sub Command1_Click()

讓客戶(hù)滿(mǎn)意是我們工作的目標(biāo),不斷超越客戶(hù)的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶(hù),將通過(guò)不懈努力成為客戶(hù)在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名申請(qǐng)、網(wǎng)絡(luò)空間、營(yíng)銷(xiāo)軟件、網(wǎng)站建設(shè)、正定網(wǎng)站維護(hù)、網(wǎng)站推廣。
Dim sf As Object
Set sf = CreateObject("Shell.Application").BrowseForFolder(0, "選擇文件夾", 0, "")
If Not sf Is Nothing Then
MsgBox "選擇的文件夾是" vbCrLf sf.self.Path
End If
Set sf = Nothing
End Sub
XPS文件格式經(jīng)常在文件處理應(yīng)用程序中使用。您可以在基于.NET Framework的應(yīng)用程序中使用C#或VB.NET以編程方式將XPS或OXPS轉(zhuǎn)換為JPG或PNG圖像。
讓我們逐步介紹以下方案,以了解有關(guān)XPS轉(zhuǎn)換的更多信息:
使用C#或VB.NET將XPS,OXPS轉(zhuǎn)換為JPG圖像
使用C#或VB.NET將XPS,OXPS轉(zhuǎn)換為PNG圖像
目前,.NET版Aspose.page升級(jí)到v20.10版,感興趣的朋友可點(diǎn)擊下載
使用C#或VB.NET將XPS,OXPS轉(zhuǎn)換為JPG圖像
JPG文件之所以出名是因?yàn)樗鼈冊(cè)谒邢到y(tǒng)環(huán)境中均受支持。您可以使用C#或VB.NET以編程方式將XPS或OXPS文件轉(zhuǎn)換為JPG圖像。對(duì)于XPS或OXPS到JPG圖像的轉(zhuǎn)換,應(yīng)遵循以下步驟:
加載輸入XPS或OXPS文件
初始化JpegSaveOptions對(duì)象
指定要渲染的SmoothingMode,Resolution和PageNumbers
保存輸出的JPG圖像
以下代碼顯示了如何使用C#語(yǔ)言將XPS或OXPS轉(zhuǎn)換為JPG圖像:
// Input file
string inputFileName = dataDir + "input.xps";
//Output file
string outputFileName = dataDir + "XPStoImage_out.jpeg";
// Initialize XPS input stream
using (Stream xpsStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read))
{
// Load XPS document form the stream
XpsDocument document = new XpsDocument(xpsStream, new XpsLoadOptions());
// or load XPS document directly from file. No xpsStream is needed then.
// XpsDocument document = new XpsDocument(inputFileName, new XpsLoadOptions());
// Initialize options object with necessary parameters.
JpegSaveOptions options = new JpegSaveOptions()
{
SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality,
Resolution = 300
};
// Create rendering device for JPG format
ImageDevice device = new ImageDevice();
document.Save(device, options);
// Iterate through document partitions (fixed documents, in XPS terms)
for (int i = 0; i device.Result.Length; i++) // Iterate through partition pages for (int j = 0; j device.Result[i].Length; j++) { // Initialize image output stream using (Stream imageStream = System.IO.File.Open(Path.GetDirectoryName(outputFileName) + Path.GetFileNameWithoutExtension(outputFileName) + "_" + (i + 1) + "_" + (j + 1) + Path.GetExtension(outputFileName), System.IO.FileMode.Create, System.IO.FileAccess.Write)) // Write image imageStream.Write(device.Result[i][j], 0, device.Result[i][j].Length); } }
使用C#或VB.NET將XPS,OXPS轉(zhuǎn)換為PNG圖像
可能需要使用C#或VB.NET和Aspose.Page for .NET API將XPS或OXPS文件轉(zhuǎn)換為PNG。您需要按照以下步驟將XPS轉(zhuǎn)換為PNG:
加載輸入XPS或OXPS文件
初始化PngSaveOptions對(duì)象
設(shè)置圖像分辨率或頁(yè)面編號(hào)為渲染
保存輸出的PNG圖像
System.Windows.Forms.OpenFileDialog
System.Windows.Forms.SaveFileDialog
System.Windows.Forms.FolderBrowserDialog
以上三個(gè)類(lèi)均能夠很好的解決樓主的需求。
具體的請(qǐng)lz自己查msdn
vb.net使用控件FolderBrowserDialog1,在程序中:
'設(shè)置對(duì)話框中在樹(shù)視圖控件上顯示的說(shuō)明文本
Me.FolderBrowserDialog1.Description
=
"請(qǐng)選擇輸出報(bào)表所在路徑:"
'設(shè)置從其開(kāi)始瀏覽的根文件夾
Me.FolderBrowserDialog1.SelectedPath
=
"c:\"
If
Me.FolderBrowserDialog1.ShowDialog()
=
DialogResult.OK
Then
'取得全路徑(包含文件名)
reportPath1
=
System.IO.Path.GetFullPath(Me.FolderBrowserDialog1.SelectedPath)
'設(shè)定text顯示文件名
txtReport1.Text
=
reportPath1
setReportList()
End
If
在setReportList()中針對(duì)你所需要的文件進(jìn)行操作等
分享名稱(chēng):vb.net打開(kāi)文件夾,vb 打開(kāi)文件夾
本文地址:http://www.chinadenli.net/article38/heohsp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、網(wǎng)頁(yè)設(shè)計(jì)公司、網(wǎng)站收錄、網(wǎng)站維護(hù)、微信公眾號(hào)、虛擬主機(jī)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)