привет !очень сильно нужна помошь помогите разобратся в программке
программны код
Dim cx As Single, cy As Single, pr As Boolean, a As Boolean
Private Sub Pic1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
cx = X - 240
cy = Y - 240
If Button = 1 Then
If Not pr Then
Pic1.Line (cx, cy)-(X - 240, Y - 240)
pr = True
End If
Else
cx = X
cy = Y
If Button = 1 Then
If Not pr Then
Pic1.Line (cx, cy)-(X, Y)
pr = True
End If
End If
End If
End Sub
Private Sub Pic1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If a = True Then
If Button = 1 Then
If Not pr Then
Pic1.Line (cx, cy)-(X - 240, Y - 240)
pr = True
Else
Pic1.Line -(X - 240, Y - 240)
End If
End If
Else
If Button = 1 Then
If Not pr Then
Pic1.Line (cx, cy)-(X, Y)
pr = True
Else
Pic1.Line -(X, Y)
End If
End If
End If
End Sub
Private Sub Pic1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
pr = False
End Sub
этот код позволяет рисовать как в пэинте(работает 100%)
но я так ине смог разобртася в о всем этом вся проблема в преременных кто сможет обяснить что тут написано
Ну да, щас так он и написал тебе агрументы ключевого слова
Вот они, аргументы:
Line(x1,y1)-(x2,y2), [Color], [B[F]]
,
но можно и так:
Line -(x2,y2), [Color], [B[F]]
тогда линия будет рисоваться от CurrentX и CurrentY
B - для рисования прямоугольника, F - для заполненого прямоугольника.
Color - цвет линии(прямоуг.(не заполнения))
Заполнятся будет FillColor'ом в св-вах объекта (формы, пикбокса...)
The Line method syntax has the following object qualifier and parts:
Part Description
object Optional.Object expression that evaluates to an object in the Applies To list. If object is omitted, the Form with thefocus is assumed to be object.
Step Optional.Keyword specifying that the starting point coordinates are relative to the current graphics position given by the CurrentX and CurrentY properties.
(x1, y1) Optional. Single values indicating the coordinates of the starting point for the line or rectangle. The ScaleMode property determines the unit of measure used. If omitted, the line begins at the position indicated by CurrentX and CurrentY.
Step Optional. Keyword specifying that the end point coordinates are relative to the line starting point.
(x2, y2) Required. Single values indicating the coordinates of the end point for the line being drawn.
color Optional. Long integer value indicating the RGB color used to draw the line. If omitted, the ForeColor property setting is used. You can use the RGB function or QBColor function to specify the color.
B Optional. If included, causes a box to be drawn using the coordinates to specify opposite corners of the box.
F Optional. If the B option is used, the F option specifies that the box is filled with the same color used to draw the box. You cannot use F without B. If B is used without F, the box is filled with the current FillColor and FillStyle. The default value for FillStyle is transparent.
Remarks
To draw connected lines, begin a subsequent line at the end point of the previous line.
The width of the line drawn depends on the setting of the DrawWidth property. The way a line or box is drawn on the background depends on the setting of the DrawMode and DrawStyle properties.
When Line executes, the CurrentX and CurrentY properties are set to the end point specified by the arguments.
This method cannot be used in an With…End With block.
Свойство формы MousePointer установим в 99-Custom.
Свойству формы MouseIcon, зададим курсор из папки:
Program Files\Microsoft Visual Studio\COMMON\Graphics\Cursors\PENCIL.cur
Вот самый простой пример:
Option Explicit
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
If Button = 1 Then Form1.PSet (X, Y)
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
If Button = 1 Then Form1.Line -(X, Y), vbBlue
End Sub