Results 1 to 4 of 4

Thread: Can I make a borderless window like circles etc?

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    2
    I have seen the skins on Windows Media Player that are windows without borders in any shape that the designer wanted. Is there any way to do that in VB? no corners... how do they do that? =) Can we do it?

    cheers

    Dredge

  2. #2
    Guest
    Are you talking about making your form a different shape?

    http://www.vb-world.net/articles/shapedforms/

  3. #3
    Hyperactive Member theman32x's Avatar
    Join Date
    May 2000
    Location
    New Jersey, USA
    Posts
    305
    since we're on the topic of irregular shaped forms ... anyone know how to get rid of the outline ... u know when u make a form a circle and then u drag it u can still see that the form is an rectangle by its outline ...

  4. #4
    Lively Member
    Join Date
    Dec 2000
    Location
    India, Chennai
    Posts
    121

    Cool You can Do it in VB...

    Hi this is the API that Changes the Form to Any Desired Shape. These Functions I used from other Guys, Program. If you need a Detail Description and usage, goto
    http://www.planet-source-code.com, select source as vb from the right hand side link and from there you can see a project named skindemo. Get into it and download the code. It's really a good stuff...

    But One Drawback is that, I can't Understand what the Code does....?

    'Main Function to Change the Mask of a Basic Form...

    Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
    Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
    Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
    Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
    Private Declare Function ReleaseCapture Lib "user32" () As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long

    Private Const RGN_OR = 2
    Private lngRegion As Long
    Public Prg As String, Sect As String ' for savesettings
    Public skindir As String


    Function RegionFromBitmap(picSource As PictureBox, Optional lngTransColor As Long) As Long

    'it lets your form me any shape. *

    Dim lngRetr As Long, lngHeight As Long, lngWidth As Long
    Dim lngRgnFinal As Long, lngRgnTmp As Long
    Dim lngStart As Long, lngRow As Long
    Dim lngCol As Long
    If lngTransColor& < 1 Then
    lngTransColor& = GetPixel(picSource.hDC, 0, 0)
    End If
    lngHeight& = picSource.Height / Screen.TwipsPerPixelY
    lngWidth& = picSource.Width / Screen.TwipsPerPixelX
    lngRgnFinal& = CreateRectRgn(0, 0, 0, 0)
    For lngRow& = 0 To lngHeight& - 1
    lngCol& = 0
    Do While lngCol& < lngWidth&
    Do While lngCol& < lngWidth& And GetPixel(picSource.hDC, lngCol&, lngRow&) = lngTransColor&
    lngCol& = lngCol& + 1
    Loop
    If lngCol& < lngWidth& Then
    lngStart& = lngCol&
    Do While lngCol& < lngWidth& And GetPixel(picSource.hDC, lngCol&, lngRow&) <> lngTransColor&
    lngCol& = lngCol& + 1
    Loop
    If lngCol& > lngWidth& Then lngCol& = lngWidth&
    lngRgnTmp& = CreateRectRgn(lngStart&, lngRow&, lngCol&, lngRow& + 1)
    lngRetr& = CombineRgn(lngRgnFinal&, lngRgnFinal&, lngRgnTmp&, RGN_OR)
    DeleteObject (lngRgnTmp&)
    End If
    Loop
    Next
    RegionFromBitmap& = lngRgnFinal&
    End Function

    Sub ChangeMask()
    On Error Resume Next ' In case of error

    Dim lngRetr As Long
    lngRegion& = RegionFromBitmap(Mask)
    lngRetr& = SetWindowRgn(Me.hWnd, lngRegion&, True)
    End Sub



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width