Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

OPI_RGZ_2011

.pdf
Скачиваний:
16
Добавлен:
07.02.2016
Размер:
2.93 Mб
Скачать

111

. 6 , d 9'n-, 4.8.

6 9 4.8 – 6

6

'

 

.

SolidBrush

System.Drawing

8

 

 

 

 

 

 

TextureBrush

System.Drawing

J -

 

 

9-

 

 

(

 

 

HatchBrush

System.Drawing.Drawin

J

 

 

 

g2D

 

 

 

LinearGradi-

System.Drawing.Drawin

J -

entBrush

g2D

n

 

PathGradi-

System.Drawing.Drawin

J,

o

n

entBrush

g2D

n -

 

 

 

 

 

 

A 9'n SolidBrush , -

:

SolidBrush myBrush = new SolidBrush (Color.PapayaWhip);

J d d K

. 5, TextureBrush 9-

9'n Image, LinearGradientBrush —

d , ( 9 . 7n. .9'n 7n K ' , -

K , (

.

„ n 7n, n

(sealed). 8 9'n 7n ,

:

Pen myPen = new Pen (Color.BlanchedAlmond);

: Kn , d Kn 1 K. • K

9'n 7en :

Pen myPen = new Pen (Color.Lime, 4);

112

v n d , . ' ( , ' 9 - ( . v 9

d . 5 n

myBrush:

Pen myPen = new Pen (myBrush);

' ( n

d. 8 , ' .

' 9 -

( , o -. A .NET Framework n

SystemColors, 9 , o

K . 6, 9 -

(

, o 9 9 ( -

. . -

( :

Color myColor = SystemColors.HighlightText;

' SystemColors, .NET Framework ( n

SystemPens System Brushes, o K ' ,

K . v KK , 9- d, 7n 9 SolidBrush.

/8! ) , $%#

J Graphics n , o K K

.

- K 9

9'n 7n, , o Kn 9 , – -

9'n Brush. J ,

9- 9 9'n. 6, , ( K

9 .

DrawRectangle:

/ / E8@65M8M 6J'rH8 Rectangle.

Rectangle myRectangle = new Rectangle(0, 0, 30, 20);

// E8@65M8M 6J'rH8 Graphics, L6@'FBI;MO B •65:6<, Graphics g = this.CreateGraphics();

// QI:I?<@I8M L5F:6HK8;MH 7M789:;M: L956:. g.DrawRectangle (SystemPens, ControlDark, myRectangle);

// X@D?T;M8M 597K57M, BIO;F8D 6J'rH86: Graphics. g.Dispose();

113

d 9 9'n Graphics, 9'

Dispose. : d d ( -

, o 9'n n 9 . 0 9- 9'n 7n Brush. 5 n, K 9

9'n Brush Graphics:

SolidBrush myBrush = new SolidBrush (Color.MintCrearn); Graphics g = this.CreateGraphics();

//QI:I?<@I8M 9?DL7, @LM7I;MO @ L5F:6HK8;MH. Rectangle inyRectangle = new Rectancle (0, 0, 30, 20): g.FillEllipse (myBrush, myRectangle);

//X@D?T;M8M 597K57M 6J'rH8D@ Graphics D Brush. g.Dispose();

myBrush.Dispose ();

u K :

9'n Graphics, o n 9, -

K ;

c 9 ( 9'n. A 9'- n, o K , Point 9 Rectangle, ( 9'n 7en ( K ) Brush ( 9 );

9'n Graphics;

, 9'n 7n 9

Brush;

9'n Graphics.

%( F .' ) '

DrawString 9'n Graphics n 9 -

, K d -

. J 9'n Brush. v

9 9 (-

( PointF). 5 ( -, o 9 ( n K

Graphics. DrawString:

//z bT6:K L5MH?ICD @MH65M786@Kr8T7F 6C;I B

//EM789:;MS HM789O H?I7K SystemBrush. Graphics g = this.CreateGraphics(); String myString = "Hello World";

Font myFont = new Font ("Times New Roman", 36, FontStyle, Regular); //f78I;;D C@I LI5I:985M L59C78I@?F<8T H665CM;I8M 5FCHI. g.DrawString (myString, myFont, SystemBrushes.Highlight, 0. 0);

114

// Q9 BIJKCT89 B@D?T;M8M 6J'rH8 Graphics! g.Dispose();

: 9 ( :

9 9'n Font Brush, o K

9'n String;

9'n Graphics, ' 9 K,

9 9 ( ;

Graphics.DrawString, d 9'n String, Font, Brush 9, 9

9 ( .;

9'n Graphics, d Graphics.Di-spose.

/8! ) / ( , $%#

~ K 9 d , (

, 9. 9'n n 9-

, d K K, K

n . J K -

n 9'n Graphics Path

System.Drawing. Drawing2D. : n

9 9 . 6, ( 9'n GraphicsPath,

, d 9'n, o -

n .

! ' ) F'x GraphicsPath

.9'n GraphicsPath KK nK

. 5 d 9'n GraphicsPath

n :

GraphicsPath myPath = new Drawing2D.GraphicsPath ();

J , 9'n GraphicsPath -

Byte. 6 K -, Byte – , 'n K. '-

d 9 n

System.Drawing.Drawing2D.PathPointType, ( 9 d

. . , o Kn

( 9'n GraphicsPath:

// w9O L5MH?IC L5MLK7HIr ;IF@;D78T 6L95I865I using //System. Drawing.Drawing2D

GraphicsPath myPath = new GraphicsPath (new Point [] {new Point (1, 1),

new Point (32, 54), new Point (33, 5)}, new byte [] {

115

(Byte) PathPointType.Start, (byte) PathPointType.Line, (Byte) PathPointType.Bezier});

A 9'n GraphicsPath ( -. 2 — , ( 9 (

9 ) 9 ( -

).

GraphicsPath K -

(9 4.9).

6 9 4.9 – 9'n GraphicsPath

'

” n

AddClosedCurve

,

AddEllipse

 

AddPath

9'n GraphicsPath

AddPie

(

AddPolygon

9,

AddRectangle

'

AddRectangles

 

AddString

-

 

 

A n 9 9'n-GraphicsPath, , K , -. ” 9 ,

GraphicsPath.StartFigure. A, K

GraphicsPath, ( . d

K , GraphicsPath.CloseFigure, o 9

– 'n n

d K. . :

GraphicsPath myPath = new Drawing2D.GraphicsPath (); myPath. StartFigure ();

6 9 , n .

myPath.CloseFigure();

u o StartFigure , - d ( CloseFigure, , d -

StartFigure, d K.

116

'. ' 9 ( 9- -

n , o 'n- n d K n .

9 4.10 9'n GraphicsPath, o - K .

6 9 4.10 —

'

” n

AddArc

A

AddBezier

J € 'n

AddBeziers

5 9 €n

AddCurve

J,

AddLine

'

AddLines

5 9 'n

u K :

9'n Graphics, ' 9 K

K, 9 K ;

GraphicsPath;

K

GraphicsPath;

Graphics. DrawPath, o 9 K , 9 Graphics.FillPath, o 9 K d , 9'- n GraphicsPath;

9'n Graphics.

4.2.2.2 ! ' ) '/'-' %! ' ! )

: Windows Forms - ( . : KK

n . .NET Framework n ( 9 -

. s -.NET Framework — , , o -

n . „ n ( -

, o K . '-d, -

117

Visual Studio .NET, 9 Microsoft. : 9- K d ( -K 9 n -

9 K K. '- ,

9, (

K ActiveX. s -

9 K (,

.NET Framework. 5 d, o , 9 - d ,

.NET Framework, 9, -

n K .

N , c, , ! ' ) '/'-' %! ' ! )

: .NET Framework n 9 -

o Control K 9 - 9 , 9 -

. 5, Control n 9 9 , -

K d, ( , n-

n .8. J , K

o 9 , , -

. . 9 n o

, , o n -

.

. :

n K ;

9'n ;

« ».

()*+ ,-*../ -&+ &0.,12 3 45464. &- 47,-*../

' d , d

K. 8

9 n K 9 ,

n (.

J , n

. 5, ,

Button, n . v

n ,

9 ( 9.

118

€d Windows Forms, o

K NotInheritable (sealed), ( 9 9-

. 5, - n TextBox 9

9 PictureBox K

9 ( K 9 (. 8-

( n K , -

9 , d

. ' — , n -

K K.

. d K -

( n d 9 n -

. v , o n 9 9- d 9 ( K Windows Forms , d d -

. A 9 , 9

, 9 d . u o ( 9 d K

K, d K;

K 9, .

()*+ ,-*../ -&+ 5*0, UserControl

d . ', 9 -

, o n ' ( - 9 ( n ' , o

TextBox. ( , d

, o -

. v 9 , 9 ( 9

. s , 9'n -

Windows Forms, K -

9 .

8 d K

UserControl n 9 , ( d

d , , d

. A n - o Windows Forms

, n (. 6 ,

119

( K , 9'n K

Windows Forms .

' 9

(, 9, ,

d d d -

.

8 ( -

(

. 8 9, ,

, o n K

(.

()*+ ,-*../ -&+ 5*0, Control

u o 9 9 d 9 (,

n -

, K -

. 2 n o Control — 9

. J Control n « o»

9'n , K -

, n d K ( -

, Click), ( d K 9 -

, , Font, ForeColor, BackColor, Visible . .

6 d Control n

(. : K , 9

d , -

9. Control n

, o K 9 , 9 -

.

8 9 n 9- d , n -

( ,

, o ( 9

. 2 9, - o 9 9 , n ( d .

9:+*-*../ 254.&- +: 45464. &- 47,-*../

120

' , ,

n -

. ~ n d-

9- o , o 9 9 -

, o . : , 9-, 9 ( K Properties, ( -

d 9- . u o , o 9

9 ( Properties, - d 9 Browsable false.

. 9:

<System. ComponentModel. Browsable (false)> public int StockNumber

{

/ / A9I?DBIbDF @?I78M@678D 6LKj9;I.

}

! ' ) %( , '/'-' %! ' ! )

' K -

9 , ( (. ” 9 -

, 9 9

, Windows Forms. 5 , , 9 (

d o. 5 ( -

, Button;

public class myButton: System.Windows.Forms.Button

{

/ / y;eMO H6C 6LKj9;MO.

}

;4*5&<*=&/ .:- 3 6:>5 -:0 4? - ):3&+. 3 45464. *3 47,- -*../

u , K,

9 ,

Windows Forms. A

K 9 K ,

9 . ', o 9 9

, ( d . A

9 OnKeyPress :

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]