megabax
|
17.06.2012 . |
Delphi
Visual C# . 15.
"C#
",
. ,
. ,
C#.
.
. ,
:

, :
public partial
class Form1
: Form
{
private List<string>
str = new List<string>(30);
private List<Cursor>
cur = new List<Cursor>(30);
public Form1()
{
InitializeComponent();
foreach (System.Reflection.PropertyInfo
pi in typeof(Cursors).GetProperties())
{
str.Add(pi.Name);
cur.Add((Cursor)pi.GetValue(null,
null));
}
button1.Tag = str.IndexOf("Default");
}
... |
,
C#:
-
List -
. , , ,
foreach .
, List
<>, .
- .
-
Cursor -
. Cursor,
.
.
Cursor,
MouseDown :
private
void button1_MouseDown(object
sender, MouseEventArgs e)
{
int k =(int)
button1.Tag;
int c = str.Count;
switch(e.Button)
{
case
MouseButtons.Left:
k=(k+1)%c;break;
case
MouseButtons.Right:
k=(k-1+c)%c;break;
}
button1.Text=str[k];
button1.Cursor=cur[k];
button1.Tag=k;
} |
, , ,
Tag .
.
, ,
, ,
( ).
, *,
"Microsoft Visual Studio 2010 Professional",
Microsoft..
()
|
( 15.02.2014 . )
|