Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not classic form

Status
Not open for further replies.

Marianowo

IS-IT--Management
Feb 16, 2004
12
AR
Hi
how can i do a round form. Not a classic box form. with bevel corners, or using an image for my form?
Tnx
Mariano
 
have a look at thread222-444672

good luck

If somethings hard to do, its not worth doing - Homer Simpson
 
i need only transparent form but i nedd to can see my objects.likew textbox, picture, etc...
TNX
Mariano
 
I just had some fun with paths and regions for clipping portions of the form.

You may try this method if you wish.

Start a new project and insert the following code in Form1.
___
[tt]
Option Explicit
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 StrokeAndFillPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim Char As Long
Dim U As Long, V As Long
Private Sub Form_Load()
FillColor = &H800000 'navy
ForeColor = vbCyan
ScaleMode = vbPixels
AutoRedraw = True
FillStyle = vbSolid
Char = 33
Font = "Webdings"
FontSize = 144
Form_KeyUp 0, 0
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyUp, vbKeyRight
Char = Char + 1
Case vbKeyDown, vbKeyLeft
Char = Char - 1
End Select
If Char = 256 Then Char = 33
If Char = 32 Then Char = 255
Cls
BeginPath hdc
Print Chr$(Char)
EndPath hdc
StrokeAndFillPath hdc
Dim P As POINTAPI
ClientToScreen hwnd, P
CurrentX = P.X - Left \ Screen.TwipsPerPixelX
CurrentY = P.Y - Top \ Screen.TwipsPerPixelY
BeginPath hdc
Print Chr$(Char)
EndPath hdc
SetWindowRgn hwnd, PathToRegion(hdc), True
Caption = Char
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
U = X: V = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then _
Move Left + (X - U) * Screen.TwipsPerPixelX, _
Top + (Y - V) * Screen.TwipsPerPixelY
End Sub[/tt]
___

Now run the program. Press Up/Down keys to change the shape of the form.

Besides this, you may also try the SetLayeredWindowAttributes function. I mentioned both methods in thread222-493597. But note that this function is supported on Windows 2000 and XP only.
 
:| ups.... great code... thank you very much Hypetia!
this code rules!
(Y)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top