|
|
|
|
|
Dicas
|
|
Visual Basic (Forms/MDI)
|
|
|
Título da Dica: Criando um Form Elíptico
|
|
|
|
Postada em 14/8/2000 por Webmaster
webmaster@vbweb.com.br
Poucos programas utilizam esse recurso do Windows 95 que cria Forms e até mesmmo outros objetos em forma elíptica.
'Coloque num Form coloque um CommandButton 'chamado Command1.
'No Declarations: Private Declare Function CreateEllipticRgn 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 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 Eliptico(m_hWnd As Long) Dim RGN As Long Dim RC as Rect Call GetClientRect(m_hWnd, RC) RGN = CreateEllipticRgn(RC.Left, RC.Top, RC.Right, _ RC.Bottom) SetWindowRgn m_hWnd, RGN, True End Sub
'No evento click do CommandButton: Private Sub Command1_Click() Me.BackColor = &H808080 'Apenas para destacar a cor Eliptico Me.hWnd 'O formulário fica Elíptico Eliptico Command1.hWnd 'O botão fica Elíptico End Sub
|
|
|
|
|