求教高手。

colgao 2003-09-20 10:39:05
我用第三方的开发工具如mapgis开发了一个系统,系统提供一套绘图函数,和ocx实现绘制地图。我做了一个鹰眼,和主程序共享数据,主程序使用ocx自绘地图,鹰眼使用提供的VB api函数绘图(因为使用ocx不能达到要求效果)。在VB调试状态下一切正常,主程序和鹰眼都能显示地图。但编译成exe后,鹰眼地图更本就显示不出来。不知为何?


我想给200分,但系统不让,只有给100分啦
...全文
69 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
hxy1982 2003-09-28
  • 打赏
  • 举报
回复
up
colgao 2003-09-21
  • 打赏
  • 举报
回复
picture的设置是不会有问题的
colgao 2003-09-21
  • 打赏
  • 举报
回复
我是在picture下画的

Private Sub Picture1_Paint()
Dim ai As Integer
Dim ahInst As Long
Dim mdc As Long
Dim frc As D_RECT
Dim X As Double
Dim Y As Double
Dim r As Double
Dim mdc1 As Long
mdc1 = MainForm.GisEdit.GetMyDC()
If mdc1 < 1 Then
Exit Sub
End If
bGetDispRect mdc1, frc
mdc = bGetMyDCDir(Picture1.hwnd, Picture1.hdc)
If mdc > 0 And MainForm.GisEdit.Project > 0 Then
bSetGraphicsMode Picture1.hwnd, Picture1.hdc
bSetMyDCMode mdc
bSetDispRect mdc, frc
bSetMyDCPalette mdc
bSetOriginalDisp mdc, 0

GisEdit1.GetDispParm X, Y, r

bSetDispParam mdc, X, Y, r

ahInst = MainForm.PrjList.GetAreaInst()

ai = bGetFirstAreaNo(ahInst)
While ai > 0
If bGetAreaType(ai) = REG Then
bDispRegArea mdc, ai, 1
End If
ai = bGetNextAreaNo(ahInst)
Wend

ai = bGetFirstAreaNo(ahInst)
While ai > 0
If bGetAreaType(ai) = LIN Then
bDispLinArea mdc, ai, 1
End If
ai = bGetNextAreaNo(ahInst)
Wend

ai = bGetFirstAreaNo(ahInst)
While ai > 0
If bGetAreaType(ai) = PNT Then
bDispPntArea mdc, ai, 1
End If
ai = bGetNextAreaNo(ahInst)
Wend


bGetDispRect mdc1, frc
Dim dp0 As D_DOT
Dim dp1 As D_DOT
dp0.X = frc.xmin
dp0.Y = frc.ymin
dp1.X = frc.xmax
dp1.Y = frc.ymax
Dim p0 As POINTAPI
Dim p1 As POINTAPI

GetWindCoor GisEdit1, dp0, p0
GetWindCoor GisEdit1, dp1, p1

bSetPenColor mdc, RGB(255, 0, 0)
bLineF mdc, p0.X, p0.Y, p1.X, p0.Y
bLineF mdc, p1.X, p0.Y, p1.X, p1.Y
bLineF mdc, p1.X, p1.Y, p0.X, p1.Y
bLineF mdc, p0.X, p1.Y, p0.X, p0.Y
bCleanPenColor mdc
End If
bDeleteMyDC mdc
MainForm.GisEdit.DeleteMyDC mdc1
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Dim xPos As Double
Dim yPos As Double
Dim frc As D_RECT
Dim mdc As Long
Dim mdc1 As Long
Dim dx As Double
Dim dy As Double
Dim r As Double
Dim xp0 As Double
Dim yp0 As Double
Dim w, h, scale0 As Double

w = Picture1.ScaleWidth
h = Picture1.ScaleHeight
mdc1 = GisEdit1.GetMyDC()
If mdc1 < 1 Then
Exit Sub
End If
bGetDispRect mdc1, frc
bGetDispParam mdc1, xp0, yp0, r
scale0 = w / (frc.xmax - frc.xmin)
dx = CDbl(X) / scale0
dy = CDbl(h - Y) / scale0
xPos = xp0 + dx
yPos = yp0 + dy

mdc = MainForm.GisEdit.GetMyDC()
If mdc < 1 Then
Exit Sub
End If
bGetDispRect mdc, frc
bGetDispParam mdc, w, h, r
w = (frc.xmax - frc.xmin) / 2#
h = (frc.ymax - frc.ymin) / 2#
MainForm.GisEdit.SetDispParm xPos - w, yPos - h, r
MainForm.GisEdit.UpdateWindow
Picture1.Refresh

MainForm.GisEdit.DeleteMyDC mdc
GisEdit1.DeleteMyDC mdc1
End If

End Sub

colgao 2003-09-21
  • 打赏
  • 举报
回复
谢谢大家
我想请教一下vb的debug和release下的运行区别,我的鹰眼不是用ocx做的,使用api实现的,和控件共享数据,我犯疑鹰眼根本没有机会得到数据才画不出来,事实上当我不停移动鹰眼时,一会机器资源就耗尽了
busisoft 2003-09-21
  • 打赏
  • 举报
回复
编译成EXE文件后,可能相关文件不全造成。
rainstormmaster 2003-09-20
  • 打赏
  • 举报
回复
不知道你是怎么实现鹰眼的,最好把代码贴出来,参考下面的:

基于MAPX控件的鹰眼图实现
http://www.chinartu.com/vc-mapx.htm
colgao 2003-09-20
  • 打赏
  • 举报
回复
VB api函数是第三方编写的,我想不应当有问题

1,453

社区成员

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

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