|
|
|
|
|
Dicas
|
|
Visual Basic (Forms/MDI)
|
|
|
Título da Dica: Stretch imagem num form MDI
|
|
|
|
Postada em 25/2/2002 por MarceloGomes
Primeiro, dentro do form MDI, crie 3 objetos PictureBox, sendo que o Picture3 agrupa o Picture2 e Picture1 (ou seja, desenhe primeiro o Picture3 e depois desenhe o Picture1 e o Picture2 dentro do Picture3). Coloque o Picture3 e o Picture1 do tamanho total do MDI. Deixe o Picture2 num tamanho normal.
Depois, nas declaracoes do MDI, coloque o seguinte:
Type BITMAP '24 bytes bmType As Long bmWidth As Long bmHeight As Long bmWidthBytes As Long bmPlanes As Integer bmBitsPixel As Integer bmBits As Long End Type Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Public Sub ResizeWallpaper() Dim Rc As RECT hMDIClientwnd& = FindWindowEx(Me.hWnd, 0, "MDIClient", vbNullString) GetWindowRect hMDIClientwnd&, Rc iWidth% = Rc.Right - Rc.Left ' = rc.Width iHeight% = Rc.Bottom - Rc.Top ' = rc.Height Picture2.Width = iWidth% * Screen.TwipsPerPixelX Picture2.Height = iHeight% * Screen.TwipsPerPixelY ' Stretch Picture to fit size of the MDI ' Client area StretchBlt Picture2.hdc, 0, 0, iWidth%, iHeight%, Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, vbSrcCopy Me.Picture = Picture2.Image ' Set the new Picture End Sub
Feito isso, coloque isto no MDI.Load..
Picture1.Visible = False Picture2.Visible = False Picture3.Visible = False Picture1.Container = Picture3 Picture2.Left = 0 Picture2.Top = 0 Picture1.Left = 0 Picture1.Top = 0 Picture1.ScaleMode = vbPixels
Após isso feito, no evento Resize do MDI, coloque isso:
ResizeWallpaper
Pronto. Está feito.
|
|
|
|
|