-
Notifications
You must be signed in to change notification settings - Fork 0
/
GraphicCard (1).cs
53 lines (46 loc) · 1.43 KB
/
GraphicCard (1).cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CardGameWF
{
class GraphicCard: Card
{
public PictureBox Pb { get; set; }
public bool Opened
{
get
{
return opened;
}
set
{
opened = value;
Pb.Image = opened ? Image.FromFile(fileName) : Image.FromFile(imageShirtPath);
}
}
private bool opened;
private readonly string imageShirtPath = Application.StartupPath + @"\images\shirt.jpg";
private readonly string fileName;
public GraphicCard(CardFigure figure, CardSuit suit, PictureBox pb, bool opened = true) : base(figure, suit)
{
Pb = pb;
Pb.SizeMode = PictureBoxSizeMode.Zoom;
Pb.Visible = false;
fileName = Application.StartupPath + @"\images\" + this.ToString() + ".png";
Opened = opened;
}
public GraphicCard(CardFigure figure, CardSuit suit) : this(figure, suit, new PictureBox()) { }
public override void Show()
{
Pb.Visible = true;
}
public override string ToString()
{
return String.Format($"{Suit}s {Figure}");
}
}
}