PDA

View Full Version : مبتدی: برنامه نقاشی



elgesi
شنبه 06 اردیبهشت 1393, 20:49 عصر
باسلام خدم دوستان من یه برنامه ای نوشتم که مثل paint عمل میکند اگه میشه خواهشا کد هایی که میزارم برام توضیح دهید که مثلا اینجا چیکار میکنه ممنون میشم کمکم کنید.
Dim IntOldX As Integer, IntOldY As Integer, LngColor As Long
Dim IntLineSize As Byte


Private Sub CboLineSize_Click()
(IntLineSize = Val(CboLineSize.Text
Pic1.DrawWidth = IntLineSize
End Sub


Private Sub CmdClear_Click()
Pic1.Cls
End Sub




Private Sub CmdExit_Click()
Unload Me
End Sub


Private Sub CmdPallete_Click()
CommonDialog1.ShowColor
LngColor = CommonDialog1.Color
LBLCurrentColor.BackColor = LngColor
End Sub


Private Sub CmdSave_Click()
Dim StrFn As String
With CommonDialog1
.Filter = "BitMap Format |*.bmp"
.ShowSave
StrFn = UCase(.FileName)
If StrFn <> "" Then
SavePicture Pic1.Image, StrFn
End If
End With
End Sub


Private Sub Form_Load()
Dim IntI As Integer
Pic1.AutoRedraw = True
Pic1.BackColor = QBColor(15)
Pic1.ScaleMode = vbPixels
Pic1.MousePointer = vbCrosshair

'Set Color Box
For IntI = 0 To 15
LBLColor(IntI).BackColor = QBColor(IntI)
Next

'Set CurrentColor
LngColor = 0
LBLCurrentColor.BackColor = QBColor(LngColor)

'Fill Draw Width 1 to 5 in ComboBox
For IntI = 1 To 5
CboLineSize.AddItem IntI
Next
'Set DrawWidth to 1
CboLineSize.ListIndex = 0
IntLineSize = Val(CboLineSize.Text)
Pic1.DrawWidth = IntLineSize


'Set Drawing Line Option
OptLine.Value = True

End Sub


Private Sub LBLColor_Click(Index As Integer)
LngColor = LBLColor(Index).BackColor
LBLCurrentColor.BackColor = LngColor
End Sub


Private Sub Pic1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
IntOldX = X
IntOldY = Y
End Sub


Private Sub Pic1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim IntI As Integer, IntR As Integer, IntA As Integer
Dim SngPI As Single
SngPI = 4 * Atn(1)
Randomize Timer
If Button = 1 Then
If OptLine.Value = True Then
Pic1.Line (IntOldX, IntOldY)-(X, Y), LngColor
IntOldX = X
IntOldY = Y
ElseIf OptSpray.Value = True Then
For IntI = 1 To 10
IntA = Rnd * 2 * SngPI
IntR = Rnd * 15
Pic1.PSet (X + IntR * Cos(IntA), Y + IntR * Sin(IntA)), LngColor
Next
End If

End If
End Sub

setroyd
شنبه 06 اردیبهشت 1393, 22:48 عصر
اولا که موضوع رو اشتباه گفتید نوشتم نه ! در واقع پیدا کردین اینها متد های گرافیکی هستند که فوق العاده راحت هست کار باهاش شما نیازی به توضیح ندارین چون چیزی نیست که بشه توضیح داد ! متد مثل line ,pset ,circle و.......... شما برو یه کتاب دانلود کن درباره ی کار با متد گرافیکی بهتره من الان دنیایی هم توضیح بدم شما نمیتونی درک کنیش ! چون تو زمینه برنامه نویسی معلومه تازه واردی ! چون این کدهای ساده رو که نتونی باهاش کنار بیای با توضیح ها هم نمیتونی . و برای تشخیص کد رو نزار برنامه رو upload کن راحت تره .