Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Visual Basic 6 - Immmagine resize oggetto
Forum - Visual Basic 6 - Immmagine resize oggetto

Avatar
Ultra Phonic 2 (Ex-Member)
Pro


Messaggi: 181
Iscritto: 15/09/2008

Segnala al moderatore
Postato alle 12:10
Martedì, 30/06/2009
Ciao a tutti, dopo tanto tempo posto di nuovo sul forum.

Ho un grave problema:

allora ho un form mdi, ed un mdichild,
e dal frm mdi, tramite un pulsante faccio questa azione:
Codice sorgente - presumibilmente VB.NET

  1. Dim i As Integer
  2. Private Sub Command1_Click()
  3. On Error Resume Next
  4.         Load Form1.btn(i)
  5.         Form1.btn(i).Left = 0
  6.         Form1.btn(i).Top = i * 0
  7.         Form1.btn(i).Visible = True
  8.         Form1.btn(i).Caption = "Button" & i + 1
  9.         Load Form1.resiz(i)
  10.         Form1.resiz(i).Left = 960
  11.         Form1.resiz(i).Top = i * 240
  12.         Form1.resiz(i).Visible = True
  13.         i = i + 1
  14.      
  15. End Sub
  16. Private Sub MDIForm_Load()
  17. Form1.Show
  18. i = 0
  19. End Sub


e così si creano oggetti ogni volta che si clicca il cmd.

nel form 1 ho questo codice:
Codice sorgente - presumibilmente VB.NET

  1. Option Explicit
  2. Private Declare Function ReleaseCapture Lib "user32" () As Long
  3. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
  4. Const HTCAPTION = 2
  5. Const WM_NCLBUTTONDOWN = &HA1
  6. Dim Index As Integer
  7. Dim Indexa As Integer
  8. Private Sub btn_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  9. Indexa = Index
  10. resiz(Indexa).Top = btn(Index).Height - 135
  11. resiz(Indexa).Left = btn(Index).Width - 135
  12. resiz(Indexa).Visible = True
  13. ReleaseCapture
  14.     SendMessage btn(Index).hWnd, &HA1, 2, 0&
  15.     SendMessage resiz(Indexa).hWnd, &HA1, 2, 0&
  16.     If Indexa <> Index Then
  17.     resiz(Indexa).Visible = False
  18.     Indexa = Index
  19.     resiz(Indexa).Visible = True
  20.     End If
  21. End Sub
  22. Private Sub Form_Click()
  23. resiz(Indexa).Visible = False
  24. End Sub
  25. Private Sub resiz_MouseDown(Indexa As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  26. ReleaseCapture
  27.     SendMessage resiz(Indexa).hWnd, &HA1, 2, 0&
  28.     btn(Index).Width = resiz(Indexa).Left + 135
  29.     btn(Index).Height = resiz(Indexa).Top + 135
  30. End Sub



il problema che ho, è quello che ogni picture resiz, non si sposta insieme al proprio btn, e compaiono e scompaiono come gli pare e piace, invece devono restare sempre nell'estremità del btn, e ogni volta che se ne clicca uno di qualsiasi index, devono apparire tutte, e se si clicca il form, devono scomparire tutte.

qualcuno può aiutarmi? :(

grazie

PM Quote
Avatar
Ultra Phonic 2 (Ex-Member)
Pro


Messaggi: 181
Iscritto: 15/09/2008

Segnala al moderatore
Postato alle 13:36
Martedì, 30/06/2009
Risolto, era un user control, che dava problemi, ed alcuni pezzi di code incompleto:k:

Ultima modifica effettuata da Ultra Phonic 2 il 30/06/2009 alle 17:34
PM Quote