Ultra Phonic 2 (Ex-Member)
Pro
Messaggi: 181
Iscritto: 15/09/2008
|
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 |
Dim i As Integer Private Sub Command1_Click() On Error Resume Next Load Form1.btn(i) Form1.btn(i).Left = 0 Form1.btn(i).Top = i * 0 Form1.btn(i).Visible = True Form1.btn(i).Caption = "Button" & i + 1 Load Form1.resiz(i) Form1.resiz(i).Left = 960 Form1.resiz(i).Top = i * 240 Form1.resiz(i).Visible = True i = i + 1 End Sub Private Sub MDIForm_Load() Form1.Show i = 0 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 |
Option Explicit Private Declare Function ReleaseCapture Lib "user32" () As Long 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 Const HTCAPTION = 2 Const WM_NCLBUTTONDOWN = &HA1 Dim Index As Integer Dim Indexa As Integer Private Sub btn_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) Indexa = Index resiz(Indexa).Top = btn(Index).Height - 135 resiz(Indexa).Left = btn(Index).Width - 135 resiz(Indexa).Visible = True ReleaseCapture SendMessage btn(Index).hWnd, &HA1, 2, 0& SendMessage resiz(Indexa).hWnd, &HA1, 2, 0& If Indexa <> Index Then resiz(Indexa).Visible = False Indexa = Index resiz(Indexa).Visible = True End If End Sub Private Sub Form_Click() resiz(Indexa).Visible = False End Sub Private Sub resiz_MouseDown(Indexa As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) ReleaseCapture SendMessage resiz(Indexa).hWnd, &HA1, 2, 0& btn(Index).Width = resiz(Indexa).Left + 135 btn(Index).Height = resiz(Indexa).Top + 135 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 |