,,,
..
:
2007
1.
1.1
1.1.1
1.1.2
1.2 ,
2.
2.1
2.2
2.3
3.
3.1
3.2
. , . Visual Studio. , , , .
1.
1.1
1.1.1
# , , , .
C# Framework .Net - FCL, CLR;
C# - , , , ;
C# ;
C# C/C++, . , ++ C#;
, .
# , , # .NET.
.NET , #. , # .NET. , # .NET. , .NET-.
1. .NET , , #. .NET (execution engine).
2. .NET , (type safe environment). , .NET " , ".
3. .NET , .
4. .NET , .
5. .NET- , , . , . , , Microsoft.
6. .NET ().
7. .NET , . , .NET, . .NET 15 . , .NET , , (Common Language Runtime, CLR).
, , ( ).
.NET , .
, , , C#.
1.1.2
++ . , . , ++ , , , Visual Basic. , , /++. . Web. , , Visual Basic C++, , Web .
, Microsoft - C#. - , , , " ", . , COM+ Web . C#, : C++, C, Java, SmallTalk, Delphi, Visual Basic .. , C# , ( ), (, , ), . , , ++, .
1.2 ,
System.Drawing Point, Pen. .
, . , , . .NET Framework Point. ( ) (x y), , a y - . Point .
Point , X Y, , 32- . X Y .
Point click_point = new Point();
X Y 0. :
Point click_point = new Point(34, 55);
Graphics Color. . , , .
. , Color.
Pen pen = new Pen();
, , :
Pen pen = new Pen(Color.Green);
PaintEventArgs System Windows forms. Graphics Graphics, SystemDrawing. Graphics Windows Forms, Form. .
Graphics
DrawLine Graphics. DrawLine, : , , .
DrawLine Graphics:
void DrawLinefPen pen, int x1, int y1, int x2, int y2)
void DrawLinefPen pen, float x1, float y1, float x2, float y2)
void DrawLine(Pen pen, Point pointl, Point point2)
void Drawl_ine(Pen pen, PointF pointl, PointF point2)
int float, Point PointF. DrawLine , .
, DrawLine DrawLines, DrawRectangle. , , . Rectangle, DrawRectangle.
DrawRectangle Graphics:
void DrawRectangle(Pen pen, int x, int y, int ex, int cy)
void DrawRectangleCPen pen, float x, float y, float ox, float cy)
void DrawRectangle(Pen pen, Rectangle rect)
Graphics DrawEllipse, .
DrawEllipse(Pen pen2, float x1, float y1, float x2, float y2);
Point MousePosition . . , , Control.
(desktop coordinates) , Windows . , , (form coordinates) , .
Location , (0, 0) . , :
click_point.X = MousePosition.X - Form1.ActiveForm.Location.X;
Invalidat
, , . Invalidate Windows, . Invalidate , .
2.
2.1
10 10 . . , Form1_Paint .
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
matr[i, j] = 0;
}
}
Form1_Paint , : ,
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(pen3, k * 30 + 2, i * 30 + 2, k * 30 + 28, i * 30 + 28);
e.Graphics.DrawLine(pen3, k * 30 + 28, i * 30 + 2, k * 30 + 2, i * 30 + 28);
e.Graphics.DrawRectangle(pen1, 30 * k, 30 * i, 30, 30);
}
, , ..
private int get_random(int min, int max)
{
int r = 0;
r = rnd.Next(min, max);
return r;
}
restart():
public void restart()
{
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
matr[i, j] = 0;
}
}
2.2
Click Form1_Click.
private void Form1_Click(object sender, EventArgs e)
{
}
. RadioButton human. access. Access . access true, matr[k, i] Form1_Paint . access false, matr[k, i] . proverka. . proverka2 , 5 .
. , , matr[i,j] , , - , :
if (access == true)
{
matr[k, i] = 1;
access = false;
proverka(k, i);
}
else
matr[k, i] = 2;
access = true;
proverka(k, i);
}
proverka(k, i), if-else 2 (), . , () line proverka2. , (). , , : ?. :
MessageBox.Show(" ?", " ", MessageBoxButtons.YesNo);
restart(), .
2.3
, computer.Checked :
if (matr[k, i] == 0)
{
matr[k, i] = 1;
access4 = true;
_x = k; _y = i;
proverka(k, i);
AI();
}
AI(), . . , random_AI(). AI , AI2 (int z, int q, int c, int d) ( c d) . , random_AI(). , access3 access4. , , .
() proverka(). , RadioButton computer .
3.
3.1
, () ( , ). . , , , . , .
.1.
3.2
-. . , (. 1):
, : (human) (computer). , . .
(. 2) ?. , , , .
.2.
C#. Visual Studio. , . - .
1. . Microsoft WINDOWS #. - , 2002 - 576 .
2. Windows- Microsoft Visual Basic .NET Microsoft Visual C# -NET. MCAD/MCSD/. . .:
- , 2003. 512 .: .
3. MSDN 2005
..
Copyright (c) 2024 Stud-Baza.ru , , , .