Results 1 to 3 of 3

Thread: Shape a form by mask color?

  1. #1

    Thread Starter
    Lively Member Yok's Avatar
    Join Date
    Feb 2001
    Location
    Guangzhou,China
    Posts
    72
    some application can define it's form's shape by a bitmap'mask color (e.g. K-JOFOL,it' skin bitmap's magenta area make the form transparent).Can I do it with VB

  2. #2
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    Active X control

    There is a control that does exactly this, you can get it from hypermart.mozzysoft.com .Don't quote me on that. Andway, if you can't find it there, then it'll be on vbaccelerator.com.

    Hope you find it, I think it's called from-shaper or something.

    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  3. #3
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    much easier way. Check this out:
    Option Explicit

    Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
    Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long

    Private Sub Form_Load()
    Dim hr&, dl&
    Dim usew&, useh&
    usew& = form1.Width / Screen.TwipsPerPixelX
    useh& = form1.Height / Screen.TwipsPerPixelY
    hr& = CreateEllipticRgn(0, 0, usew, useh)
    dl& = SetWindowRgn(form1.hWnd, hr, True)

    End Sub
    You can reshape forms, buttons, etc. with this api call.
    Be sure and put it in the form_resize event as well, if applicable.
    Simply give the api call the handle to a region you created with any number of different api calls:
    CreateEllipticRgn
    CreatePolygonRgn
    CreateRectRgn
    Note: be sure to delete the region with DeleteObject api call when done with it. Otherwise, byebye resources. There are many ways to manipulate a region, even combine 2 of them in an and/or etc. (CombineRgn - duh)
    Have Fun! Experiment! Create forms with holes in them, etc! This is another often-overlooked function that is fun for the whole family! etc. etc. you get the idea...
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

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