rectangular form example

August 16, 2008 by admin  
Filed under Visual Basic

this example shows how to create a rectangular form in Visual basic

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 SetWindowRgn Lib “user32″ (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib “gdi32.dll” (ByVal hObject As Long) As Long

Private Sub Command1_Click()

End

End Sub

Private Sub Form_Load()

Dim fwidth As Long, fheight As Long
Dim rval As Long, nhwnd As Long
fwidth = Me.Width / Screen.TwipsPerPixelX
fheight = Me.Height / Screen.TwipsPerPixelY
nhwnd = CreateRectRgn(0, 0, fwidth / 2, fheight / 2)
rval = SetWindowRgn(Me.hWnd, nhwnd, True)
rval = DeleteObject(nhwnd)
End Sub

Related posts:

  1. Screen capture Screen capture using Visual Basic Private Declare Sub keybd_event Lib...
  2. show amount of lines in a multi line textbox Public Declare Function SendMessageLong Lib “user32″ Alias “SendMessageA” (ByVal hwnd...
  3. Get screen resolution with Visual Basic This Visual Basic example will find out your current screen...
  4. beep Private Declare Function Beep Lib “kernel32″ _ (ByVal dwFreq As...
  5. change drive name Private Declare Function SetVolumeLabelA Lib “kernel32″ _ (ByVal lpRootPathName As...

Related posts brought to you by Yet Another Related Posts Plugin.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!