📄 如何无失真地缩放和保存图象.txt
字号:
你 可 以 使 用 PictureClip控 件 来 放 置 图 像 。 下 面 的 范 例 可 以 将 PictureClip对 象 上 的 图 像 缩 放 拷 贝 到 PictureBox对 象 并 实 现 无 失 真 的 保 存 。
Dim SaveMode As Integer
' Save the current ScaleMode for the picture box.
SaveMode = Picture1.ScaleMode
' Get X and Y coordinates of the clipping region.
PicClip1.ClipX = 0 'Val(Text1.Text)
PicClip1.ClipY = 0 'Val(Text2.Text)
' Set the area of the clipping region (in pixels).
PicClip1.ClipHeight = PicClip1.Height
PicClip1.ClipWidth = PicClip1.Width
' Set the picture box ScaleMode to pixels.
Picture1.ScaleMode = 3
' Set the destination area to fill the picture box.
PicClip1.StretchX = Picture1.ScaleWidth
PicClip1.StretchY = Picture1.ScaleHeight
' Assign the clipped bitmap to the picture box.
Picture1.Picture = PicClip1.Clip
' Reset the ScaleMode of the picture box.
Picture1.ScaleMode = SaveMode
'SavePicture PicClip1.Picture, "c:\b.jpg"
Picture1.Picture.Render Picture1.hDC, 0, 0, 20, 20, 10, 10, 20, 20, ByVal 0
SavePicture Picture1, "c:\a.bmp"
其 中 PicClip1是 PictureClip对 象 , 而 Picture1是 Picture对 象 。
http://member.netease.com/~blackcat
<END>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -