图像在visual basic中调整大小6 [英] Image Resize in visual basic 6
问题描述
我创建的程序更多的是加载图像。我已经完成了我的程序但是在运行程序时仍然存在问题。由于图像太大,我的程序太慢。
我尝试使用此代码使图像更亮但不起作用。
公共 Sub LoadImage( ByVal imgName 作为 字符串)
使用 Entry1
.imgView.ScrollBars = SB_Both
.imgView.ViewUpdate = True
.imgView.ToolSet TOOL_Hand,IXMOUSEBUTTON_Left, 0
.imgView.PageNbr = imgPage
.imgView.fileName = imgPath& imgName
.imgView.IResX = 300
.imgView.IResY = 300
' 。imgView.AutoSize = ISIZE_ResizeImage
.imgView.SaveFile
.imgView.ZoomToFit ZOOMFIT_BEST
结束 使用
结束 Sub
有没有办法让图像变亮?或者调整图像大小?
任何帮助都将被接受。
如果你使用图像控件 [ ^ ],您可以使用简单的技巧: http://visualbasic.freetutes.com/learn-vb6/picturebox-image-controls.html [ ^ ]
' 加载位图。
Image1.Stretch = False
Image1.Picture = LoadPicture( c:\ windows \setup.bmp)
' 将其减少两倍。
Image1.Stretch = True
Image1.Move 0 , 0 ,Image1.Width / 2 ,Image1.Width / 2
另一种方式提高性能,是使用AutoRedraw
属性。
Image1.AutoRedraw = 真 ' 错误
对于PictureBox控件,请参考: http://msdn.microsoft.com/en-us/library/zzt5x46b%28v=vs.80%29.aspx [ ^ ]
Picture1.AutoSize = True ' False
看看这里:
http://stackoverflow.com/questions/12516376/resizing-a-picture-to-a-fixed-size-in-vb6 [ ^ ]
< a href =http://www.chestysoft.com/ximage/vb/image-resize-vb.asp> http://www.chestysoft.com/ximage/vb/image-resize-vb.asp [ ^ ]
最适合您的解决方案
Sub PHOTO_RESIZING()
Dim obj As 对象
Dim rngInsert As 范围
Dim dblZoom As Double
If TypeName(Selection )= 范围 然后 退出 Sub
设置 obj =选择
设置 rngInsert = obj.TopLeftCell ' 选择
设置 rngInsert = rngInsert.MergeArea
Application.ScreenUpdating = False
rngInsert。选择
dblZoom = ActiveWindow.Zoom
ActiveWindow.Zoom = 100 ' 查看调整大小
使用 obj
.ShapeRange.LockAspectRatio = msoFalse
.Top = rngInsert.Top
.Left = rngInsert.Left
.Height = rngInsert.Height
.Width = rngInsert.Width
结束 使用
ActiveWindow.Zoom = dblZoom
Application.ScreenUpdating = True
结束 Sub
I have created a program which is more on loading an image. I have already finish my program but I have still a problem in running my program. My program is too slow because of large images.
I try this code to make the images lighter but it doesn't work.
Public Sub LoadImage(ByVal imgName As String)
With Entry1
.imgView.ScrollBars = SB_Both
.imgView.ViewUpdate = True
.imgView.ToolSet TOOL_Hand, IXMOUSEBUTTON_Left, 0
.imgView.PageNbr = imgPage
.imgView.fileName = imgPath & imgName
.imgView.IResX = 300
.imgView.IResY = 300
'.imgView.AutoSize = ISIZE_ResizeImage
.imgView.SaveFile
.imgView.ZoomToFit ZOOMFIT_BEST
End With
End Sub
Is there any way to make the images lighter? or to resize an image?
Any help will be accepted.
If you use Image control[^], you can use simply trick from: http://visualbasic.freetutes.com/learn-vb6/picturebox-image-controls.html[^]
' Load a bitmap. Image1.Stretch = False Image1.Picture = LoadPicture("c:\windows\setup.bmp") ' Reduce it by a factor of two. Image1.Stretch = True Image1.Move 0, 0, Image1.Width / 2, Image1.Width / 2
Another way to increase performance, is to useAutoRedraw
property.
Image1.AutoRedraw = True 'False
For PictureBox control, refer this: http://msdn.microsoft.com/en-us/library/zzt5x46b%28v=vs.80%29.aspx[^]
Picture1.AutoSize = True 'False
Have a look here:
http://stackoverflow.com/questions/12516376/resizing-a-picture-to-a-fixed-size-in-vb6[^]
http://www.chestysoft.com/ximage/vb/image-resize-vb.asp[^]
A Best solution for you
Sub PHOTO_RESIZING() Dim obj As Object Dim rngInsert As Range Dim dblZoom As Double If TypeName(Selection) = "Range" Then Exit Sub Set obj = Selection Set rngInsert = obj.TopLeftCell ' Selection Set rngInsert = rngInsert.MergeArea Application.ScreenUpdating = False rngInsert.Select dblZoom = ActiveWindow.Zoom ActiveWindow.Zoom = 100 'View Resizing With obj .ShapeRange.LockAspectRatio = msoFalse .Top = rngInsert.Top .Left = rngInsert.Left .Height = rngInsert.Height .Width = rngInsert.Width End With ActiveWindow.Zoom = dblZoom Application.ScreenUpdating = True End Sub
这篇关于图像在visual basic中调整大小6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!