Note that there are some explanatory texts on larger screens.

plurals
  1. POhow can i change form shape in vb.net
    primarykey
    data
    text
    <p>I used to change the Form shape in VB 6.0 using the following code:</p> <pre><code>Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 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 Sub MakeRoundObject(objObject As Object, Value As Long) Static lngHeight, lngLong, lngReturn, lngWidth As Long lngWidth = objObject.Width / Screen.TwipsPerPixelX lngHeight = objObject.Height / Screen.TwipsPerPixelY SetWindowRgn objObject.hWnd, CreateRoundRectRgn(10, 50, lngWidth, lngHeight, Value + 10, Value), True End Sub Private Sub Form_Load() Call MakeRoundObject(Form1, 50) End Sub </code></pre> <p>In the same way I used VB.NET code as follows:</p> <pre><code>Imports Microsoft.VisualBasic.Compatibility Public Class Form1 Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer, ByVal X3 As Integer, ByVal Y3 As Integer) As Integer Private Declare Function ReleaseCapture Lib "user32" () As Integer Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Integer, ByVal hRgn As Integer, ByVal bRedraw As Boolean) As Integer Private Sub MakeRoundObject(ByRef objObject As Object, ByRef Value As Integer) Static lngLong, lngHeight, lngReturn As Object Static lngWidth As Integer lngWidth = objObject.Width / VB6.TwipsPerPixelX lngHeight = objObject.Height / VB6.TwipsPerPixelY SetWindowRgn(objObject.hWnd, CreateRoundRectRgn(0, 0, lngWidth, lngHeight, Value, Value), True) End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load MakeRoundObject(Me, 20) End Sub End Class </code></pre> <p>But in the latter case, I receive an error message - "Public member 'hWnd' on type 'Form1' not found."</p> <p>What I do?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload