Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Client.Sample.ImageUploader.V4.5
Project
Overview
Details
Activity
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
陶然
Kivii.Client.Sample.ImageUploader.V4.5
Commits
2bbb2012
Commit
2bbb2012
authored
Jun 04, 2024
by
Neo Turing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
5ec7e266
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
20 deletions
+89
-20
FrmImageEditor.Designer.cs
Src/FrmImageEditor.Designer.cs
+11
-10
FrmImageEditor.cs
Src/FrmImageEditor.cs
+46
-3
FrmMain.Designer.cs
Src/FrmMain.Designer.cs
+0
-0
FrmMain.cs
Src/FrmMain.cs
+30
-5
AssemblyInfo.cs
Src/Properties/AssemblyInfo.cs
+2
-2
No files found.
Src/FrmImageEditor.Designer.cs
View file @
2bbb2012
...
...
@@ -50,10 +50,10 @@
this
.
plControl
.
Controls
.
Add
(
this
.
btnSave
);
this
.
plControl
.
Controls
.
Add
(
this
.
btnCancel
);
this
.
plControl
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Bottom
;
this
.
plControl
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
391
);
this
.
plControl
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
2
,
2
,
2
,
2
);
this
.
plControl
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
514
);
this
.
plControl
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
2
);
this
.
plControl
.
Name
=
"plControl"
;
this
.
plControl
.
Size
=
new
System
.
Drawing
.
Size
(
584
,
100
);
this
.
plControl
.
Size
=
new
System
.
Drawing
.
Size
(
748
,
100
);
this
.
plControl
.
TabIndex
=
0
;
//
// btnSave
...
...
@@ -65,7 +65,7 @@
this
.
btnSave
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
128
)))),
((
int
)(((
byte
)(
128
)))),
((
int
)(((
byte
)(
255
)))));
this
.
btnSave
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
btnSave
.
Name
=
"btnSave"
;
this
.
btnSave
.
Size
=
new
System
.
Drawing
.
Size
(
346
,
100
);
this
.
btnSave
.
Size
=
new
System
.
Drawing
.
Size
(
510
,
100
);
this
.
btnSave
.
TabIndex
=
5
;
this
.
btnSave
.
Text
=
"保存"
;
this
.
btnSave
.
UseVisualStyleBackColor
=
false
;
...
...
@@ -76,7 +76,7 @@
this
.
btnCancel
.
BackColor
=
System
.
Drawing
.
SystemColors
.
ButtonHighlight
;
this
.
btnCancel
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Right
;
this
.
btnCancel
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
25F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnCancel
.
Location
=
new
System
.
Drawing
.
Point
(
346
,
0
);
this
.
btnCancel
.
Location
=
new
System
.
Drawing
.
Point
(
510
,
0
);
this
.
btnCancel
.
Name
=
"btnCancel"
;
this
.
btnCancel
.
Size
=
new
System
.
Drawing
.
Size
(
238
,
100
);
this
.
btnCancel
.
TabIndex
=
4
;
...
...
@@ -91,16 +91,16 @@
this
.
plImage
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
plImage
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
plImage
.
Name
=
"plImage"
;
this
.
plImage
.
Size
=
new
System
.
Drawing
.
Size
(
584
,
391
);
this
.
plImage
.
Size
=
new
System
.
Drawing
.
Size
(
748
,
514
);
this
.
plImage
.
TabIndex
=
2
;
//
// imgResizer
//
this
.
imgResizer
.
BackColor
=
System
.
Drawing
.
Color
.
Transparent
;
this
.
imgResizer
.
Location
=
new
System
.
Drawing
.
Point
(
79
,
40
);
this
.
imgResizer
.
Location
=
new
System
.
Drawing
.
Point
(
151
,
11
);
this
.
imgResizer
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
2
);
this
.
imgResizer
.
Name
=
"imgResizer"
;
this
.
imgResizer
.
Size
=
new
System
.
Drawing
.
Size
(
430
,
307
);
this
.
imgResizer
.
Size
=
new
System
.
Drawing
.
Size
(
430
,
498
);
this
.
imgResizer
.
TabIndex
=
1
;
this
.
imgResizer
.
Text
=
"imgResizer"
;
//
...
...
@@ -108,15 +108,16 @@
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
584
,
491
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
748
,
614
);
this
.
Controls
.
Add
(
this
.
plImage
);
this
.
Controls
.
Add
(
this
.
plControl
);
this
.
Icon
=
((
System
.
Drawing
.
Icon
)(
resources
.
GetObject
(
"$this.Icon"
)));
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
2
,
2
,
2
,
2
);
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
2
);
this
.
MinimumSize
=
new
System
.
Drawing
.
Size
(
600
,
530
);
this
.
Name
=
"FrmImageEditor"
;
this
.
Text
=
"图片裁剪"
;
this
.
Load
+=
new
System
.
EventHandler
(
this
.
FrmImageEditor_Load
);
this
.
Resize
+=
new
System
.
EventHandler
(
this
.
FrmImageEditor_Resize
);
this
.
plControl
.
ResumeLayout
(
false
);
this
.
plImage
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
...
...
Src/FrmImageEditor.cs
View file @
2bbb2012
using
Kivii.Zip.Zlib
;
using
Kivii.Controls
;
using
Kivii.Zip.Zlib
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
...
...
@@ -15,6 +16,7 @@ namespace Kivii.Sample.ImageUploader
{
public
partial
class
FrmImageEditor
:
Form
{
private
float
_zoom
=
1f
;
public
FrmImageEditor
()
{
InitializeComponent
();
...
...
@@ -50,8 +52,9 @@ namespace Kivii.Sample.ImageUploader
private
void
FrmImageEditor_Load
(
object
sender
,
EventArgs
e
)
{
this
.
plImage
.
BackgroundImage
=
backgroundImage
;
this
.
plImage
.
BackgroundImageLayout
=
ImageLayout
.
Center
;
this
.
plImage
.
BackgroundImageLayout
=
ImageLayout
.
Zoom
;
ImgEdited
=
backgroundImage
;
resizePictureBox
();
}
private
void
btnCancel_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -98,6 +101,43 @@ namespace Kivii.Sample.ImageUploader
timeImageEditor
.
Enabled
=
true
;
}
#
region
窗口大小发生变化
protected
override
void
OnResize
(
EventArgs
e
)
{
base
.
OnResize
(
e
);
resizePictureBox
();
}
private
void
resizePictureBox
()
{
if
(
plImage
.
BackgroundImage
==
null
)
return
;
int
width
,
height
;
if
(
_zoom
==
0f
)
{
float
wzoom
=
(
float
)
plImage
.
Width
/
(
float
)
plImage
.
BackgroundImage
.
Width
;
float
hzoom
=
(
float
)
plImage
.
Height
/
(
float
)
plImage
.
BackgroundImage
.
Height
;
_zoom
=
wzoom
<
hzoom
?
wzoom
:
hzoom
;
}
else
if
(
_zoom
>
5f
)
_zoom
=
5f
;
else
if
(
_zoom
<
0.1f
)
_zoom
=
0.1f
;
width
=
(
int
)((
float
)
plImage
.
BackgroundImage
.
Width
*
_zoom
);
height
=
(
int
)((
float
)
plImage
.
BackgroundImage
.
Height
*
_zoom
);
plImage
.
Width
=
width
;
plImage
.
Height
=
height
;
int
x
,
y
;
if
(
plImage
.
Width
<=
width
)
x
=
0
;
else
x
=
(
plImage
.
Width
-
width
)
/
2
;
if
(
plImage
.
Height
<=
height
)
y
=
0
;
else
y
=
(
plImage
.
Height
-
height
)
/
2
;
plImage
.
Location
=
new
System
.
Drawing
.
Point
(
x
,
y
);
// 计算控件在父容器中居中的位置
int
xi
=
(
imgResizer
.
Parent
.
Width
-
imgResizer
.
Width
)
/
2
;
int
yi
=
(
imgResizer
.
Parent
.
Height
-
imgResizer
.
Height
)
/
2
;
imgResizer
.
Location
=
new
System
.
Drawing
.
Point
(
xi
,
yi
);
}
#
endregion
public
static
GraphicsPath
createRoundRect
(
int
x
,
int
y
,
int
width
,
int
height
,
int
radius
)
{
...
...
@@ -208,6 +248,9 @@ namespace Kivii.Sample.ImageUploader
}
private
void
FrmImageEditor_Resize
(
object
sender
,
EventArgs
e
)
{
resizePictureBox
();
}
}
}
Src/FrmMain.Designer.cs
View file @
2bbb2012
This diff is collapsed.
Click to expand it.
Src/FrmMain.cs
View file @
2bbb2012
...
...
@@ -122,6 +122,7 @@ namespace Kivii.Sample.ImageUploader
btnDelete
.
Enabled
=
!
notLogin
;
btnEditor
.
Enabled
=
!
notLogin
;
btnLogout
.
Enabled
=
!
notLogin
;
btnCamearTurn
.
Enabled
=
!
notLogin
;
if
(
notLogin
)
{
...
...
@@ -140,6 +141,8 @@ namespace Kivii.Sample.ImageUploader
//lbCurrentSampleQuantity.Text = "__________";
ptbPhotoDisplay
.
Image
=
null
;
flpPhotos
.
Controls
.
Clear
();
currentReport
=
null
;
currentPhoto
=
null
;
}
else
{
...
...
@@ -167,7 +170,9 @@ namespace Kivii.Sample.ImageUploader
foreach
(
var
prop
in
properties
)
{
if
(
prop
.
GetDescription
().
IsNullOrEmpty
())
continue
;
var
msg
=
$"
{
prop
.
GetDescription
()}
:
{
prop
.
GetValue
(
currentReport
)}
"
;
var
value
=
prop
.
GetValue
(
currentReport
);
if
(
value
==
null
)
continue
;
var
msg
=
$"
{
prop
.
GetDescription
()}
:
{
value
}
"
;
outputMessage
(
msg
);
}
...
...
@@ -493,9 +498,13 @@ namespace Kivii.Sample.ImageUploader
{
if
(
resp
.
Results
.
IsNullOrEmpty
())
{
MessageBox
.
Show
(
$"未找到此编号:
{
reportId
}
"
);
//
MessageBox.Show($"未找到此编号:{reportId}");
tbxReportId
.
Text
=
""
;
currentReport
=
null
;
currentReport
=
new
Report
();
currentReport
.
ReportId
=
reportId
;
currentReport
.
SampleName
=
"无样品报告模式"
;
currentReport
.
SampleModel
=
"此模式下上传的图片可在公共图片库中查看"
;
}
else
{
...
...
@@ -924,8 +933,9 @@ namespace Kivii.Sample.ImageUploader
Bitmap
bmp
=
currentPhoto
.
Image
;
frm
.
backgroundImage
=
bmp
;
frm
.
Width
=
bmp
.
Width
;
frm
.
Height
=
bmp
.
Height
+
120
;
frm
.
WindowState
=
FormWindowState
.
Maximized
;
//frm.Width= bmp.Width;
//frm.Height = bmp.Height + 120;
frm
.
Owner
=
this
;
frm
.
ShowDialog
();
...
...
@@ -947,5 +957,20 @@ namespace Kivii.Sample.ImageUploader
addSnapshot
(
editedPhoto
,
index
);
showSnapshot
(
editedPhoto
);
}
private
void
btnEnabled_EnabledChanged
(
object
sender
,
EventArgs
e
)
{
if
(
btnShot
.
Enabled
)
btnShot
.
BackColor
=
Color
.
White
;
else
btnShot
.
BackColor
=
SystemColors
.
ButtonFace
;
if
(
btnEditor
.
Enabled
)
btnEditor
.
BackColor
=
Color
.
White
;
else
btnEditor
.
BackColor
=
SystemColors
.
ButtonFace
;
if
(
btnDelete
.
Enabled
)
btnDelete
.
BackColor
=
Color
.
White
;
else
btnDelete
.
BackColor
=
SystemColors
.
ButtonFace
;
if
(
btnUpload
.
Enabled
)
btnUpload
.
BackColor
=
Color
.
White
;
else
btnUpload
.
BackColor
=
SystemColors
.
ButtonFace
;
if
(
btnCamearTurn
.
Enabled
)
btnCamearTurn
.
BackColor
=
Color
.
White
;
else
btnCamearTurn
.
BackColor
=
SystemColors
.
ButtonFace
;
}
}
}
Src/Properties/AssemblyInfo.cs
View file @
2bbb2012
...
...
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2024.
530
0")]
[assembly: AssemblyFileVersion("5.4.2024.
530
0")]
[assembly: AssemblyVersion("5.4.2024.
604
0")]
[assembly: AssemblyFileVersion("5.4.2024.
604
0")]
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