Getting mouse position to move form

  • Thread starter Thread starter Neil
  • Start date Start date
N

Neil

Hello,

I have a month view control on a form with no border etc. All that is
displayed on the screen is the control. I use this as the generic date
picker for all my date textbox fields. When the user double clicks on a date
textbox, I want this form to open and the top left corner to be where the
mouse pointer is. This leaves me with two questions (the second only being
relevent if the answer is no to the first):

1) Is there an API call that can return the location of the mouse on the
screen (in VB i beleive it is as simple as Screen.x & Screen.y - VBA not so
simple!)?

2) I can use the mouse down event of the text box's to record the mouse
position when a text box is clicked and then move the Month View form to
that position. However, if i use the following for example:

Forms!frmMonthView.Move frm.WindowLeft + CurX, frm.WindowTop + CurY

frm is the form where the textbox that has been clicked is and CurX and CurY
are the XY values passed into the mose down event. There is a slight snag
here... the X and Y single values are in pixels and the Move function treats
the values as twips. Is there a function that will convert pixels to twips
already?

TIA,

Neil.
 
LOL!

Just answered my own question on point 2. x and y are actually in twips. I
was using the mouse down event for the control instead of the form returning
increasingly smaller values than i expected. DOH! :-)

Neil.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top