0/5 (8 avis)
Vue 8 703 fois - Téléchargée 810 fois
' Ce projet a besoin d'un controle PictureBox Option Explicit 'The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order. Private Declare Sub SetWindowPos Lib "USER32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) 'Fonctions pour déplacer la fenetre 'The ReleaseCapture function releases the mouse capture from a window in the current thread and restores normal mouse input processing. Private Declare Function ReleaseCapture Lib "USER32" () As Long 'The SendMessage function sends the specified message to a window or windows. The function calls the window procedure for the specified window and does not return until the window procedure has processed the message. The PostMessage function, in contrast, posts a message to a threads message queue and returns immediately. Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long 'declaration des constantes Const WM_NCLBUTTONDOWN = &HA1 Const HTCAPTION = 2 Const RGN_OR = 2 Const HWND_TOPMOST = -1 Const HWND_NOTOPMOST = -2 Const SWP_NOSIZE = &H1 Const SWP_NOMOVE = &H2 Const SWP_NOACTIVATE = &H10 Const SWP_SHOWWINDOW = &H40 Private Sub Form_Load() ' si erreur continue ( par exemple si pas de fichier logo.bmp alors on a l'image déjà présente dans le controle ' picture box On Error Resume Next 'Repositionnne l'image Picture1.Left = 0 Picture1.Top = 0 Picture1.Appearance = 0 ' apparence=Flat Picture1.AutoSize = True ' Redimensionne le controle picture box à la taille de l'image 'Charge L'image avec le fichier image.bmp présent dans le répertoire de l'apli Picture1 = LoadPicture(App.Path + "\Logo.bmp") 'Redimensione la forme selon la taille de l'image Me.Height = Picture1.Height Me.Width = Picture1.Width ' la fenetre est mise toujours au premier plan SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE End Sub ' click bouton droit = deplacement de la forme ' click autre bouton = fin application Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'Pour déplacer la form If Button = 1 Then ReleaseCapture SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0& Else ' un autre bouton ferme l'application Unload Me End If End Sub
5 juin 2008 à 02:02
@+ Sator
2 juil. 2005 à 16:08
27 oct. 2004 à 10:26
27 oct. 2004 à 10:25
19 févr. 2004 à 23:28
merci cuq.
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.