Formular mit runden Ecken

CreateRoundRectRgn&, SetWindowRgn, RoundRect&, LoadIconBynum&, DrawIcon
Private Enum SystemIcons
  IDI_APPLICATION = 32512&  EXE-Symbol.
  IDI_ASTERISK = 32516&     Info-Zeichen.
  IDI_EXCLAMATION = 32515&  Warndreieck schwarz/gelb.
  IDI_HAND = 32513&         Weißes Kreuz auf rotem Hintergrund.
  IDI_QUESTION = 32514&     Fragezeichen in Spruchblase.
End Enum
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)
Private Declare Function SetWindowRgn Lib "user32" _
 (ByVal hwnd As Long, ByVal hRgn As Long, _
 ByVal bRedraw As Long) As Long
Private Declare Function RoundRect& Lib "gdi32" (ByVal hDC As Long, _
 ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, _
 ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long)
Private Declare Function LoadIconBynum& Lib "user32" Alias _
 "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As Long)
Private Declare Function DrawIcon Lib "user32" (ByVal hDC As Long, _
 ByVal X As Long, ByVal Y As Long, ByVal hIcon As Long) As Long
Private Declare Function FlashWindow Lib "user32" _
 (ByVal hwnd As Long, ByVal bInvert As Long) As Long
Private Sub FlashTimer_Timer()
  Static i%
  i = i Xor 1
  FlashWindow hwnd, i
End Sub
Private Sub Form_Load()
  Pic.Move 200, 200
  Pic.BackColor = BackColor
  Pic.BorderStyle = 0
  zeigeSymbol Pic, IDI_EXCLAMATION
  RundesFenster Me
End Sub
Private Sub RundesFenster(f As Form)
  Dim r&, dl&, MeWidth&, MeHeight&
  MeWidth = f.Width / Screen.TwipsPerPixelX
  MeHeight = f.Height / Screen.TwipsPerPixelY
  r = CreateRoundRectRgn(0, 0, MeWidth, MeHeight, 20, 20) Erzeugt Formular mit runden Ecken.
  dl = SetWindowRgn(f.hwnd, r, True)
  f.AutoRedraw = True
  RoundRect hDC, 0, 0, MeWidth - 1, MeHeight - 1, 20, 20 Height 20 - 20 = runde Ecken (200 - 200 erzeugt eine Ellipse).
End Sub
Private Sub zeigeSymbol(Pic As PictureBox, ByVal ImageNo&)
  Dim hIcon&
  hIcon = LoadIconBynum&(0, ImageNo) Lädt zur Laufzeit das Windows-Symbol.
  DrawIcon Pic.hDC, 0, 0, hIcon
End Sub
Private Sub Command1_Click()
  Unload Me
End Sub
Siehe auch "unregelmäßig geformte Fenster" auf Seite:  http://www.wbrnet.info/db/0501.html

 Ranking-Hits zurück Sitemap
Designed by www.wbrnet.info