forked from Trevor3000/RemoteControl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrmSelectAvatar.cs
More file actions
62 lines (56 loc) · 2.08 KB
/
Copy pathFrmSelectAvatar.cs
File metadata and controls
62 lines (56 loc) · 2.08 KB
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
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace RemoteControl.Server
{
public partial class FrmSelectAvatar : FrmBase
{
public string SelectedAvatarFile { get; private set; }
public FrmSelectAvatar()
{
InitializeComponent();
this.flowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight;
this.flowLayoutPanel1.AutoScroll = true;
base.EnableCancelButton = true;
}
private void FrmSelectAvatar_Load(object sender, EventArgs e)
{
var files = RSCApplication.GetAllAvatarFiles();
for (int i = 0; i < files.Count; i++)
{
var file = files[i];
var avatar = new PictureBox();
avatar.Width = 42;
avatar.Height = 42;
avatar.BackgroundImage = Image.FromFile(file);
avatar.BackgroundImageLayout = ImageLayout.Stretch;
avatar.Tag = file;
avatar.Margin = new Padding(10, 5, 10, 5);
avatar.MouseEnter += new EventHandler(avatar_MouseEnter);
avatar.MouseLeave += new EventHandler(avatar_MouseLeave);
avatar.MouseDoubleClick += new MouseEventHandler(avatar_MouseDoubleClick);
this.flowLayoutPanel1.Controls.Add(avatar);
}
}
void avatar_MouseDoubleClick(object sender, MouseEventArgs e)
{
PictureBox pb = sender as PictureBox;
this.SelectedAvatarFile = pb.Tag as string;
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
void avatar_MouseLeave(object sender, EventArgs e)
{
PictureBox pb = sender as PictureBox;
pb.BorderStyle = BorderStyle.None;
}
void avatar_MouseEnter(object sender, EventArgs e)
{
PictureBox pb = sender as PictureBox;
pb.BorderStyle = BorderStyle.FixedSingle;
}
}
}