VB程序学习代码记录20160804

翻转图片

Dim sp As Boolean
Dim cz As Boolean

Private Sub Command1_Click(Index As Integer)
    Dim pic As StdPicture
    Dim w, h As Integer
    w = Picture1.Width
    h = Picture1.Height
    Set pic = Picture1.Picture
    Picture1.Cls
    Select Case Index
        Case 0
            sp = Not sp
        Case 1
            cz = Not cz
        Case 2
            End
    end select
    If sp And cz Then
        Picture1.PaintPicture pic, w, h, w * -1, h * -1
    ElseIf sp And Not cz Then
        Picture1.PaintPicture pic, w, 0, w * -1, h
    ElseIf Not sp And cz Then
        Picture1.PaintPicture pic, 0, h, w, h * -1
    Else
        Picture1.PaintPicture pic, 0, 0
    End If
End Sub

Private Sub commond2_Click()
    CommonDialog1.FileName = ""
    CommonDialog1.Filter = "图像文件|*.jpg;*.gif;*.png;*.PNG;*.bmp"
    CommonDialog1.Flags = cdlOFNAllowMultiselect '这个选项可使多选,所以要对文件串进行处理。
    CommonDialog1.ShowOpen
    Dim a
    a = Split(CommonDialog1.FileName, " ")
    If UBound(a) = 0 Then Picture1.Picture = LoadPicture(a(0))
    If UBound(a) > 0 Then Picture1.Picture = LoadPicture(a(0) & a(1))
    If UBound(a) > 1 Then Picture2.Picture = LoadPicture(a(0) & a(2))
    If Err.Number = 481 Then
        MsgBox "请选择图片文件"
    End If
End Sub
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值