区内医院地理信息管理系统毕业设计 第2页
区内医院地理信息管理系统毕业设计 第2页 This.Picture=Sys(5)+Sys(2003)+"\Images\长春.JPG" Map控件的MouseDown事件的相关程序代码如下所示: LPARAMETERS nButton, nShift, nXCoord, nYCoord *获取鼠标的坐标值 cbuff=space(16) mymouse=GetCursorPos(@cBuff) MouseX=ASC(substr(cBuff,2,1))*256+ASC(substr(cBuff,1,1)) MouseY=ASC(substr(cBuff,6,1))*256+ASC(substr(cBuff,5,1)) Flag=.T. *改变光标的形状 thisform.Map.MousePointer=99 thisform.Map.MouseICON=sys(5)+sys(2003)+"\Images\mycursor.CUR" Map控件的MouseMove事件的相关程序代码如下所示: LPARAMETERS nButton, nShift, nXCoord, nYCoord MyX=nXCoord MyY=nYCoord Map控件的MouseUp事件的相关程序代码如下所示: LPARAMETERS nButton, nShift, nXCoord, nYCoord Flag=.F. *恢复光标为系统默认光标 thisform.Map.MousePointer=0 Form1表单中的load事件的相关程序代码如下所示: Set Safety OFF public x,y,Down_x,Down_y,MouseX,MouseY,Flag,Ctrl_Count,MyX,MyY,Flag_Init public formname formname=thisform Store 0 To MouseX,MouseY Declare integer GetCursorPos in user32 String@ lpPoint &&声明API函数 *获取鼠标的坐标值 cbuff=space(16) mymouse=GetCursorPos(@cBuff) MouseX=ASC(substr(cBuff,2,1))*256+ASC(substr(cBuff,1,1)) MouseY=ASC(substr(cBuff,6,1))*256+ASC(substr(cBuff,5,1)) Store .F. To Flag,Flag_Init Ctrl_Count=3 Timer1控件中的Timer事件的相关程序代码如下所示: Open Database Database\Database.dbc &&打开数据库文件 Use Database\Tab_Create *获取鼠标的坐标值 cbuff=space(16) mymouse=GetCursorPos(@cBuff) x=ASC(substr(cBuff,2,1))*256+ASC(substr(cBuff,1,1)) y=ASC(substr(cBuff,6,1))*256+ASC(substr(cBuff,5,1)) **************鼠标移动到屏幕边缘时,图片自动移动****************** if X=0 and thisform.Map.left<0 thisform.Map.left=thisform.Map.left+7 &&地图向右移 Go Top Do While !Eof() CtrlName=Alltrim(Tab_Create.名称) Thisform.&CtrlName..Left=thisform.&CtrlName..left+7 SKIP EndDo endif if Y=0 and thisform.Map.top<0 thisform.Map.top=thisform.Map.top+7 &&地图向下移 Go Top Do While !Eof() CtrlName=Alltrim(Tab_Create.名称) Thisform.&CtrlName..Top=thisform.&CtrlName..Top+7 SKIP EndDo endif if X>thisform.left+thisform.width and thisform.Map.left+thisform.Map.width>thisform.width thisform.Map.left=thisform.Map.left-7 &&地图向左移 Go Top Do While !Eof() CtrlName=Alltrim(Tab_Create.名称) Thisform.&CtrlName..Left=thisform.&CtrlName..left-7 SKIP EndDo endif if Y>thisform.top+thisform.height and thisform.Map.top+thisform.Map.height>thisform.height thisform.Map.top=thisform.Map.top-7 &&地图向下移 Go Top Do While !Eof() CtrlName=Alltrim(Tab_Create.名称) Thisform.&CtrlName..Top=thisform.&CtrlName..Top-7 SKIP EndDo endif ****************拖动图时,图片跟随鼠标时实移动********************* If Flag=.T. If MouseX!=X OR MouseY!=Y thisform.Map.left=thisform.Map.left-MouseX+x thisform.Map.top=thisform.Map.top-MouseY+y *医院位置随地图移动 Go Top Do While !Eof() CtrlName=Alltrim(Tab_Create.名称) Thisform.&CtrlName..Left=thisform.&CtrlName..left-MouseX+x Thisform.&CtrlName..Top=thisform.&CtrlName..Top-MouseY+y SKIP EndDo *到左边界时 If Thisform.Map.Left>0 Thisform.Map.Left=0 Go Top Do While !Eof() CtrlName=Alltrim(Tab_Create.名称) Thisform.&CtrlName..Left=Tab_Create.X值-24 SKIP EndDo Endif *到上边界时 If Thisform.Map.Top>0 Thisform.Map.Top=0 Go Top Do While !Eof() CtrlName=Alltrim(Tab_Create.名称) Thisform.&CtrlName..Top=Tab_Create.Y值-23 SKIP EndDo Endif *到底边界时 If ABS(Thisform.Map.Top)+Thisform.Height>Thisform.Map.Height Thisform.Map.Top=-(Thisform.Map.Height-Thisform.Height) Go Top Do While !Eof() CtrlName=Alltrim(Tab_Create.名称) Thisform.&CtrlName..Top=Thisform.Height-(Thisform.Map.Height-Tab_Create.Y值)-23 SKIP EndDo Endif *到右边界时 If ABS(Thisform.Map.Left)+Thisform.Width>Thisform.Map.Width Thisform.Map.Left=-(Thisform.Map.Width-Thisform.Width) Go Top Do While !Eof() CtrlName=Alltrim(Tab_Create.名称) Thisform.&CtrlName..Left=Thisform.Width-(Thisform.Map.Width-Tab_Create.X值)-24 SKIP EndDo Endif MouseX=ASC(substr(cBuff,2,1))*256+ASC(substr(cBuff,1,1)) MouseY=ASC(substr(cBuff,6,1))*256+ASC(substr(cBuff,5,1)) Endif Endif Use Close Database Timer2控件中的Timer事件的相关程序代码如下所示: If Flag_Init=.F. SET PROCEDURE TO MyProg &&打开过程文件 Do AddCtrl with thisform &&调用过程显示医院信息 Flag_Init=.T. Endif This.Interval=0
上一页 [1] [2] [3] [4] [5] [6] 下一页