画到PictureBox上
再SavePicture

解决方案 »

  1.   

    用PictureBox.PaintPicture把两幅画画在一起
    然后,用PictureBox.SavePicture保存
      

  2.   

    PictureBox.SavePicture不能保存为黑白图片,而且我要的是上下对接,不是重叠。
      

  3.   

    我试过了,PaintPicture方法画的图像,用SavePicture无法保存
      

  4.   

    用PaintPicture方法画的图像,无法用SavePicture保存
      

  5.   

    计算好坐标就能上下对接了PictureBox的AutoRedraw设为True
    再用“SavePicture PictureBox.Image,文件名”保存对于你想保存单色的BMP
    根据它的文件格式写
    文件格式资料:http://www.csdn.net/Dev/Format/#图形文件
      

  6.   

    关于图片连接:
    请将下面的文件保存为MainForm.frm
    VERSION 5.00
    Begin VB.Form MainForm 
       BorderStyle     =   1  'Fixed Single
       Caption         =   "超级蚂蚁图片专用制作工具"
       ClientHeight    =   5820
       ClientLeft      =   45
       ClientTop       =   330
       ClientWidth     =   7365
       LinkTopic       =   "Form1"
       MaxButton       =   0   'False
       ScaleHeight     =   388
       ScaleMode       =   3  'Pixel
       ScaleWidth      =   491
       StartUpPosition =   2  '屏幕中心
       Begin VB.VScrollBar VScroll1 
          Height          =   4335
          LargeChange     =   5
          Left            =   7110
          Max             =   0
          TabIndex        =   17
          Top             =   0
          Width           =   255
       End
       Begin VB.HScrollBar HScroll1 
          Height          =   255
          LargeChange     =   5
          Left            =   0
          Max             =   0
          TabIndex        =   16
          Top             =   4350
          Width           =   7095
       End
       Begin VB.PictureBox Picture1 
          Height          =   4335
          Left            =   0
          ScaleHeight     =   285
          ScaleMode       =   3  'Pixel
          ScaleWidth      =   469
          TabIndex        =   14
          Top             =   0
          Width           =   7095
          Begin VB.PictureBox PicMain 
             AutoRedraw      =   -1  'True
             BorderStyle     =   0  'None
             Height          =   2535
             Left            =   0
             ScaleHeight     =   169
             ScaleMode       =   3  'Pixel
             ScaleWidth      =   321
             TabIndex        =   15
             Top             =   0
             Width           =   4815
          End
       End
       Begin VB.CommandButton CommandStart 
          Caption         =   "开始(&B)"
          Height          =   495
          Left            =   4440
          TabIndex        =   13
          Top             =   5160
          Width           =   1215
       End
       Begin VB.TextBox TextHeight1 
          Alignment       =   2  'Center
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   375
          Left            =   6120
          TabIndex        =   10
          Top             =   4680
          Width           =   975
       End
       Begin VB.TextBox TextWidth1 
          Alignment       =   2  'Center
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   375
          Left            =   4440
          TabIndex        =   9
          Top             =   4680
          Width           =   975
       End
       Begin VB.CommandButton CommandSave 
          Caption         =   "保存文件(&S)"
          Height          =   495
          Left            =   5760
          TabIndex        =   8
          Top             =   5160
          Width           =   1335
       End
       Begin VB.CommandButton CommandOpen 
          Caption         =   "打开文件夹(&O)"
          Height          =   495
          Left            =   3000
          TabIndex        =   7
          Top             =   5160
          Width           =   1335
       End
       Begin VB.TextBox TextFileName 
          Alignment       =   2  'Center
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   375
          Left            =   1200
          TabIndex        =   5
          Top             =   5280
          Width           =   1695
       End
      

  7.   

    Begin VB.TextBox TextInteger2 
          Alignment       =   2  'Center
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   375
          Left            =   2160
          TabIndex        =   2
          Top             =   4680
          Width           =   1095
       End
       Begin VB.TextBox TextInteger1 
          Alignment       =   2  'Center
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   375
          Left            =   600
          TabIndex        =   1
          Top             =   4680
          Width           =   1095
       End
       Begin VB.PictureBox PicFile 
          AutoRedraw      =   -1  'True
          AutoSize        =   -1  'True
          BorderStyle     =   0  'None
          Height          =   255
          Left            =   3360
          ScaleHeight     =   17
          ScaleMode       =   3  'Pixel
          ScaleWidth      =   33
          TabIndex        =   0
          Top             =   4680
          Visible         =   0   'False
          Width           =   495
       End
       Begin VB.Label Label5 
          Alignment       =   2  'Center
          Caption         =   "高:"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   10.5
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   375
          Left            =   5520
          TabIndex        =   12
          Top             =   4740
          Width           =   495
       End
       Begin VB.Label Label4 
          Alignment       =   2  'Center
          Caption         =   "宽:"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   10.5
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   375
          Left            =   3840
          TabIndex        =   11
          Top             =   4740
          Width           =   495
       End
       Begin VB.Label Label3 
          Alignment       =   2  'Center
          Caption         =   "文件名:"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   10.5
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   255
          Left            =   120
          TabIndex        =   6
          Top             =   5340
          Width           =   975
       End
       Begin VB.Label Label2 
          Alignment       =   2  'Center
          Caption         =   "到"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   10.5
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   255
          Left            =   1800
          TabIndex        =   4
          Top             =   4740
          Width           =   255
       End
       Begin VB.Label Label1 
          Alignment       =   2  'Center
          Caption         =   "从"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   10.5
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   375
          Left            =   120
          TabIndex        =   3
          Top             =   4740
          Width           =   375
       End
    End
    Attribute VB_Name = "MainForm"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Dim Tex As String
    Private Sub CommandOpen_Click()
        Dim bi As BROWSEINFO
        Dim r As Long
        Dim pidl As Long
        Dim path As String
        Dim pos As Integer
        '句柄
        bi.hOwner = Me.hWnd
        '展开根目录
        bi.pidlRoot = 0&
        '列表框标题
        bi.lpszTitle = "请选择文件保存路径:"
        '规定只能选择文件夹,其他无效
        bi.ulFlags = BIF_RETURNONLYFSDIRS
        '调用API函数显示列表框
        pidl = SHBrowseForFolder(bi)
        '利用API函数获取返回的路径
        path = Space$(512)
        r = SHGetPathFromIDList(ByVal pidl&, ByVal path)
        If r Then
            pos = InStr(path, Chr$(0))
            Tex = Left(path, pos - 1)
        Else
            Tex = ""
        End If
    End Sub
      

  8.   

    Private Sub CommandSave_Click()
    SavePicture PicMain.Image, Tex + "/" + TextFileName.Text + ".bmp"
    End Sub
    Private Sub CommandStart_Click()
    Dim i As Long
    Dim j As Long
    Dim Si As String
    PicMain.Height = Val(TextHeight1.Text)
    PicMain.Width = Val(TextWidth1.Text) * Val(TextInteger2.Text)
    PicMain.Cls
    If PicMain.Height > Picture1.Height Then
    VScroll1.Max = PicMain.Height - Picture1.Height
    Else
    VScroll1.Max = 0
    End If
    If PicMain.Width > Picture1.Width Then
    HScroll1.Max = PicMain.Width - Picture1.Width
    Else
    HScroll1.Max = 0
    End If
    For i = Val(TextInteger1.Text) To Val(TextInteger2.Text)
     If i < 10 Then
      Si = "000" + CStr(i)
     Else
      If i < 100 Then
       Si = "00" + CStr(i)
      Else
       If i < 1000 Then
        Si = "0" + CStr(i)
       Else
        Si = CStr(i)
       End If
      End If
     End If
    PicFile.Picture = LoadPicture(Tex + "/" + TextFileName.Text + Si + ".bmp")
    For j = 1 To 2
    BitBlt PicMain.hDC, i * Val(TextWidth1.Text), 0, Val(TextWidth1.Text), Val(TextHeight1.Text), PicFile.hDC, 0, 0, SRCCOPY
    Next j
    Next i
    End Sub
    Private Sub Form_Initialize()
    XP_Start
    End SubPrivate Sub HScroll1_Change()
    PicMain.Left = -HScroll1.Value
    End Sub
    Private Sub HScroll1_Scroll()
    PicMain.Left = -HScroll1.Value
    End Sub
    Private Sub VScroll1_Change()
    PicMain.Top = -VScroll1.Value
    End Sub
    Private Sub VScroll1_Scroll()
    PicMain.Top = -VScroll1.Value
    End Sub
    --------------------------------------------------------------------
    请将下面的文件保存为Simple.vbp
    Type=Exe
    Form=MainForm.frm
    Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#D:\WINDOWS\System32\stdole2.tlb#OLE Automation
    Module=file; ..\..\vb98\file.bas
    Module=BitBltStuff; ..\..\vb98\BitBlt.bas
    Module=XPTheme; ..\..\vb98\XPTheme.bas
    IconForm="MainForm"
    Startup="MainForm"
    ExeName32="超级蚂蚁图片专用制作工具.exe"
    Command32=""
    Name="超级蚂蚁图片专用制作工具"
    HelpContextID="0"
    CompatibleMode="0"
    MajorVer=1
    MinorVer=0
    RevisionVer=0
    AutoIncrementVer=0
    ServerSupportFiles=0
    CompilationType=0
    OptimizationType=0
    FavorPentiumPro(tm)=0
    CodeViewDebugInfo=0
    NoAliasing=0
    BoundsCheck=0
    OverflowCheck=0
    FlPointCheck=0
    FDIVCheck=0
    UnroundedFP=0
    StartMode=0
    Unattended=0
    Retained=0
    ThreadPerObject=0
    MaxNumberOfThreads=1[MS Transaction Server]
    AutoRefresh=1
                      当时是为了把用动画处理软件输出的BMP图片保存为一幅图片
    --------------------------------------------------------------------
    Made by Thirdapple's Studio