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
4cf4d563
Commit
4cf4d563
authored
Jun 25, 2024
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
e124ac10
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
60 deletions
+102
-60
FrmMain.Designer.cs
Src/FrmMain.Designer.cs
+38
-27
FrmMain.cs
Src/FrmMain.cs
+64
-33
No files found.
Src/FrmMain.Designer.cs
View file @
4cf4d563
...
@@ -48,7 +48,6 @@
...
@@ -48,7 +48,6 @@
this
.
cbxResolution
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
cbxResolution
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
btnSwitch
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnSwitch
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
plVsp
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
plVsp
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
vspCamView
=
new
Kivii
.
Sample
.
ImageUploader
.
Controls
.
VideoSourcePlayer
();
this
.
plRight
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
plRight
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
gbPhotoList
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
gbPhotoList
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
flpPhotos
=
new
System
.
Windows
.
Forms
.
FlowLayoutPanel
();
this
.
flpPhotos
=
new
System
.
Windows
.
Forms
.
FlowLayoutPanel
();
...
@@ -56,7 +55,7 @@
...
@@ -56,7 +55,7 @@
this
.
btnUpload
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnUpload
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
plMain
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
plMain
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
gbPhotoView
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
gbPhotoView
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
p
tbPhotoDisplay
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
p
anel1
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
plDisplay
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
plDisplay
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
cbxTurn
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
cbxTurn
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
btnEditor
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnEditor
=
new
System
.
Windows
.
Forms
.
Button
();
...
@@ -66,6 +65,8 @@
...
@@ -66,6 +65,8 @@
this
.
btnShot
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnShot
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnCanon
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnCanon
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnDelete
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnDelete
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
picDisPlay
=
new
Kivii
.
Sample
.
ImageUploader
.
Controls
.
PanelEx
();
this
.
vspCamView
=
new
Kivii
.
Sample
.
ImageUploader
.
Controls
.
VideoSourcePlayer
();
this
.
plLeft
.
SuspendLayout
();
this
.
plLeft
.
SuspendLayout
();
this
.
gbSample
.
SuspendLayout
();
this
.
gbSample
.
SuspendLayout
();
this
.
plSearchReport
.
SuspendLayout
();
this
.
plSearchReport
.
SuspendLayout
();
...
@@ -77,7 +78,7 @@
...
@@ -77,7 +78,7 @@
this
.
gbUploading
.
SuspendLayout
();
this
.
gbUploading
.
SuspendLayout
();
this
.
plMain
.
SuspendLayout
();
this
.
plMain
.
SuspendLayout
();
this
.
gbPhotoView
.
SuspendLayout
();
this
.
gbPhotoView
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
ptbPhotoDisplay
)).
BeginIni
t
();
this
.
panel1
.
SuspendLayou
t
();
this
.
plDisplay
.
SuspendLayout
();
this
.
plDisplay
.
SuspendLayout
();
this
.
gbOperating
.
SuspendLayout
();
this
.
gbOperating
.
SuspendLayout
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
...
@@ -318,17 +319,6 @@
...
@@ -318,17 +319,6 @@
this
.
plVsp
.
Size
=
new
System
.
Drawing
.
Size
(
370
,
350
);
this
.
plVsp
.
Size
=
new
System
.
Drawing
.
Size
(
370
,
350
);
this
.
plVsp
.
TabIndex
=
0
;
this
.
plVsp
.
TabIndex
=
0
;
//
//
// vspCamView
//
this
.
vspCamView
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
vspCamView
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
vspCamView
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
vspCamView
.
Name
=
"vspCamView"
;
this
.
vspCamView
.
Size
=
new
System
.
Drawing
.
Size
(
370
,
350
);
this
.
vspCamView
.
TabIndex
=
0
;
this
.
vspCamView
.
Text
=
"vspCamView"
;
this
.
vspCamView
.
VideoSource
=
null
;
//
// plRight
// plRight
//
//
this
.
plRight
.
Controls
.
Add
(
this
.
gbPhotoList
);
this
.
plRight
.
Controls
.
Add
(
this
.
gbPhotoList
);
...
@@ -360,6 +350,7 @@
...
@@ -360,6 +350,7 @@
this
.
flpPhotos
.
BackColor
=
System
.
Drawing
.
SystemColors
.
ButtonHighlight
;
this
.
flpPhotos
.
BackColor
=
System
.
Drawing
.
SystemColors
.
ButtonHighlight
;
this
.
flpPhotos
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
flpPhotos
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
flpPhotos
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
flpPhotos
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
flpPhotos
.
ImeMode
=
System
.
Windows
.
Forms
.
ImeMode
.
NoControl
;
this
.
flpPhotos
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
27
);
this
.
flpPhotos
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
27
);
this
.
flpPhotos
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
flpPhotos
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
flpPhotos
.
Name
=
"flpPhotos"
;
this
.
flpPhotos
.
Name
=
"flpPhotos"
;
...
@@ -407,7 +398,7 @@
...
@@ -407,7 +398,7 @@
//
//
// gbPhotoView
// gbPhotoView
//
//
this
.
gbPhotoView
.
Controls
.
Add
(
this
.
p
tbPhotoDisplay
);
this
.
gbPhotoView
.
Controls
.
Add
(
this
.
p
anel1
);
this
.
gbPhotoView
.
Controls
.
Add
(
this
.
plDisplay
);
this
.
gbPhotoView
.
Controls
.
Add
(
this
.
plDisplay
);
this
.
gbPhotoView
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
gbPhotoView
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
gbPhotoView
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
10F
);
this
.
gbPhotoView
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
10F
);
...
@@ -420,17 +411,14 @@
...
@@ -420,17 +411,14 @@
this
.
gbPhotoView
.
TabStop
=
false
;
this
.
gbPhotoView
.
TabStop
=
false
;
this
.
gbPhotoView
.
Text
=
"选中照片"
;
this
.
gbPhotoView
.
Text
=
"选中照片"
;
//
//
// p
tbPhotoDisplay
// p
anel1
//
//
this
.
ptbPhotoDisplay
.
BackColor
=
System
.
Drawing
.
SystemColors
.
ButtonHighlight
;
this
.
panel1
.
Controls
.
Add
(
this
.
picDisPlay
);
this
.
ptbPhotoDisplay
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
panel1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
ptbPhotoDisplay
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
27
);
this
.
panel1
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
27
);
this
.
ptbPhotoDisplay
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
panel1
.
Name
=
"panel1"
;
this
.
ptbPhotoDisplay
.
Name
=
"ptbPhotoDisplay"
;
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
804
,
831
);
this
.
ptbPhotoDisplay
.
Size
=
new
System
.
Drawing
.
Size
(
804
,
831
);
this
.
panel1
.
TabIndex
=
4
;
this
.
ptbPhotoDisplay
.
SizeMode
=
System
.
Windows
.
Forms
.
PictureBoxSizeMode
.
Zoom
;
this
.
ptbPhotoDisplay
.
TabIndex
=
4
;
this
.
ptbPhotoDisplay
.
TabStop
=
false
;
//
//
// plDisplay
// plDisplay
//
//
...
@@ -563,6 +551,28 @@
...
@@ -563,6 +551,28 @@
this
.
btnDelete
.
EnabledChanged
+=
new
System
.
EventHandler
(
this
.
btnEnabled_EnabledChanged
);
this
.
btnDelete
.
EnabledChanged
+=
new
System
.
EventHandler
(
this
.
btnEnabled_EnabledChanged
);
this
.
btnDelete
.
Click
+=
new
System
.
EventHandler
(
this
.
btnDelete_Click
);
this
.
btnDelete
.
Click
+=
new
System
.
EventHandler
(
this
.
btnDelete_Click
);
//
//
// picDisPlay
//
this
.
picDisPlay
.
BackgroundImageLayout
=
System
.
Windows
.
Forms
.
ImageLayout
.
Zoom
;
this
.
picDisPlay
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
picDisPlay
.
EnableSelection
=
false
;
this
.
picDisPlay
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
picDisPlay
.
Name
=
"picDisPlay"
;
this
.
picDisPlay
.
SelectionBounds
=
new
System
.
Drawing
.
Rectangle
(
0
,
0
,
0
,
0
);
this
.
picDisPlay
.
Size
=
new
System
.
Drawing
.
Size
(
804
,
831
);
this
.
picDisPlay
.
TabIndex
=
5
;
//
// vspCamView
//
this
.
vspCamView
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
vspCamView
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
vspCamView
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
vspCamView
.
Name
=
"vspCamView"
;
this
.
vspCamView
.
Size
=
new
System
.
Drawing
.
Size
(
370
,
350
);
this
.
vspCamView
.
TabIndex
=
0
;
this
.
vspCamView
.
Text
=
"vspCamView"
;
this
.
vspCamView
.
VideoSource
=
null
;
//
// FrmMain
// FrmMain
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
9F
,
18F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
9F
,
18F
);
...
@@ -590,7 +600,7 @@
...
@@ -590,7 +600,7 @@
this
.
gbUploading
.
ResumeLayout
(
false
);
this
.
gbUploading
.
ResumeLayout
(
false
);
this
.
plMain
.
ResumeLayout
(
false
);
this
.
plMain
.
ResumeLayout
(
false
);
this
.
gbPhotoView
.
ResumeLayout
(
false
);
this
.
gbPhotoView
.
ResumeLayout
(
false
);
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
ptbPhotoDisplay
)).
EndInit
(
);
this
.
panel1
.
ResumeLayout
(
false
);
this
.
plDisplay
.
ResumeLayout
(
false
);
this
.
plDisplay
.
ResumeLayout
(
false
);
this
.
plDisplay
.
PerformLayout
();
this
.
plDisplay
.
PerformLayout
();
this
.
gbOperating
.
ResumeLayout
(
false
);
this
.
gbOperating
.
ResumeLayout
(
false
);
...
@@ -628,7 +638,6 @@
...
@@ -628,7 +638,6 @@
private
System
.
Windows
.
Forms
.
FlowLayoutPanel
flpPhotos
;
private
System
.
Windows
.
Forms
.
FlowLayoutPanel
flpPhotos
;
private
System
.
Windows
.
Forms
.
Panel
plSearchReport
;
private
System
.
Windows
.
Forms
.
Panel
plSearchReport
;
private
System
.
Windows
.
Forms
.
RichTextBox
rtbMessage
;
private
System
.
Windows
.
Forms
.
RichTextBox
rtbMessage
;
private
System
.
Windows
.
Forms
.
PictureBox
ptbPhotoDisplay
;
private
System
.
Windows
.
Forms
.
Panel
plDisplay
;
private
System
.
Windows
.
Forms
.
Panel
plDisplay
;
private
System
.
Windows
.
Forms
.
Label
lbDisplay
;
private
System
.
Windows
.
Forms
.
Label
lbDisplay
;
private
System
.
Windows
.
Forms
.
Button
btnCamearTurn
;
private
System
.
Windows
.
Forms
.
Button
btnCamearTurn
;
...
@@ -637,6 +646,8 @@
...
@@ -637,6 +646,8 @@
private
System
.
Windows
.
Forms
.
Button
btnShot
;
private
System
.
Windows
.
Forms
.
Button
btnShot
;
private
System
.
Windows
.
Forms
.
Button
btnEditor
;
private
System
.
Windows
.
Forms
.
Button
btnEditor
;
private
System
.
Windows
.
Forms
.
ComboBox
cbxTurn
;
private
System
.
Windows
.
Forms
.
ComboBox
cbxTurn
;
private
System
.
Windows
.
Forms
.
Panel
panel1
;
private
Controls
.
PanelEx
picDisPlay
;
}
}
}
}
Src/FrmMain.cs
View file @
4cf4d563
...
@@ -23,11 +23,15 @@ using System.Windows.Forms;
...
@@ -23,11 +23,15 @@ using System.Windows.Forms;
using
System.Xml.Linq
;
using
System.Xml.Linq
;
using
static
System
.
Net
.
Mime
.
MediaTypeNames
;
using
static
System
.
Net
.
Mime
.
MediaTypeNames
;
using
Kivii.Canon
;
using
Kivii.Canon
;
using
Kivii.Controls
;
using
PictureBox
=
System
.
Windows
.
Forms
.
PictureBox
;
using
Image
=
System
.
Drawing
.
Image
;
namespace
Kivii.Sample.ImageUploader
namespace
Kivii.Sample.ImageUploader
{
{
public
partial
class
FrmMain
:
Form
public
partial
class
FrmMain
:
Form
{
{
private
float
_zoom
=
0f
;
private
JsonServiceClient
_client
=
null
;
private
JsonServiceClient
_client
=
null
;
private
FilterInfoCollection
videoDevices
;
private
FilterInfoCollection
videoDevices
;
...
@@ -38,11 +42,13 @@ namespace Kivii.Sample.ImageUploader
...
@@ -38,11 +42,13 @@ namespace Kivii.Sample.ImageUploader
private
List
<
DbFile
>
photos
=
new
List
<
DbFile
>();
private
List
<
DbFile
>
photos
=
new
List
<
DbFile
>();
private
Report
currentReport
=
null
;
private
Report
currentReport
=
null
;
private
DbFile
currentPhoto
=
null
;
private
DbFile
currentPhoto
=
null
;
private
Rectangle
Rectangle
=
new
Rectangle
(
0
,
0
,
540
,
960
);
//private CanonForm canonForm = null;
//private CanonForm canonForm = null;
public
FrmMain
()
public
FrmMain
()
{
{
InitializeComponent
();
InitializeComponent
();
picDisPlay
.
SelectionBounds
=
Rectangle
;
}
}
...
@@ -142,7 +148,8 @@ namespace Kivii.Sample.ImageUploader
...
@@ -142,7 +148,8 @@ namespace Kivii.Sample.ImageUploader
//lbCurrentBrand.Text = "__________";
//lbCurrentBrand.Text = "__________";
//lbCurrentBatchNumber.Text = "__________";
//lbCurrentBatchNumber.Text = "__________";
//lbCurrentSampleQuantity.Text = "__________";
//lbCurrentSampleQuantity.Text = "__________";
ptbPhotoDisplay
.
Image
=
null
;
SetSelectionImage
(
null
);
//picDisPlay.BackgroundImage = null;
flpPhotos
.
Controls
.
Clear
();
flpPhotos
.
Controls
.
Clear
();
currentReport
=
null
;
currentReport
=
null
;
currentPhoto
=
null
;
currentPhoto
=
null
;
...
@@ -205,6 +212,47 @@ namespace Kivii.Sample.ImageUploader
...
@@ -205,6 +212,47 @@ namespace Kivii.Sample.ImageUploader
addSnapshot
(
editedPhoto
,
index
);
addSnapshot
(
editedPhoto
,
index
);
showSnapshot
(
editedPhoto
);
showSnapshot
(
editedPhoto
);
}
}
private
void
resizePictureBox
()
{
if
(
picDisPlay
.
BackgroundImage
==
null
)
return
;
int
width
,
height
;
if
(
_zoom
==
0f
)
{
float
wzoom
=
(
float
)
picDisPlay
.
Width
/
(
float
)
picDisPlay
.
BackgroundImage
.
Width
;
float
hzoom
=
(
float
)
picDisPlay
.
Height
/
(
float
)
picDisPlay
.
BackgroundImage
.
Height
;
_zoom
=
wzoom
<
hzoom
?
wzoom
:
hzoom
;
}
else
if
(
_zoom
>
5f
)
_zoom
=
5f
;
else
if
(
_zoom
<
0.1f
)
_zoom
=
0.1f
;
width
=
(
int
)((
float
)
picDisPlay
.
BackgroundImage
.
Width
*
_zoom
);
height
=
(
int
)((
float
)
picDisPlay
.
BackgroundImage
.
Height
*
_zoom
);
picDisPlay
.
Width
=
width
;
picDisPlay
.
Height
=
height
;
var
rect
=
new
Rectangle
(
picDisPlay
.
SelectionBounds
.
X
,
picDisPlay
.
SelectionBounds
.
Y
,
(
int
)(
Rectangle
.
Width
*
_zoom
),
(
int
)(
Rectangle
.
Height
*
_zoom
));
picDisPlay
.
SelectionBounds
=
rect
;
int
x
=
0
,
y
=
0
;
//if (panel1.Width <= width) x = 0;
//else x = (panel1.Width - width) / 2;
//if (panel1.Height <= height) y = 0;
//else y = (panel1.Height - height) / 2;
picDisPlay
.
Location
=
new
System
.
Drawing
.
Point
(
x
,
y
);
}
public
Image
GetSelectionImage
()
{
return
picDisPlay
.
GetSelectionImage
(
_zoom
);
}
public
void
SetSelectionImage
(
Image
img
)
{
if
(
this
.
InvokeRequired
)
{
this
.
Invoke
(
new
Action
(()
=>
SetSelectionImage
(
img
)));
return
;
}
picDisPlay
.
BackgroundImage
=
img
;
//resizePictureBox();
}
#
endregion
#
endregion
#
region
相机控件调用
#
region
相机控件调用
...
@@ -340,13 +388,15 @@ namespace Kivii.Sample.ImageUploader
...
@@ -340,13 +388,15 @@ namespace Kivii.Sample.ImageUploader
try
try
{
{
//清空 ptbPhotoDisplay 中的图片
//清空 ptbPhotoDisplay 中的图片
ptbPhotoDisplay
.
Image
=
null
;
SetSelectionImage
(
null
);
//picDisPlay.BackgroundImage = null;
lbDisplay
.
Text
=
""
;
lbDisplay
.
Text
=
""
;
currentPhoto
=
null
;
currentPhoto
=
null
;
if
(
photo
==
null
)
return
;
if
(
photo
==
null
)
return
;
currentPhoto
=
photo
;
currentPhoto
=
photo
;
var
snapshot
=
photo
.
Image
;
var
snapshot
=
photo
.
Image
;
ptbPhotoDisplay
.
Image
=
snapshot
;
SetSelectionImage
(
snapshot
);
//picDisPlay.BackgroundImage = snapshot;
if
(
photo
.
Kvid
!=
Guid
.
Empty
)
lbDisplay
.
Text
=
$"[已上传]
{
photo
.
Name
}
"
;
if
(
photo
.
Kvid
!=
Guid
.
Empty
)
lbDisplay
.
Text
=
$"[已上传]
{
photo
.
Name
}
"
;
else
lbDisplay
.
Text
=
photo
.
Name
;
else
lbDisplay
.
Text
=
photo
.
Name
;
lbDisplay
.
TextAlign
=
ContentAlignment
.
MiddleCenter
;
lbDisplay
.
TextAlign
=
ContentAlignment
.
MiddleCenter
;
...
@@ -357,7 +407,7 @@ namespace Kivii.Sample.ImageUploader
...
@@ -357,7 +407,7 @@ namespace Kivii.Sample.ImageUploader
if
(
control
is
SplitContainer
container
)
if
(
control
is
SplitContainer
container
)
{
{
container
.
BorderStyle
=
BorderStyle
.
None
;
container
.
BorderStyle
=
BorderStyle
.
None
;
if
(
container
.
Panel1
.
Controls
[
0
]
is
PictureBox
pic
&&
pic
.
Image
==
snapshot
)
if
(
container
.
Panel1
.
Controls
[
0
]
is
System
.
Windows
.
Forms
.
PictureBox
pic
&&
pic
.
Image
==
snapshot
)
{
{
container
.
BorderStyle
=
BorderStyle
.
Fixed3D
;
container
.
BorderStyle
=
BorderStyle
.
Fixed3D
;
}
}
...
@@ -370,6 +420,7 @@ namespace Kivii.Sample.ImageUploader
...
@@ -370,6 +420,7 @@ namespace Kivii.Sample.ImageUploader
{
{
MessageBox
.
Show
(
"无法正常显示照片,"
+
ex
.
Message
);
MessageBox
.
Show
(
"无法正常显示照片,"
+
ex
.
Message
);
}
}
}
}
}
}
...
@@ -650,6 +701,7 @@ namespace Kivii.Sample.ImageUploader
...
@@ -650,6 +701,7 @@ namespace Kivii.Sample.ImageUploader
initCameras
();
initCameras
();
tbxPassword
.
Focus
();
tbxPassword
.
Focus
();
this
.
WindowState
=
FormWindowState
.
Maximized
;
this
.
WindowState
=
FormWindowState
.
Maximized
;
//picDisPlay.EnableSelection = true;
}
}
private
void
btnLogin_Click
(
object
sender
,
EventArgs
e
)
private
void
btnLogin_Click
(
object
sender
,
EventArgs
e
)
...
@@ -753,34 +805,6 @@ namespace Kivii.Sample.ImageUploader
...
@@ -753,34 +805,6 @@ namespace Kivii.Sample.ImageUploader
}
}
picName
+=
DateTime
.
Now
.
ToString
(
"mmssfff"
);
picName
+=
DateTime
.
Now
.
ToString
(
"mmssfff"
);
var
photo
=
new
DbFile
(
bitmap
,
picName
);
var
photo
=
new
DbFile
(
bitmap
,
picName
);
//if (chbRectify.Checked)
//{
// Bitmap temp = photo.Image.Clone() as Bitmap;
// var _counter = new BlobCounter();
// _counter.FilterBlobs = true;
// _counter.MinWidth = photo.Image.Width / 4;
// _counter.MinHeight = photo.Image.Height / 4;
// FiltersSequence seq = new FiltersSequence();
// seq.Add(Grayscale.CommonAlgorithms.BT709); //First add grayScaling filter
// seq.Add(new OtsuThreshold()); //Then add binarization(thresholding) filter
// temp = seq.Apply(temp);
// _counter.ProcessImage(temp);
// temp.Dispose();
// var blobs = _counter.GetObjectsInformation();
// if (blobs != null && blobs.Length > 0)
// {
// var corners = PointsCloud.FindQuadrilateralCorners(_counter.GetBlobsEdgePoints(blobs[0]));
// var rect = blobs[0].Rectangle;
// QuadrilateralTransformation quadTransformer = new QuadrilateralTransformation();
// quadTransformer.SourceQuadrilateral = corners; //Set corners for transforming card
// quadTransformer.AutomaticSizeCalculaton = true;
// photo.Image = quadTransformer.Apply(photo.Image);
// //ResizeBilinear resizer = new ResizeBilinear(rect.Width, rect.Height);
// }
//}
addSnapshot
(
photo
);
addSnapshot
(
photo
);
Thread
.
Sleep
(
50
);
Thread
.
Sleep
(
50
);
showSnapshot
(
photo
);
showSnapshot
(
photo
);
...
@@ -794,6 +818,13 @@ namespace Kivii.Sample.ImageUploader
...
@@ -794,6 +818,13 @@ namespace Kivii.Sample.ImageUploader
var
index
=
cbxTurn
.
SelectedIndex
;
var
index
=
cbxTurn
.
SelectedIndex
;
if
(
index
<=
-
1
)
index
=
0
;
if
(
index
<=
-
1
)
index
=
0
;
ImageRotateFlip
((
RotateFlipType
)
index
);
ImageRotateFlip
((
RotateFlipType
)
index
);
if
(
picDisPlay
.
EnableSelection
)
{
resizePictureBox
();
var
editImage
=
new
Bitmap
(
GetSelectionImage
());
setBackgroundImage
(
editImage
);
}
}
}
}
}
...
@@ -819,7 +850,7 @@ namespace Kivii.Sample.ImageUploader
...
@@ -819,7 +850,7 @@ namespace Kivii.Sample.ImageUploader
private
void
btnDelete_Click
(
object
sender
,
EventArgs
e
)
private
void
btnDelete_Click
(
object
sender
,
EventArgs
e
)
{
{
Bitmap
currentPhoto
=
(
Bitmap
)
p
tbPhotoDisplay
.
Image
;
Bitmap
currentPhoto
=
(
Bitmap
)
p
icDisPlay
.
Background
Image
;
if
(
currentPhoto
==
null
)
return
;
if
(
currentPhoto
==
null
)
return
;
var
photo
=
photos
.
FirstOrDefault
(
o
=>
o
.
Image
==
currentPhoto
);
var
photo
=
photos
.
FirstOrDefault
(
o
=>
o
.
Image
==
currentPhoto
);
if
(
photo
!=
null
)
if
(
photo
!=
null
)
...
...
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