VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Convert forms into the shape of the text

by rajiv (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 8th July 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Convert forms into the shape of the text

API Declarations


Private Declare Function BeginPath Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function EndPath Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function PathToRegion Lib "gdi32" (ByVal hDC As Long) 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_COPY = 5

Rate Convert forms into the shape of the text




Const txt = "Bedazzled"

Dim hRgn As Long

    BorderStyle = vbBSNone
    Caption = ""

    BackColor = &H80000001

    ' big font.
    Font.Name = "Comic Sans MS"
    Font.Bold = True
    Font.Size = 50

    ' form big enough.
    Width = TextWidth(txt)
    Height = TextHeight(txt)

    '  clipping path.
    BeginPath hDC
    CurrentX = 0
    CurrentY = 0
    Print txt
    EndPath hDC

 
    hRgn = PathToRegion(hDC)

        SetWindowRgn hwnd, hRgn, False

    ' Position the form.
    Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2




Download this snippet    Add to My Saved Code

Convert forms into the shape of the text Comments

No comments have been posted about Convert forms into the shape of the text. Why not be the first to post a comment about Convert forms into the shape of the text.

Post your comment

Subject:
Message:
0/1000 characters