Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
cardvisa
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
花桃白音
cardvisa
Commits
860fc2f3
Commit
860fc2f3
authored
Jun 24, 2024
by
花桃白音
Browse files
Options
Browse Files
Download
Plain Diff
test
parents
319885f7
34fd0cae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
31 deletions
+81
-31
cardvisa/Form1.cs
cardvisa/Form1.cs
+18
-3
cardvisa/PuzzleGame.Designer.cs
cardvisa/PuzzleGame.Designer.cs
+1
-2
cardvisa/PuzzleGame.cs
cardvisa/PuzzleGame.cs
+62
-26
cardvisa/obj/Debug/cardvisa.csproj.AssemblyReference.cache
cardvisa/obj/Debug/cardvisa.csproj.AssemblyReference.cache
+0
-0
No files found.
cardvisa/Form1.cs
View file @
860fc2f3
...
@@ -385,8 +385,8 @@ namespace cardvisa
...
@@ -385,8 +385,8 @@ namespace cardvisa
}
}
private
void
button8_Click
(
object
sender
,
EventArgs
e
)
private
void
button8_Click
(
object
sender
,
EventArgs
e
)
{
{
PuzzleGame
pzg
=
new
PuzzleGam
e
();
PuzzleGame
pzg
=
GenericSingleton
<
PuzzleGame
>.
CreateInstranc
e
();
pzg
.
Show
Dialog
();
pzg
.
Show
();
}
}
public
void
refreshlist
()
public
void
refreshlist
()
{
{
...
@@ -1205,7 +1205,6 @@ namespace cardvisa
...
@@ -1205,7 +1205,6 @@ namespace cardvisa
picViewer
.
Location
=
new
Point
(
Location
.
X
+
Size
.
Width
,
Location
.
Y
);
picViewer
.
Location
=
new
Point
(
Location
.
X
+
Size
.
Width
,
Location
.
Y
);
myListBox
.
Location
=
new
Point
(
Location
.
X
-
myListBox
.
Width
,
Location
.
Y
);
myListBox
.
Location
=
new
Point
(
Location
.
X
-
myListBox
.
Width
,
Location
.
Y
);
}
}
}
}
[
Table
(
Name
=
"main.datas"
)]
[
Table
(
Name
=
"main.datas"
)]
...
@@ -1325,6 +1324,22 @@ namespace cardvisa
...
@@ -1325,6 +1324,22 @@ namespace cardvisa
public
Int64
type
{
get
;
set
;
}
public
Int64
type
{
get
;
set
;
}
}
}
public
class
GenericSingleton
<
T
>
where
T
:
Form
,
new
()
{
private
static
T
t
=
null
;
public
static
T
CreateInstrance
()
{
if
(
t
==
null
||
t
.
IsDisposed
)
{
t
=
new
T
();
}
else
{
t
.
Activate
();
t
.
WindowState
=
FormWindowState
.
Normal
;
}
return
t
;
}
}
public
class
LittleGame
:
Form
public
class
LittleGame
:
Form
{
{
PictureBox
pb
=
new
PictureBox
();
PictureBox
pb
=
new
PictureBox
();
...
...
cardvisa/PuzzleGame.Designer.cs
View file @
860fc2f3
...
@@ -41,7 +41,6 @@
...
@@ -41,7 +41,6 @@
this
.
pictureBox1
.
SizeMode
=
System
.
Windows
.
Forms
.
PictureBoxSizeMode
.
Zoom
;
this
.
pictureBox1
.
SizeMode
=
System
.
Windows
.
Forms
.
PictureBoxSizeMode
.
Zoom
;
this
.
pictureBox1
.
TabIndex
=
0
;
this
.
pictureBox1
.
TabIndex
=
0
;
this
.
pictureBox1
.
TabStop
=
false
;
this
.
pictureBox1
.
TabStop
=
false
;
this
.
pictureBox1
.
Click
+=
new
System
.
EventHandler
(
this
.
pictureBox1_Click
);
this
.
pictureBox1
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
pictureBox1_MouseDown
);
this
.
pictureBox1
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
pictureBox1_MouseDown
);
//
//
// PuzzleGame
// PuzzleGame
...
@@ -53,9 +52,9 @@
...
@@ -53,9 +52,9 @@
this
.
Name
=
"PuzzleGame"
;
this
.
Name
=
"PuzzleGame"
;
this
.
Text
=
"PuzzleGame"
;
this
.
Text
=
"PuzzleGame"
;
this
.
Load
+=
new
System
.
EventHandler
(
this
.
PuzzleGame_Load
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
PuzzleGame_Load
);
this
.
FormClosed
+=
new
System
.
Windows
.
Forms
.
FormClosedEventHandler
(
this
.
PuzzleGame_Closed
);
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
EndInit
();
this
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
}
}
#
endregion
#
endregion
...
...
cardvisa/PuzzleGame.cs
View file @
860fc2f3
...
@@ -7,36 +7,63 @@ using System.Linq;
...
@@ -7,36 +7,63 @@ using System.Linq;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
static
System
.
Net
.
WebRequestMethods
;
namespace
cardvisa
namespace
cardvisa
{
{
public
partial
class
PuzzleGame
:
Form
public
partial
class
PuzzleGame
:
Form
{
{
Graphics
gf
;
Graphics
gf
;
Graphics
gtp
;
Graphics
gftp
;
Image
src
=
new
Bitmap
(
3000
,
4200
);
Image
pictp
=
new
Bitmap
(
2976
,
4175
);
Image
block
=
new
Bitmap
(
600
,
600
);
Pen
pc
=
new
Pen
(
Color
.
Black
,
5
);
List
<
List
<
int
>>
list
=
new
List
<
List
<
int
>>{
new
List
<
int
>{
11
,
12
,
13
,
14
,
15
},
new
List
<
int
>{
21
,
22
,
23
,
24
,
25
},
new
List
<
int
>{
31
,
32
,
33
,
34
,
35
},
new
List
<
int
>{
41
,
42
,
43
,
44
,
45
},
new
List
<
int
>{
51
,
52
,
53
,
54
,
55
},
new
List
<
int
>{
61
,
62
,
63
,
64
,
65
},
new
List
<
int
>{
71
,
72
,
73
,
74
,
75
}
};
bool
picked
=
false
;
bool
picked
=
false
;
int
pickx
=
0
;
int
px
;
int
picky
=
0
;
int
py
;
int
pickx
;
int
picky
;
public
PuzzleGame
()
public
PuzzleGame
()
{
{
InitializeComponent
();
InitializeComponent
();
}
}
private
void
PuzzleGame_Load
(
object
sender
,
EventArgs
e
)
private
void
PuzzleGame_Load
(
object
sender
,
EventArgs
e
)
{
pictureBox1
.
Image
=
Image
.
FromFile
(
Application
.
StartupPath
+
"//res//002.jpg"
);
gf
=
Graphics
.
FromImage
(
pictureBox1
.
Image
);
int
imgwd
=
2976
;
//30,5*600*scale
int
imght
=
4175
;
//42,7*600*scale
}
private
void
pictureBox1_Click
(
object
sender
,
EventArgs
e
)
{
{
src
=
Image
.
FromFile
(
Application
.
StartupPath
+
"//res//001.jpg"
);
gf
=
Graphics
.
FromImage
(
src
);
gf
.
InterpolationMode
=
System
.
Drawing
.
Drawing2D
.
InterpolationMode
.
NearestNeighbor
;
gf
.
PixelOffsetMode
=
System
.
Drawing
.
Drawing2D
.
PixelOffsetMode
.
Half
;
drawblock
();
}
}
private
void
PuzzleGame_Closed
(
object
sender
,
System
.
EventArgs
e
)
{
gf
.
Dispose
();
gtp
.
Dispose
();
src
.
Dispose
();
if
(
gftp
!=
null
)
{
gftp
.
Dispose
();
}
pictp
.
Dispose
();
block
.
Dispose
();
src
.
Dispose
();
pictp
.
Dispose
();
block
.
Dispose
();
list
.
Clear
();
Dispose
();
GC
.
Collect
();
GC
.
WaitForPendingFinalizers
();
}
private
void
pictureBox1_MouseDown
(
object
sender
,
MouseEventArgs
e
)
private
void
pictureBox1_MouseDown
(
object
sender
,
MouseEventArgs
e
)
{
{
drawblock
();
//判断窗体长宽比
//判断窗体长宽比
int
px
=
e
.
X
;
int
py
=
e
.
Y
;
if
(
pictureBox1
.
Height
>
pictureBox1
.
Width
)
if
(
pictureBox1
.
Height
>
pictureBox1
.
Width
)
{
{
int
picrcht
=
pictureBox1
.
Width
*
4175
/
2976
;
int
picrcht
=
pictureBox1
.
Width
*
4175
/
2976
;
...
@@ -55,30 +82,39 @@ namespace cardvisa
...
@@ -55,30 +82,39 @@ namespace cardvisa
py
=
(
py
-
py
%
600
)
/
600
;
py
=
(
py
-
py
%
600
)
/
600
;
if
(
picked
)
if
(
picked
)
{
{
Bitmap
temp
=
new
Bitmap
(
600
,
600
);
gftp
=
GfHandler
(
gftp
,
block
);
Graphics
gftp
=
Graphics
.
FromImage
(
temp
);
gftp
.
DrawImage
(
src
,
0
,
0
,
new
Rectangle
(
pickx
*
600
,
picky
*
600
,
600
,
600
),
GraphicsUnit
.
Pixel
);
gftp
.
DrawImage
(
pictureBox1
.
Image
,
0
,
0
,
new
Rectangle
(
pickx
*
600
,
picky
*
600
,
600
,
600
),
GraphicsUnit
.
Pixel
);
gf
.
DrawImage
(
src
,
pickx
*
600
,
picky
*
600
,
new
Rectangle
(
px
*
600
,
py
*
600
,
600
,
600
),
GraphicsUnit
.
Pixel
);
gf
.
DrawImage
(
pictureBox1
.
Image
,
pickx
*
600
,
picky
*
600
,
new
Rectangle
(
px
*
600
,
py
*
600
,
600
,
600
),
GraphicsUnit
.
Pixel
);
gf
.
DrawImage
(
block
,
px
*
600
,
py
*
600
,
new
Rectangle
(
0
,
0
,
600
,
600
),
GraphicsUnit
.
Pixel
);
gf
.
DrawImage
(
temp
,
px
*
600
,
py
*
600
,
new
Rectangle
(
0
,
0
,
600
,
600
),
GraphicsUnit
.
Pixel
);
picked
=
false
;
picked
=
false
;
drawblock
();
pictureBox1
.
Refresh
();
}
}
else
else
{
{
pickx
=
px
;
pickx
=
px
;
picky
=
py
;
picky
=
py
;
picked
=
true
;
picked
=
true
;
}
}
pictureBox1
.
Refresh
();
}
}
public
void
drawblock
()
public
void
drawblock
()
{
{
Pen
pc
=
new
Pen
(
Color
.
Black
,
5
);
gtp
=
GfHandler
(
gtp
,
pictp
);
gtp
.
DrawImage
(
src
,
new
Rectangle
(
0
,
0
,
2976
,
4175
));
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
for
(
int
j
=
0
;
j
<
7
;
j
++)
for
(
int
j
=
0
;
j
<
7
;
j
++)
{
{
g
f
.
DrawRectangle
(
pc
,
(
0
+
i
)
*
600
,
(
0
+
j
)
*
600
,
600
,
600
);
g
tp
.
DrawRectangle
(
pc
,
(
0
+
i
)
*
600
,
(
0
+
j
)
*
600
,
600
,
600
);
}
}
}
}
pictureBox1
.
Image
=
pictp
;
}
public
Graphics
GfHandler
(
Graphics
srcgf
,
Image
img
)
{
srcgf
=
Graphics
.
FromImage
(
img
);
srcgf
.
InterpolationMode
=
System
.
Drawing
.
Drawing2D
.
InterpolationMode
.
NearestNeighbor
;
srcgf
.
PixelOffsetMode
=
System
.
Drawing
.
Drawing2D
.
PixelOffsetMode
.
Half
;
return
srcgf
;
}
}
}
}
}
}
cardvisa/obj/Debug/cardvisa.csproj.AssemblyReference.cache
View file @
860fc2f3
No preview for this file type
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