Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
d6fb6d7f
Commit
d6fb6d7f
authored
Mar 04, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生成图片测试
parent
d5ab13b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
Program.cs
Test/Program.cs
+52
-1
Test.csproj
Test/Test.csproj
+1
-0
No files found.
Test/Program.cs
View file @
d6fb6d7f
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.IO
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
...
...
@@ -11,9 +13,58 @@ namespace Test
static
void
Main
(
string
[]
args
)
{
Console
.
WriteLine
(
"Start......"
);
Helper
.
FreightRulesHelper
.
GetData
();
//Helper.FreightRulesHelper.GetData();
//Test();
Console
.
WriteLine
(
"End......"
);
Console
.
ReadLine
();
}
public
class
FileModel
{
public
int
Id
{
get
;
set
;
}
public
string
FilePath
{
get
;
set
;
}
}
public
static
void
Test
()
{
//获取到pic下面的jpg图片
List
<
FileModel
>
fileList
=
new
List
<
FileModel
>();
string
[]
rs
=
System
.
IO
.
Directory
.
GetFiles
(
@"C:\Users\qiaoyajun\Desktop\ppt"
,
"*.png"
);
foreach
(
var
item
in
rs
)
{
var
fileName
=
System
.
IO
.
Path
.
GetFileNameWithoutExtension
(
item
);
Int32
.
TryParse
(
fileName
,
out
int
FileNum
);
var
fileModel
=
new
FileModel
()
{
Id
=
FileNum
,
FilePath
=
item
};
fileList
.
Add
(
fileModel
);
}
var
newFileList
=
fileList
.
OrderBy
(
qitem
=>
qitem
.
Id
).
ToList
();
//最大宽度和高度
int
maL
=
959
,
totalH
=
18292
;
Bitmap
map
=
new
Bitmap
(
maL
,
totalH
);
//定义画布
Graphics
g
=
Graphics
.
FromImage
(
map
);
//定义画笔
g
.
Clear
(
Color
.
White
);
//把画布更改为白色
int
y
=
0
;
//y轴坐标
for
(
int
i
=
0
;
i
<
newFileList
.
Count
;
i
++)
{
Image
image
=
Image
.
FromStream
(
new
System
.
IO
.
MemoryStream
(
File
.
ReadAllBytes
(
newFileList
[
i
].
FilePath
)));
g
.
DrawImage
(
image
,
new
Point
(
0
,
y
));
y
=
y
+
538
;
//y的告诉 5是为了让画布有个缝隙
}
//把合并的图片进行保存为jpg格式
map
.
Save
(
@"C:\Users\qiaoyajun\Desktop\HK\1.jpg"
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
);
for
(
int
i
=
0
;
i
<
rs
.
Length
;
i
++)
{
//删除原先的2个jpg图片
//File.Delete(rs[i]);
}
}
}
}
Test/Test.csproj
View file @
d6fb6d7f
...
...
@@ -58,6 +58,7 @@
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Configuration"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Drawing"
/>
<Reference
Include=
"System.Xml.Linq"
/>
<Reference
Include=
"System.Data.DataSetExtensions"
/>
<Reference
Include=
"Microsoft.CSharp"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment