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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 396 - (show annotations) (download)
Sun Jun 23 23:32:26 2019 UTC (7 months ago) by william
File size: 1791 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 PlatformControl : UserControl {
13 private object image_lock = new object ();
14
15 public Color TextBackColor {
16 get {
17 return platformName.BackColor;
18 }
19 set {
20 platformName.BackColor = value;
21 Application.DoEvents ();
22 }
23 }
24 public Color TextForeColor {
25 get {
26 return platformName.ForeColor;
27 }
28 set {
29 platformName.ForeColor = value;
30 Application.DoEvents ();
31 }
32 }
33 private int m_ControlID = new Random ().Next ();
34 public int ControlID { get { return m_ControlID; } }
35 public PlatformControl ()
36 {
37 InitializeComponent ();
38 platformImage.SizeMode = PictureBoxSizeMode.StretchImage;
39 }
40 public void UpdatePlatformImage (Bitmap img)
41 {
42 this.platformImage.Image = img;
43 }
44 public void UpdatePlatformImage (string filename)
45 {
46 using (var bmpTemp = new Bitmap(filename))
47 {
48 this.UpdatePlatformImage (new Bitmap (bmpTemp));
49 }
50 }
51 /*private Bitmap PlatformImage {
52 get { lock (image_lock) { return platformImage.Image; } }
53 set {
54 lock (image_lock) {
55 platformImage.Image = value;
56 }
57 }
58 }*/
59 public string PlatformName { get { return platformName.Text; } set { platformName.Text = value; Application.DoEvents (); } }
60 private void PlatformControl_Load (object sender, EventArgs e)
61 {
62 using (Graphics g = platformName.CreateGraphics ()) {
63 Size size = g.MeasureString (platformName.Text, platformName.Font).ToSize ();
64 platformName.Size = new Size (size.Width + 5, platformName.Size.Height);
65 }
66 }
67 }
68 }

  ViewVC Help
Powered by ViewVC 1.1.22