# 关于不规则区域....?

Posted by 哈林 on September 27, 1998 at 18:01:51:

我想要判断Mouse是否处于一椭圆形的区域内,
如果Mouse移到MMRgn的椭圆形区域内时显示图片
但是却得不到想要的结果,是不是做错了?
请高手指点!感激不尽!

以下为程式码:

Option Explicit
Private Declare Function CreateEllipticRgn Lib "gdi32"_
(ByVal x1 As Long, ByVal y1 As Long, ByVal X2 As Long,_
ByVal Y2 As Long) As Long
Private Declare Function PtInRegion Lib "gdi32"_
(ByVal hRgn As Long, ByVal X As Long, ByVal Y As Long) As Long
Dim MMRgn As Long

MMRgn = CreateEllipticRgn(Img1.Left, Img1.Top, Img1.Left + Img1.Width, Img1.Top + Img1.Height)
If PtInRegion(MMRgn, x, y) Then
Img1.Picture = Pic1.Picture
Else
Img1.Picture = LoadPicture("")
End If

Follow Ups:

- 座标值的关系 cww 09:28:08 9/28/98 (1)
  - Re: 问题是.... 哈林 11:10:14 9/29/98 (0)