我知道用savepicture 保存图象,可是保存后BMP图象的象素大小,也就是画布怎么调呀,帮帮忙吧,谢谢了.
解决方案 »
- 【散分】工作一年后的苦闷……
- 关于坐标系绘制图形后 如何更改背景颜色
- 我想写个识别标点符号的函数,帮忙看看
- 播放Flash时怎么没声音?
- 卖大白菜了!!!(白菜帮总飘靶子)
- Listbox绑定Recrodset的问题,保证给分!!!
- 如何用下前头"40"代替tab键???
- 数据库 备份 导入导出问题!!! 很急
- 主 题:急。PRINTER打印图像的问题!!!!!!!!!
- 那位大吓晓得那有VB5\6的反编译的程序。我急用,可的高分
- 哪里有sql 7.0下载网址?是不是这个数据库的工程比access要强得多?尤其是支持select 查询?
- datareport中用什么表示当前年, 月,日,页码, 等等
可以用cDIBSection Class
Private Type BITMAPINFOHEADER '40 bytes
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColors As RGBQUAD
End Type
下载地址
http://www.vbaccelerator.com/codelib/gfx/cdibsect.zip
使用Private Sub Fade( _
ByRef cTo As cDIBSection, _
ByVal lAmount As Long _
)
Dim bDib() As Byte
Dim x As Long, y As Long
Dim xMax As Long, yMax As Long
Dim lB As Long, lG As Long, lR As Long
Dim lA As Long, lA2 As Long
Dim lTIme As Long
Dim tSA As SAFEARRAY2D
' have the local matrix point to bitmap pixels
With tSA
.cbElements = 1
.cDims = 2
.Bounds(0).lLbound = 0
.Bounds(0).cElements = cTo.Height
.Bounds(1).lLbound = 0
.Bounds(1).cElements = cTo.BytesPerScanLine
.pvData = cTo.DIBSectionBitsPtr
End With
CopyMemory ByVal VarPtrArray(bDib), VarPtr(tSA), 4
yMax = cTo.Height - 1
xMax = cTo.Width - 1
For x = 0 To (xMax * 3) Step 3
For y = 0 To yMax
lB = lAmount * bDib(x, y) \ 255
lG = lAmount * bDib(x + 1, y) \ 255
lR = lAmount * bDib(x + 2, y) \ 255
bDib(x, y) = lB
bDib(x + 1, y) = lG
bDib(x + 2, y) = lR
Next y
Next x CopyMemory ByVal VarPtrArray(bDib), 0&, 4
End Sub
Private Sub Command1_Click() Dim cDib As New cDibSection
Dim cDibBuffer as New cDibSection
Dim i As Long ' Load the picture to fade:
Set sPic = LoadPicture("Put Your File Here!")
cDib.CreateFromPicture sPic ' Create a copy of it:
cDibBuffer.Create cDib.Width, cDib.Height
cDib.PaintPicture cDibBuffer.HDC ' Fade Loop:
For i = 0 To 255 Step 4
' Fade the dib by amount i:
Fade cDib, i
' Draw it:
cDib.PaintPicture Form1.hDC
' Breathe a little. You may have to put a slowdown here:
DoEvents
' Reset for next fade:
cDibBuffer.PaintPicture cDib.HDC
Next i End Sub