gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15945
  • QQ554730525
  • 铜币25337枚
  • 威望15352点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
阅读:3711回复:0

在form_resize的时候防止map刷新的方法

楼主#
更多 发布于:2003-07-26 22:16
Software:  MapObjects LT 1.0, 2.0 MapObjects-Windows 1.2, 2.0, 2.0a
Platforms:  Windows 95, 98, NT 3.51, NT 4.0, 2000

 


有两种方法控制地图不刷新:
1. 使用WinAPI 来设置DRAGFULLWINDOWS 系统属性无效
2. 在form-resize的时候使地图不见

过程:

把下面的vb代码加到一个工程里,必须包括一个 Map control 和一个 Timer.

Option Explicit
Dim liLastWidth As Long
Dim liLastHeight As Long

' For Windows API fix, uncomment these lines:
'Private Declare Function SystemParametersInfo Lib "user32"
Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam
As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
'Private Const SPI_SETDRAGFULLWINDOWS = 37

Private Sub Form_Load()

' For Windows API fix, uncomment the following line.
'SystemParametersInfo SPI_SETDRAGFULLWINDOWS, 0, Null, 0

liLastWidth = Map1.Width
liLastHeight = Map1.Height
Timer1.Interval = 10

End Sub

Private Sub Form_Resize()

If Map1.Visible Then
  Map1.Visible = False
  Timer1.Enabled = True
End If

Map1.Width = Form1.Width - 300
Map1.Height = Form1.Height - 800

End Sub

Private Sub Timer1_Timer()
If Map1.Width = liLastWidth And Map1.Height = liLastHeight Then

  Map1.Visible = True
  Timer1.Enabled = False
Else
  liLastWidth = Map1.Width
  liLastHeight = Map1.Height
End If
End Sub

喜欢0 评分0
游客

返回顶部