PDA

View Full Version : سوال: طراحی skin با عکس



xxnagin
جمعه 23 آبان 1393, 21:34 عصر
سلام
من چطوری میتونم از این مدل عکسها در skin استفاده کنم
اگه یه کامپوننت درست بشه حداقل یکم از کد نویسیش کم میشه
125692
اینم نمونه vb6 که با فایل های ini ساخته شده
http://www.planet-source-code.com/Upload_PSC/ScreenShots/PIC20045251622533678.jpg
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=54014&lngWId=1

من با این کد درست میکنم مشکلی نداره فقط کد نویسیش خیلی میشه


Friend Sub setimage(Source As PictureBox, x As Integer, y As Integer, w As Integer, h As Integer, Destination As PictureBox)
Dim bmp As New Bitmap(w, h)
Using gr As Graphics = Graphics.FromImage(bmp)
Dim dst As New RectangleF(0, 0, w, h)
Dim src As New RectangleF(x, y, w, h)
gr.DrawImage(Source.Image, dst, src, GraphicsUnit.Pixel)
End Using
Destination.Image = bmp
End Sub


مثلا
این کد برای دکمه play در لود فرم
setimage(a2, 24, 0, 24, 18, btn_play)

اینم برای خود دکمه هستش و که به دکمه و به دکمه شبیه باشه

Private Sub btn_Play_MouseDown(sender As Object, e As MouseEventArgs) Handles btn_play.MouseDown
setimage(a2, 24, 0, 24, 18, btn_play)
End Sub
Private Sub btn_Play_MouseMove(sender As Object, e As MouseEventArgs) Handles btn_play.MouseMove
setimage(a2, 24, 19, 24, 18, btn_play)
End Sub
Private Sub btn_Play_MouseLeave(sender As Object, e As EventArgs) Handles btn_play.MouseLeave
setimage(a2, 24, 0, 24, 18, btn_play)
End Sub