rt

解决方案 »

  1.   

    可以把按钮,文本框,之类的控件画在PictureBox里。窗体恐怕不行
    如果你只是想在PictureBox中显示窗体的图象,可以用Bitblt函数Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = sourcePrivate Sub Command1_Click()
        Dim h As Long
        
        h = GetDC(Form1.hwnd)
        BitBlt Picture1.hDC, 0, 0, Form1.Width / Screen.TwipsPerPixelX, Form1.Height / Screen.TwipsPerPixelY, h, 0, 0, SRCCOPY
    End Sub
      

  2.   

    我不是想画在其中,而是把picture做为一个容器来使用
      

  3.   

    做容器也不可能把From放里面吧
    可以放控件进取,frame也可以的
      

  4.   

    Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal 窗体句柄 As Long, ByVal 控件句柄 As Long) As Long
      

  5.   

    要说的被WM_JAWIN说了~~给个代码吧(需要Form1、Form2两个窗体,Form1中有一个Picture1,以下代码在Form1中):Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As LongPrivate Sub Form_Load()
        SetParent Form2.hWnd, Picture1.hWnd
    End Sub
      

  6.   

    不好意思,漏了一句Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As LongPrivate Sub Form_Load()
        Form2.Show   '加上这句
        SetParent Form2.hWnd, Picture1.hWnd
    End Sub