-10
我有以下代碼,我發現是VB.NET,我想稍微修改它,所以當它獲取PNG圖像時,它會選擇文件夾中最大的文件大小。任何幫助非常感謝!從文件夾中選擇圖像文件基於文件大小(選擇最大)
Imports system.data
imports system.io
imports system.windows.forms
Imports system.drawing
Private Sub xtraReport1_BeforePrint(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintEventArgs)
Dim ReportDS As system.data.dataset = CType(Report.DataSource,
System.Data.DataSet)
if CType(Report.DataSource, DataSet).Tables("Data").Rows.Count = 0 then
Exit Sub
End if
if CType(Report.DataSource,
DataSet).Tables("Data").columns.contains("CourierLabel") = false then
CType(Report.DataSource, DataSet).Tables("Data").columns.add("CourierLabel",
gettype(String))
end if
Dim ExportPath as string = SystemBusiness.Executescalarstr("select
cod_cdd_export_path from courier_detail where cod_id = " &
CType(Report.DataSource, DataSet).Tables("Data").rows(0).item("dh_cod_id"))
Dim DelNumber as string = CType(Report.DataSource,
DataSet).Tables("Data").rows(0).item("dh_number").tostring
Dim DelDate as string = cdate(CType(Report.DataSource,
DataSet).Tables("Data").rows(0).item("dh_datetime")).tostring("yyyy-MM-dd")
Dim DirPath as string = System.IO.Path.Combine(ExportPath, DelDate,
DelNumber)
'DirPath = "C:\temp"
For each f as string In Directory.GetFiles(DirPath)
if f.contains("png") Then
CType(Report.DataSource,
DataSet).Tables("Data").rows(0).item("CourierLabel") =
System.IO.Path.Combine(DirPath, f)
'messagebox.show(System.IO.Path.Combine(DirPath, f))
'system.windows.forms.messagebox.show(System.IO.Path.Combine(DirPath, f))
PictureBox1.Image = Image.FromFile(System.IO.Path.Combine(DirPath, f))
picturebox1.image.rotateflip(RotateFlipType.Rotate90FlipNone)
end if
Next
End Sub
我認爲這是VBA。它不是C或C++。 – NathanOliver
我很感興趣,看到一些語言標籤打開問題! – CinCout
謝謝,我認爲它會自動修復。希望有人能夠提供幫助。 – Tom