/[EmuXPortal]/branches/mono/EmuXPortal/GameControl.cs
ViewVC logotype

Contents of /branches/mono/EmuXPortal/GameControl.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 396 - (show annotations) (download)
Sun Jun 23 23:32:26 2019 UTC (6 months, 3 weeks ago) by william
File size: 1722 byte(s)
use HashSet instead of List
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Data;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9 using System.IO;
10
11 namespace EmuXPortal {
12 public partial class GameControl : UserControl {
13 private object image_lock = new object ();
14 private int m_ControlID = new Random ().Next ();
15 public int ControlID { get { return m_ControlID; } }
16
17 public Color TextBackColor {
18 get {
19 return gameName.BackColor;
20 }
21 set {
22 gameName.BackColor = value;
23 Application.DoEvents ();
24 }
25 }
26 public Color TextForeColor {
27 get {
28 return gameName.ForeColor;
29 }
30 set {
31 gameName.ForeColor = value;
32 Application.DoEvents ();
33 }
34 }
35 public GameControl ()
36 {
37 InitializeComponent ();
38 gameImage.SizeMode = PictureBoxSizeMode.StretchImage;
39 }
40 public void UpdateGameImage (Bitmap img)
41 {
42 this.gameImage.Image = img;
43 }
44 public void UpdateGameImage (string filename)
45 {
46 using (var bmpTemp = new Bitmap(filename))
47 {
48 this.UpdateGameImage (new Bitmap (bmpTemp));
49 }
50 }
51 /*private Image GameImage {
52 get {
53 lock (image_lock) {
54 return gameImage.Image;
55 }
56 }
57 set {
58 lock (image_lock) {
59 gameImage.Image = value;
60 }
61 }
62 }*/
63 public string GameName { get { return gameName.Text; } set { gameName.Text = value; Application.DoEvents (); } }
64 private void GameControl_Load (object sender, EventArgs e)
65 {
66 using (Graphics g = gameName.CreateGraphics ()) {
67 Size size = g.MeasureString (gameName.Text, gameName.Font).ToSize ();
68 gameName.Size = new Size (size.Width + 5, gameName.Size.Height);
69 }
70 }
71 }
72 }

  ViewVC Help
Powered by ViewVC 1.1.22