|
|
|
|
|
Dicas
|
|
Visual Basic (Forms/MDI)
|
|
|
Título da Dica: Crinado um Form com Cantos Arredondados
|
|
|
|
Postada em 14/8/2000 por Webmaster
webmaster@vbweb.com.br
Você pode criar facilmente Forms ou controles usando o código a seguir:
'Coloque num Form coloque um CommandButton 'chamado Command1.
'No Declarations: 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 Declare Function GetClientRect Lib "user32" _ (ByVal hWnd As Long, lpRect As Rect) As Long Private Type Rect Left As Long Top As Long Right As Long Bottom As Long End Type
Sub Retangulo(m_hWnd As Long, Fator As Byte) Dim RGN As Long Dim RC as Rect Call GetClientRect(m_hWnd, RC) RGN = CreateRoundRectRgn(RC.Left, RC.Top, RC.Right, _ RC.Bottom, Fator, Fator) SetWindowRgn m_hWnd, RGN, True End Sub 'Fator é a distância da curvatura do canto arredondado
'No evento click do CommandButton: Private Sub Command1_Click() Me.BackColor = &H808080 'Apenas para destacar a cor 'Coloca o formulário com os cantos arredondados 'e fator 80 de área Retangulo Me.hWnd, 80 Retangulo Command1.hWnd, 30 End Sub
|
|
|
|
|