我在"Text1"控件里写入了文字"你好",在"Picture1"里导入了一张图片,怎样实现单击Command1控件使得"Text1"的"你好"和"Picture1"的图片合并在一起(文字在前,后面显示图片),并且显示在"Picture2"呢? 

解决方案 »

  1.   

    Private Sub Command1_Click()
        Picture1.AutoRedraw = True
        Picture1.Print Text1.Text
        
        Picture2.PaintPicture Picture1.Image, 0, 0
    End Sub
      

  2.   

    '添加 Picture1  Picture2 Text1'Picture1请先装载一张图片Option Explicit
    Private Declare Function GdiTransparentBlt Lib "gdi32" (ByVal hdc1 As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal W1 As Long, ByVal H1 As Long, ByVal Hdc2 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal W2 As Long, ByVal H2 As Long, ByVal Color As Long) As Long
    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    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
    Dim transcolor&Private Sub Form_Load()
       With Picture1
          .ScaleMode = 3
          .AutoRedraw = True
          .BorderStyle = 0
          .AutoSize = True
          .Move 0, 0
       End With
       With Picture2
          .BorderStyle = 0
          .AutoRedraw = True
          .Move Screen.Width
       End With
       Set Picture2.Container = Picture1
       Text1.Width = 3900: Text1.Height = 495
       Text1.FontSize = 24: Text1.ForeColor = QBColor(11)
       Text1.FontBold = True: Text1.FontItalic = True
       Text1.Text = "CBM666的TextBox"
       Text1.Move (Picture1.Width - Text1.Width) \ 2, 100
       Set Text1.Container = Picture1
       '*************** 窗体置中 ***************
       Me.BorderStyle = 0: Me.Caption = "": Me.Width = Picture1.Width: Me.Height = Picture1.Height
       Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
       transcolor = vbWhite
    End SubPrivate Sub Form_Activate()
       Call Getbackpic
    End SubSub Getbackpic()
       Dim lDesktop As Long
       Dim lDC As Long
       Me.AutoRedraw = True
       Text1.BorderStyle = 0
       Picture2.Width = Text1.Width: Picture2.Height = Text1.Height
       lDesktop = GetDesktopWindow() '取得桌面窗口
       lDC = GetDC(lDesktop) '取得桌面窗口的设备场景
       Me.Refresh
       BitBlt Picture2.hDC, 0, 0, Text1.Width, Text1.Height, lDC, (Me.Left + Picture1.Left) \ 15 + Text1.Left, (Me.Top + Picture1.Top) \ 15 + Text1.Top, vbSrcCopy  '将桌面图象绘制到窗体
       Text1.Move Screen.Width
       GdiTransparentBlt Picture1.hDC, (Picture1.Width \ 15 - Picture2.Width) \ 2, 10, Picture2.Width, Picture2.Height, Picture2.hDC, 0, 0, Picture2.Width, Picture2.Height, transcolor
       Picture2.Move Screen.Width
    End SubPrivate Sub Picture1_Click()
       Unload Me
    End Sub'效果图:
    http://p.blog.csdn.net/images/p_blog_csdn_net/cbm666/366646/o_QQText.jpg