Visual Basic, .NET, ASP, VBA, VBScript
 
  Библиотека кодов  
  Работа с формой  
     
  Тень от формы  
 

Автор: Винокуров К.

Этот код показывает, как нарисовать тень от формы.
'КОД ФОРМЫ
Option Explicit
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Sub Form_Load()
     SetParent picShadow.hwnd, GetDesktopWindow
     SetProc hwnd
End Sub

'КОД МОДУЛЯ
Option Explicit
Private Declare Function CallWindowProcA Lib "user32" (ByVal lpPrevWndFunc As Long, ByVal lngHandle As Long, ByVal lngMsg As Long, ByVal lngFirstParam As Long, ByVal lngLastParam As Long) As Long
Private Declare Function SetWindowLongA Lib "user32" (ByVal lngHandle As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private lngOldProc As Long
Public Sub SetProc(ByVal lngHandle As Long)
     lngOldProc = SetWindowLongA(lngHandle, -4, AddressOf WinProc)
End Sub
Private Function WinProc(ByVal lngHandle As Long, ByVal lngMsg As Long, ByVal lngFirstParam As Long, ByVal lngLastParam As Long) As Long
     If lngMsg = &H3 Then
         frmMain.picShadow.Move frmMain.Left, frmMain.Top
         DoEvents
         BitBlt frmMain.picShadow.hDC, 0, 0, frmMain.picShadow.Width, frmMain.picShadow.Height, GetDC(0), frmMain.picShadow.Left / Screen.TwipsPerPixelX + 30, frmMain.picShadow.Top / Screen.TwipsPerPixelY + 30, vbSrcCopy
         frmMain.picShadow.Line (0, 0)-(frmMain.picShadow.ScaleWidth, frmMain.picShadow.ScaleHeight), vbGrayText, BF
         frmMain.picShadow.Move frmMain.Left + (30 * Screen.TwipsPerPixelX), frmMain.Top + (30 * Screen.TwipsPerPixelY), frmMain.Width, frmMain.Height
     End If
     WinProc = CallWindowProcA(lngOldProc, lngHandle, lngMsg, lngFirstParam, lngLastParam)
End Function
 
     
  VBNet online (всего: 51608)  
 

Логин:

Пароль:

Регистрация, забыли пароль?


В чате сейчас человек
 
     
  VBNet рекомендует  
   
     
  Лучшие материалы  
 
ActiveX контролы (112)
Hitman74_Library (36119)
WindowsXPControls (20739)
FlexGridPlus (19374)
DSMAniGifControl (18295)
FreeButton (15157)
Примеры кода (546)
Parol (18027)
Passworder (9299)
Screen saver (7654)
Kerish AI (5817)
Folder_L (5768)
Статьи по VB (136)
Мое второе впечатление... (11236)
VB .NET: дорога в будущее (11161)
Основы SQL (9225)
Сообщения Windows в Vi... (8788)
Классовая теория прогр... (8619)
 
     
Техническая поддержка MTW-хостинг | © Copyright 2002-2011 VBNet.RU | Пишите нам