VB中如何使用SetBitmapDimensionEx?

nicon 2000-03-18 02:13:00
如下代码不能正确设置图象的尺寸,请高手指点,谢谢!
=》---------Source Code----------------------------
'Form中放置一个名为pic的Picture Box
Dim compatDC As Long
Dim l As Long
Dim tPoint As POINTAPI
Dim hbit As Long
Dim lObject As Long
Dim typSize As Size
compatDC = CreateCompatibleDC(pic.hdc)
hbit = CreateCompatibleBitmap(compatDC, 10, 50)
l = SetBitmapDimensionEx(hbit, 10000, 10000, typSize)
l = GetBitmapDimensionEx(hbit, typSize)
lObject = SelectObject(compatDC, hbit)
lObject = SelectObject(compatDC, GetStockObject(WHITE_PEN))
l = MoveToEx(compatDC, 0, 0, tPoint)
l = LineTo(compatDC, 100, 500)
lObject = SelectObject(compatDC, lObject)
l = BitBlt(pic.hdc, 0, 0, 100, 500, compatDC, 0, 0, SRCCOPY)
l = DeleteObject(hbit)
l = DeleteDC(compatDC)
pic.Refresh
...全文
154 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Chen_Lin 2000-03-19
  • 打赏
  • 举报
回复
pic.AutoRedraw = True

函数说明 :
设置一幅位图的宽度。以一毫米的十分之一为单位。Windows不使用这种信息,但也许能通过GetBitmapDimensionEx函数获取
返回值
Long,非零表示成功,零表示失败。会设置GetLastError
参数表
参数 类型及说明
hbm Long, 一幅位图的句柄
nX,nY Long, 位图的建议大小,以0.1mm为单位
lpSize SIZE, 用于载入前一个位图大小的结构
Un1 2000-03-19
  • 打赏
  • 举报
回复
需要设置 pic.AutoRedraw = True。

7,759

社区成员

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

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