当前位置:编程学习 > VB >>

VB 怎样实现圆角窗体?

会的朋友请直接给出代码,或详细的操作方法。

追问:VB 6.0的该怎么设置?(不是VB.net)

 

答案:VB.net 示例:
1.将窗体设置为无边框模式。
2.代码


Declare Function CreateRoundRectRgn Lib "gdi32" Alias "CreateRoundRectRgn" (ByVal X1 As Int32, ByVal Y1 As Int32, ByVal X2 As Int32, ByVal Y2 As Int32, ByVal X3 As Int32, ByVal Y3 As Int32) As Int32
    Declare Function SetWindowRgn Lib "user32" Alias "SetWindowRgn" (ByVal hWnd As Int32, ByVal hRgn As Int32, ByVal bRedraw As Boolean) As Int32   ‘GDI重绘API


    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim r As Integer = CreateRoundRectRgn(0, 0, Me.Width, Me.Height, 20, 20)
        'CreateRoundRectRgn参数([窗体左],[窗体顶],[窗体宽],[窗体高],[向左偏移大小],[向下偏移大小])
        SetWindowRgn(Me.Handle, r, True)
    End Sub

能 搞个控件就行名字叫CocoButtonXP.ocx 找不到可以加我 346263509

上一个:vb 压缩保存图片?
下一个:vb的代码编写

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,