Sto invecchiando!
non capisco la necessità di usare maschere strane.
Per le mie limitate conoscenze non credo si possa modificare una MDIForm in base alla struttura di una sua MDIChild, quindi la Form di forma generica dovrebbe avere la proprietà MDIChild=False ed essere peciò indipendente.
Per ottenere una Form creativa puoi usare le API.
Per esempio Ti espongo il sorgente di una Form a forma di stella; apri una nuova Form nel Tuo progetto ed incolla totalmente il codice:
Option Explicit
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function Polygon Lib "gdi32" (ByVal hDC As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Const WINDING = 2
Private Const PS_SOLID = 1
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function 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) As Long
Private Const HWND_TOPMOST = -1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Type POINTAPI
X As Long
Y As Long
End Type
'
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
Private Sub Form_Load()
Dim ret As Long
Dim Lx As Long, Ly As Long
With MDIForm1
'centro la maschera sulla MDI
Lx = .Left + (.Width - Me.Width) / 2
Ly = .Top + (.Height - Me.Height) / 2
Lx = Lx / Screen.TwipsPerPixelX
Ly = Ly / Screen.TwipsPerPixelY
'la espongo
ret = SetWindowPos(hwnd, HWND_TOPMOST, Lx, Ly, 0, 0, SWP_NOSIZE)
End With
Me.BackColor = &HFFFF&
'la ritaglio
RitagliaForm
End Sub
Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'permette lo spostamento del form con il cursore del mouse
Dim ReturnVal As Long
If Button = 1 Then
X = ReleaseCapture()
ReturnVal = SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
End Sub
Sub RitagliaForm()
Const NUM_PTS = 11
Dim ret As Long
Dim pts(1 To NUM_PTS) As POINTAPI
Dim rgn As Long
Dim old_rgn As Long
Dim pen As Long
Dim old_pen As Long
pts(1).X = 60: pts(1).Y = 310
pts(2).X = 100: pts(2).Y = 190
pts(3).X = 0: pts(3).Y = 120
pts(4).X = 120: pts(4).Y = 120
pts(5).X = 160: pts(5).Y = 0
pts(6).X = 200: pts(6).Y = 120
pts(7).X = 330: pts(7).Y = 120
pts(8).X = 230: pts(8).Y = 190
pts(9).X = 260: pts(9).Y = 310
pts(10).X = 160: pts(10).Y = 240
pts(11).X = 60: pts(11).Y = 310
rgn = CreatePolygonRgn(pts(1), NUM_PTS, WINDING)
old_rgn = SetWindowRgn(hwnd, rgn, True)
'il bordo dell'immagine è rosso
pen = CreatePen(PS_SOLID, 2, vbRed) 'oppure dello stesso colore della Form = &HFFFF&
old_pen = SelectObject(hDC, pen)
ret = Polygon(hDC, pts(1), NUM_PTS)
pen = SelectObject(hDC, old_pen)
ret = DeleteObject(pen)
Me.Refresh
End Sub
Questo esempio l'ho rubato da un'altro Forum (un po' datato), dal quale puoi prelevare un programma per la generazione di una Form da un'immagine fatto da Claudio Gucchierato.
Il link del forum è:
da cui puoi prelevare il programma di installazione di 'Shape Creator':
che installa un programmino di 209 Kb decisamente simpatico