关于图片框

crystalgrace 2003-09-16 08:34:13
现在要完成一个将现有的图片框中的图片通过命令按钮的“放大”、“缩小”和“全屏”功能对图片框进行操作,请问需要用到图片框的哪些属性或方法
...全文
57 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
juror 2003-09-16
  • 打赏
  • 举报
回复
我来看看
Fengq 2003-09-16
  • 打赏
  • 举报
回复
cool
射天狼 2003-09-16
  • 打赏
  • 举报
回复
楼上不错~
lxcc 2003-09-16
  • 打赏
  • 举报
回复
保存到记事本,然后另存为form1.frm
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4755
ClientLeft = 60
ClientTop = 345
ClientWidth = 5985
LinkTopic = "Form1"
ScaleHeight = 4755
ScaleWidth = 5985
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command6
Caption = "Command6"
Height = 495
Left = 1320
TabIndex = 6
Top = 4200
Width = 1215
End
Begin VB.CommandButton Command5
Caption = "Command5"
Height = 495
Left = 120
TabIndex = 5
Top = 4200
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "Command4"
Height = 495
Left = 3720
TabIndex = 4
Top = 3600
Width = 1215
End
Begin VB.PictureBox Picture1
Height = 3255
Left = 2520
Picture = "Form1.frx":0000
ScaleHeight = 3195
ScaleWidth = 3195
TabIndex = 3
Top = 120
Width = 3255
End
Begin VB.CommandButton Command3
Caption = "Command3"
Height = 495
Left = 2520
TabIndex = 2
Top = 3600
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "Command2"
Height = 495
Left = 1320
TabIndex = 1
Top = 3600
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 120
TabIndex = 0
Top = 3600
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop 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 Sub Command1_Click()
Dim w As Integer, h As Integer
Me.ScaleMode = vbPixels
w = Picture1.Width
h = Picture1.Height
StretchBlt Me.hdc, 0, 0, w, h, Picture1.hdc, 0, 0, w, h, vbSrcCopy
End Sub
'放大:
Private Sub Command2_Click()
Dim w As Integer, h As Integer
Me.ScaleMode = vbPixels
w = Picture1.Width
h = Picture1.Height
StretchBlt Me.hdc, 0, 0, w * 2, h * 2, Picture1.hdc, 0, 0, w, h, vbSrcCopy
End Sub
'缩小:
Private Sub Command3_Click()
Dim w As Integer, h As Integer
Me.ScaleMode = vbPixels
w = Picture1.Width
h = Picture1.Height
StretchBlt Me.hdc, 0, 0, w / 2, h / 2, Picture1.hdc, 0, 0, w, h, vbSrcCopy
End Sub
'例3: 翻转图片
'左右翻转
Private Sub Command4_Click()
Dim w As Integer, h As Integer
Me.ScaleMode = vbPixels
w = Picture1.Width
h = Picture1.Height
StretchBlt Me.hdc, w, 0, -w, h, Picture1.hdc, 0, 0, w, h, vbSrcCopy
End Sub
'上下翻转
Private Sub Command5_Click()
Dim w As Integer, h As Integer
Me.ScaleMode = vbPixels
w = Picture1.Width
h = Picture1.Height
StretchBlt Me.hdc, 0, 0, w / 2, h / 2, Picture1.hdc, 0, 0, w, h, vbSrcCopy
End Sub
'左右并且上下翻转
Private Sub Command6_Click()
Dim w As Integer, h As Integer
Me.ScaleMode = vbPixels
w = Picture1.Width
h = Picture1.Height
StretchBlt Me.hdc, w, h, -w, -h, Picture1.hdc, 0, 0, w, h, vbSrcCopy
End Sub

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧