プロが教える店舗&オフィスのセキュリティ対策術

vb2005での角の丸いフォームの作り方を教えてください。

vb6での作り方なら見つけたのですが、
vb2005で実行できるようにどう改良したらいいのか分かりません。
別のやり方でも良いので、どうか教えてください。

vb6の例
hRgn = CreateRoundRectRgn(0, 0, _
Me.Width / Screen.TwipsPerPixelX, _
Me.Height / Screen.TwipsPerPixelY, _
20, 20)
SetWindowRgn Me.hWnd, hRgn, True

A 回答 (2件)

Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal LeftRect As Integer, ByVal TopRect As Integer, ByVal RightRect As Integer, ByVal BottomRect As Integer, ByVal WidthEllipse As Integer, ByVal HeightEllipse As Integer) As Integer



Private Declare Function SetWindowRgn Lib "user32.dll" (ByVal hWnd As Integer, ByVal hRgn As Integer, ByVal bRedraw As Boolean) As Integer

Private Sub Form1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Click
Dim hRgn As Integer
Dim RightRect As Integer = VB6.PixelsToTwipsX(Me.Width) / VB6.TwipsPerPixelX
Dim BottomRect As Integer = VB6.PixelsToTwipsY(Me.Height) / VB6.TwipsPerPixelY
hRgn = CreateRoundRectRgn(0, 0, RightRect, BottomRect, 20, 20)
SetWindowRgn(Me.Handle.ToInt32, hRgn, True)
End Sub

で、試してください。
    • good
    • 0

<br /> 個人的には,Mono + Linuxとかの環境を考えるとWin32 APIに頼るのは得策ではないと考える。<br

> http://dobon.net/vb/dotnet/form/formregion.html
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!