PDA

Click to See Complete Forum and Search --> : how do i add skins


BoB
Nov 17th, 1999, 07:14 PM
hey how do i make and add skins to my program like winamp

Jazz
Nov 18th, 1999, 04:23 AM
Right Click the WinAmp Icon on the right (Lightning Icon), Options, Skin Browser...

BoB
Nov 18th, 1999, 05:30 AM
No how do i make it where people can add skins to my program

BoB
Nov 18th, 1999, 05:30 AM
No how do i make it where people can add skins to my program

funkheads
Nov 24th, 1999, 06:28 PM
you have to first make the form transparent. then make a picturebox and make it transparent. then set the .bmp that you will be wanting to use as your "skin" inside your picturebox. BTW: to save on system resources, make sure to resize your form to the size of the picturebox (which should be the size of the .bmp). that's the really simplified version. i hope that helps get you started. happy programming!!

michael

here is the .bas file code. you can do your form how you want to with the picturebox and whatnot. (don't forget to call these functions and include the form/picturebox in the parameters.)

Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long


Sub FormLoad(frm As Form)

Dim maskcolor As Long 'declare variable for the transparent color

'set transparent color as great pink
maskcolor = RGB(255, 0, 255)

'perform function to make windows transparent
TransBack 0, 0, frm.Width / 15, frm.Height / 15, maskcolor, frm.hdc, frm.hwnd

End Sub

Sub PicLoad(pic As PictureBox)

Dim maskcolor As Long 'declare variable for the transparent color

'set transparent color as great pink
maskcolor = RGB(255, 0, 255)

'perform function to make pictures transparent
TransBack 0, 0, pic.Width / 15, pic.Height / 15, maskcolor, pic.hdc, pic.hwnd

End Sub

Private Sub TransBack(ByVal xstart As Long, ByVal ystart As Long, ByVal xend As Long, ByVal yend As Long, ByVal bgcolor As Long, ByVal thdc As Long, ByVal thWnd As Long)

'declare region variables
Dim rgn2 As Long, rgn3 As Long, rgn4 As Long

'declare substitute variables for the function parameters
Dim Top As Long, Left As Long, Right As Long, Bottom As Long, temptop As Long

'create some region buffers
rgn = CreateRectRgn(0, 0, 0, 0)
rgn2 = CreateRectRgn(0, 0, 0, 0)
rgn3 = CreateRectRgn(0, 0, 0, 0)

'this loop picks out the transparent colors,
'there MUST be three loops or Windows has a hard
'time handling the complex regions

Left = xstart
Right = (xend - xstart) + 1: Bottom = (yend - ystart) + 1

Do While Left < Right 'go through and scan left to right
Top = ystart
Do While Top < Bottom 'go through and scan top to botom
If GetPixel(thdc, Left, Top) <> bgcolor Then
temptop = Top
Do While GetPixel(thdc, Left, Top + 1) <> bgcolor
Top = Top + 1
If Top = Bottom Then Exit Do
Loop
rgn4 = CreateRectRgn(Left, temptop, Left + 1, Top + 1)
CombineRgn rgn3, rgn2, rgn2, 5
CombineRgn rgn2, rgn4, rgn3, 2
DeleteObject rgn4
End If
Top = Top + 1
Loop
CombineRgn rgn3, rgn, rgn, 5
CombineRgn rgn, rgn2, rgn3, 2
DoEvents
Left = Left + 1
Loop

DeleteObject rgn2
SetWindowRgn thWnd, rgn, True

End Sub