-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aacafe2
commit b41ba4d
Showing
8 changed files
with
140 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Drawing; | ||
|
||
namespace vCards | ||
{ | ||
public class Deck: MyUserControl | ||
{ | ||
private List<Card> listCard = new List<Card>(); | ||
protected Deck() | ||
{ | ||
|
||
} | ||
public Deck(Rectangle rect): base(rect) | ||
{ | ||
|
||
} | ||
public void Add(Card lb) | ||
{ | ||
if(lb!=null) listCard.Add(lb); | ||
} | ||
public void Remove(Card lb) | ||
{ | ||
if (lb != null) listCard.Remove(lb); | ||
} | ||
public void Draw(IGraphics igr) // update vi tri truoc khi xuat | ||
{ | ||
foreach (Card lb in listCard) | ||
{ | ||
lb.DrawBkgr(igr); | ||
} | ||
} | ||
public void UpdatePos() | ||
{ | ||
if (listCard.Count<=0) | ||
{ | ||
return; | ||
} | ||
listCard.Sort(); | ||
int denta = this.Region.Width - Card.iBaseWidth; | ||
int dentadef = Card.iMaxWidth * listCard.Count; | ||
int left = Region.Left; | ||
int width = Card.iMaxWidth; | ||
if (denta>dentadef) | ||
{ | ||
float temp = denta - dentadef; | ||
temp /= 2; | ||
left += (int)temp; | ||
} | ||
else | ||
{ | ||
float f = denta / (listCard.Count - 1); | ||
width = (int)f; | ||
} | ||
for (int i=0; i<listCard.Count; ++i) | ||
{ | ||
Rectangle rect = new Rectangle(left + width * i, listCard[i].Region.Y, listCard[i].Region.Width, listCard[i].Region.Height); | ||
listCard[i].Region = rect; | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters