تبلیغات
آموزس برنامه نویسی - مختصات جاری ماوس
سه شنبه 1388/12/4

مختصات جاری ماوس

   نوشته شده توسط: ::VB Love ::    

جهت بدست آوردن مختصات ماوس باید از توابع API استفاده کنیم.(نحوه کار کردن با توابع API قبل آموزش داده شده است.)

ابتدا تابع GetCursorPos را از توابع API فراخوانی کنید سپس کد زیر را در برنامه بصورت روبرو قرار دهید:

Private Type POINTAPI



X as long


Y as long



End Type

در این 2 متغیر مختصات ستون و سطر جاری ذخیره می شود ؛ حال کد زیر را در رویداد Form_MouseMove قرار دهید:

Dim Pt as POINTAPI


GetCursorPos Pt



Me.CurrentX=0


Me.CurrentY=0



Me.Cls

Label1.Caption=Str$(Pt.X) ‘ x position


Label2.Caption=Str$(Pt.Y) ‘ y position

حال اگر می خواهید مختصات خارج از فرم را هم نمایش دهید باید تمام کدهای بالا را به یک تایمر انتقال دهید سپس تابع SetCapture را هم از توابع API فراخوانی کنید سپس در انتهای کد موجود در تایمر دستور SetCapture Me.hwnd را قرار دهید.

Interval تایمر را برابر 20 و خاصیت Enabled آن را فعال کنید.


What is distraction osteogenesis?
دوشنبه 1396/06/27 09:07 ب.ظ
Hi there! I could have sworn I've visited this web site before but after browsing through many of the posts I realized it's new to me.
Nonetheless, I'm certainly pleased I found it
and I'll be bookmarking it and checking back regularly!
What is limb lengthening surgery?
یکشنبه 1396/05/15 06:03 ق.ظ
you're actually a good webmaster. The site loading pace is
amazing. It kind of feels that you're doing any unique trick.

In addition, The contents are masterpiece.
you've performed a magnificent task in this topic!
How long will it take for my Achilles tendon to heal?
سه شنبه 1396/05/10 12:15 ق.ظ
Appreciate the recommendation. Let me try it out.
Foot Problems
شنبه 1396/05/7 10:12 ب.ظ
Its not my first time to pay a visit this web site, i
am browsing this web page dailly and take pleasant data from here all the time.
manicure
چهارشنبه 1396/02/6 02:31 ب.ظ
My spouse and I absolutely love your blog and find nearly all of your post's to be what precisely I'm looking for.

Do you offer guest writers to write content for
you personally? I wouldn't mind writing a post or elaborating on some of the subjects you write in relation to here.
Again, awesome website!
BHW
پنجشنبه 1396/01/24 02:45 ب.ظ
I'll immediately clutch your rss feed as I can not find your e-mail subscription link or newsletter service.
Do you have any? Kindly allow me understand so that I may subscribe.
Thanks.
manicure
سه شنبه 1396/01/22 01:05 ق.ظ
What i do not understood is in reality how you're now not actually much more well-appreciated than you may be now.
You are very intelligent. You realize therefore considerably on the subject of
this topic, produced me for my part consider it from so many various angles.
Its like women and men are not interested unless it's something
to do with Lady gaga! Your personal stuffs great.
All the time deal with it up!
manicure
جمعه 1396/01/11 03:12 ب.ظ
I am genuinely pleased to glance at this website posts which carries lots of useful facts, thanks for providing these
kinds of data.
 
لبخندناراحتچشمک
نیشخندبغلسوال
قلبخجالتزبان
ماچتعجبعصبانی
عینکشیطانگریه
خندهقهقههخداحافظ
سبزقهرهورا
دستگلتفکر