I'm trying to make a rectangle follow my mouse along the X axis.
For some reason, the rectangle toggle between two places on my form, both
somewhat proportional from where I first click, but neither in line with the
mouse pointer. It's as if at:
* one pixel X=how far the mouse has moved from the point it clicked, the
* next pixel X=current X position minus how far the mouse has moved.
Here's my code.
Private Sub rctMarker_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
If (Button And acLeftButton) 0 Then
rctMarker.Left = X
End If
End Sub
Am I doing this correctly, or am I supposed to reference to the forms X
reference?
Thanks in advance.
Dom 2 1575
Dominic Vella wrote:
I'm trying to make a rectangle follow my mouse along the X axis.
For some reason, the rectangle toggle between two places on my form,
both somewhat proportional from where I first click, but neither in
line with the mouse pointer. It's as if at:
* one pixel X=how far the mouse has moved from the point it clicked,
the * next pixel X=current X position minus how far the mouse has moved.
Here's my code.
Private Sub rctMarker_MouseMove(Button As Integer, Shift As Integer,
X As Single, Y As Single)
If (Button And acLeftButton) 0 Then
rctMarker.Left = X
End If
End Sub
Am I doing this correctly, or am I supposed to reference to the forms
X reference?
This should center the rectangle on your mouse, and move it as you want:
rctMarker.Left = rctMarker.Left + X - (0.5 * rctMarker.Width)
Ohhh, I'm supposed to re-reference to my rctMarker.Left. How interesting.
Thanks.
Dom
"DFS" <nospam@dfs_.comwrote in message
news:g9******************@bignews2.bellsouth.net.. .
Dominic Vella wrote:
>I'm trying to make a rectangle follow my mouse along the X axis.
For some reason, the rectangle toggle between two places on my form, both somewhat proportional from where I first click, but neither in line with the mouse pointer. It's as if at: * one pixel X=how far the mouse has moved from the point it clicked, the * next pixel X=current X position minus how far the mouse has moved.
Here's my code.
Private Sub rctMarker_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If (Button And acLeftButton) 0 Then rctMarker.Left = X End If End Sub
Am I doing this correctly, or am I supposed to reference to the forms X reference?
This should center the rectangle on your mouse, and move it as you want:
rctMarker.Left = rctMarker.Left + X - (0.5 * rctMarker.Width)
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Haines Brown |
last post by:
I have a table with three columns, and I want the data in the first
column to align left, while that in the remaining columns to align
right:
#testTable { text-align: right; }
#leftcol {...
|
by: Steven T. Hatton |
last post by:
The following may strike many of you as just plain silly, but it represents
the kind of delelima I find myself in when trying to make a design
decision. This really is a toy project written for...
|
by: kimos |
last post by:
hi all,
how to calculate the intersection of 2 rectangle
a rectangle is the following:
Rectangle makeRectangle (Point lowerLeft, Point upperRight) {
Rectangle r;
|
by: |
last post by:
I am having a hard time understanding the logic behind the Rectangle object.
My problem has to do with the way the rectangle treats the "Width" property.
For example, take the following rectangle...
|
by: Wannabe_Geek |
last post by:
Do we have something in ASP.net like freemarker for
java.(freemarker.sourceforge.net)
The idea is to use simple HTML file as template for the site and replace the
Marker tags with appropriate...
|
by: DazedAndConfused |
last post by:
I have a rectangle around text that I want to fill in with color. I do not
know the height of the rectangle until I actually go through and draw out
the text. Is there a way of filling in the...
|
by: RobinS |
last post by:
I am drawing a rectangle on a picture that has already been drawn
on the graphics area (a user control). It works something like this:
//in the MouseDown event
m_isDragging = true;
m_oldX =...
|
by: flymo |
last post by:
Hello All,
Hopefully this is the correct forum...
I have some code that creates a text (dat) for a billing process
created in Access2000, I add an Eof of Line marker to each line item
and then...
|
by: kummu4help |
last post by:
hi,
i want to draw rectangle based on mousedrag event. if user dragging the mouse, then the rectangle on the applet should increase or decrease basing on current mouse coordinates.
i have the...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |