Re: Floating Box for Prices
- From: "Mike Williams" <mikea@xxxxxxxxxxxxxxxxx>
- Date: Sun, 3 Feb 2008 06:02:23 -0000
"Webbiz" <noreply@xxxxxxx> wrote in message news:uCNa5TdZIHA.1132@xxxxxxxxxxxxxxxxxxxxxxx
I applied the above code to my chart program. While it
works that when I click the mouse the box opens and
moves with the mouse, and goes away when I let the
mouse button up, it also pops up when I double-click
the picturebox.
You seem to be getting confused as to which block of code you should be using? The code to which you appear to be referring (judging by the fact that you included it at the head of your response) is the code I posted to show you how you should *not* perform the task of moving your window, which I posted in response to your question asking why you could not simply use the MouseMove event to control the added Form window. It does *not* cause any box or anything else to open when you click the button! That is not its intended purpose. And in that code a double click closes the program! That is exactly what it is supposed to do because in that specific example (a full screen borderless Form) you would otherwise have no easy way of closing it.
It also pops up when I double-click the picturebox.
I am not talking about any slow double-clicks either.
Your remarks (immediately above) were made by you in respect of the same block of code that your first remark (very top of this reponse) referred to. But the two remarks do not "tally". There is no block of code that I posted for you which can fit both of your remarks. You must therefore be talking about two completely different blocks of code. The code block to which I assume you are now referring was posted in response to your question as to how you could pop up a window after a specified "hold down period" on the left mouse button. That code works fine, exactly as described. The Label Control, which is a simple device which "pretends to be" your moving window purely for test purposes, pops up (shows itself) after the specified "hold down" period and it goes away as soon as you let go of the mouse button, exactly as per your stated requirements. It does *not* pop up (show itself) on a double click. In fact I've just checked the message in which I posted that code and I have exactly followed the instructions I posted and have pasted that code into a new VB project containing the controls I mentioned. It works exactly "as it says on the tin". If there is a problem with it after you have incorporated it into your own main project then it is either because you have not incorporated it properly or because parts of your own code are doing something else with the mouse clicks that you have not allowed for. Obviously I do not have your own full project code so I cannot help you with that, but I'm sure you'll be able to find where you have gone wrong if you take a bit of time over it.
Meanwhile, changing the timer value from 100 to
200 does not change this problem. It does, however,
seem to be the length of delay I think works best, as
100 is a bit quick.
As I have already said, the "problem" does not exist in the example code I posted for you. But in any case the Timer Interval property does *not* determine the mouse button "hold down" period, so your remark that "100 is a bit quick" is not correct. The 100 millisecond Interval merely causes the Timer event to fire approximately every 100 millisecond. In that event the actual current time is compared to the previously stored start time and the Label is displayed when the difference between the two exceeds the specified amount, which is 0.5 seconds in the example I posted. This is the line which performs that task:
If t1 > 0.5 Or t1 < 0 Then . . .
If you want to change the "hold down period" then you need to change the 0.5 to whatever value you require. To summarise, the actual "hold down" period is specified in the above line of code (0.5 seconds in the example) and the Timer Interval value (100 milliseconds in the example) merely sets the rate at which the actual elapsed time is checked (and therefore sets the approximate resolution of the timed period). Changing it to 200 will of course have a slight effect of the "hold down" period because it will reduce the overall resolution, but it is not the way to adjust the "hold down" period. To do that you should change the "0.5" value in the "If t1 > 0.5" line.
Anyway, before I answer any of the other questions you have asked you might like to look at the alternative method of moving your small "information window" which was very recently posted by Steve Gerrard and which uses a ToolTip to perform the task. My own opinion is that it definitely does not fit in with the requirement stated in your very first post in this thread, which asked for a method that "moves with mininal (or no) flicker-jitter", which is why I never suggested that method myself. Personally I find that it jitters (or judders or whatever you call it) quite severely, and that it even disappears completely if the mouse happens to fall inside the ToolTip window while you are moving it. However, these things are subjective and different people see things in different ways, and it may well be that you find it suits your requirements. If so then it will of course save you a fair amount of coding.
By the way, one thing that very definitely is causing confusion (at least for me) is your habit of including the entire contents of the post to which you are responding (and sometimes of two or three such posts) at the top of your responses. This makes it very difficult for me to see what you are getting at. It is fine of course to include parts of the post to which you are responding (either at the top or at the bottom of your response or, preferably, "in context" as I personally have the habit of doing), in fact it is often very helpful, but you really should trim it so that it includes only a very short and relevant extract of the original post. Anyway, that's my own opinion. Different people have different opinions on this matter of course, but if you do as I suggest it will definitely make it easier for me to respond to your posts.
Mike
.
- Follow-Ups:
- Re: Floating Box for Prices
- From: Webbiz
- Re: Floating Box for Prices
- References:
- Floating Box for Prices
- From: Webbiz
- Re: Floating Box for Prices
- From: BTIS Jeff
- Re: Floating Box for Prices
- From: Dave O.
- Re: Floating Box for Prices
- From: Webbiz
- Re: Floating Box for Prices
- From: Mike Williams
- Re: Floating Box for Prices
- From: Webbiz
- Re: Floating Box for Prices
- From: Mike Williams
- Re: Floating Box for Prices
- From: Webbiz
- Re: Floating Box for Prices
- From: Webbiz
- Floating Box for Prices
- Prev by Date: Re: Floating Box for Prices
- Next by Date: Re: Runtime Error.. R6030-CRT not initialized : Program:C:\Windows\Sys
- Previous by thread: Re: Floating Box for Prices
- Next by thread: Re: Floating Box for Prices
- Index(es):