|
|
Comments and Discussions
|
|
 |

|
i found your code simple and usefull but i am facing difficulty in implementing your logic as your code is not for beginers. i am a newbie and not much familiar to c sharp. can you make a simple code which contains a textbox and a arrow animation. you sample project is to heavy to understand.
please sir,
i want your this technique to be used in my project
|
|
|
|

|
I'm not really sure what you are trying to do and unfortunately I cannot teach the basics of C# over this article.
The demo project has really simple C# code.
Using a locus effect in your projects requires only a few lines of code.
For example:
locusEffectsProvider.Initialize();
locusEffectsProvider.ShowLocusEffect( this, .RectangleToScreen( locusArea.Bounds ), LocusEffectsProvider.DefaultLocusEffectArrow );
Good luck,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
if i want same effect toward a textbox in a windows form what can i do??
can you write the simple guidelines plz?
i just have to write the simple three lines?
|
|
|
|

|
Download the demo, analyze and look at the sources, and it is right there - I have an example of pointing an effect to a text box.
Good luck
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
I want to show a locus effect after the last window of my application has closed.
Currently, I get no locus effect being show.
My question is:
Ist it possible to show a locus effect right on the desktop without any active form?
Wollen Sie ganz einfach Ihre eigene Homepage erstellen, ohne HTML-Kenntnisse, einfach, professionell und mit viel Freude? Probieren Sie unser Desktop Content Management System (CMS) Zeta Producer für Windows aus. Komplett mit eigenem Shop, Gästebuch, Weblog, Bildergalerien, Integration von YouTube-Videos. Wir haben eine aktive Anwender-Community, schnellen Support, sympathische Support-Mitarbeiter.
|
|
|
|

|
I'm really not sure what you're trying to do.
If the last window of the application has closed, then the application is finished. In that case the process dies - If you need to run 'post mortem' locus effects, then another process is needed (=spawned) before the original app dies, in order handle that.
In principle, Locus Effects can point to any point in the screen - but it does need an activator form.
So you can create a small windows app that has a hidden window and let Locus Effects run of it.
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Thanks, Yuval
I want to have my app (Zeta Uploader Windows Client [^]) that uploads a file to a server, to show a short notification at the end of the process, after the upload finished (and before the upload window is being destroyed, but after it becomes hidden).
Since the app could run for several minutes and might very well be in the background, behind other apps, my idea was to show a locus effect with a text "Upload finished, URL copied to clipboard" as a topmost message.
Not sure whether this works, what I remember from looking at your sources (IIRC) is that the locus effect is hidden when the owning window is not in the foreground.
Wollen Sie ganz einfach Ihre eigene Homepage erstellen, ohne HTML-Kenntnisse, einfach, professionell und mit viel Freude? Probieren Sie unser Desktop Content Management System (CMS) Zeta Producer für Windows aus. Komplett mit eigenem Shop, Gästebuch, Weblog, Bildergalerien, Integration von YouTube-Videos. Wir haben eine aktive Anwender-Community, schnellen Support, sympathische Support-Mitarbeiter.
|
|
|
|

|
Uwe,
Currently an activator form is needed.
I have no bandwidth to change it now, but will try to see if I can remove that requirement (and make it an option).
It may take a few days until I get to it.
OR - you can try and do it your self.
Thanks,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Thanks a lot, Yuval
This is really a low low low priority for me. If you ever find the time I would be very gladful, or I'll take a look some hours in one of the following weekends.
Cheers
Uwe
Wollen Sie ganz einfach Ihre eigene Homepage erstellen, ohne HTML-Kenntnisse, einfach, professionell und mit viel Freude? Probieren Sie unser Desktop Content Management System (CMS) Zeta Producer für Windows aus. Komplett mit eigenem Shop, Gästebuch, Weblog, Bildergalerien, Integration von YouTube-Videos. Wir haben eine aktive Anwender-Community, schnellen Support, sympathische Support-Mitarbeiter.
|
|
|
|

|
Please get the latest version from Google Code, and let me know if it works for you or not.
For activatorForm simply pass null.
The test application tests that in the 'Show' with absolute screen coordinates, under Misc tab
http://code.google.com/p/locus-effects/[^]
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Thank you, Yuval!
Since I want to show an effect after the main windows is being closed, I tried to modify your example application with something based on your function
private void showScreenButton_Click( object sender, EventArgs e )
So I ended up with:
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
Hide();
var x = 100;
var y = 100;
var locusRect = new Rectangle(x, y, 1, 1);
locusEffectsProvider.ShowLocusEffect(null, locusRect, m_activeLocusEffectName);
Thread.Sleep(2000);
}
It seems that this is not working, i.e. nothing is shown on the screen. I also tried to debug into it, but found nothing I could get a reason out.
Next I tried to not hook the Closing event but explicitely bind it to a button:
private void button1_Click(object sender, EventArgs e)
{
Hide();
var x = 100;
var y = 100;
var locusRect = new Rectangle(x, y, 1, 1);
locusEffectsProvider.ShowLocusEffect(null, locusRect, m_activeLocusEffectName);
Thread.Sleep(2000);
Close();
}
This does not show anything, just a short flickering effect, after the 2000 ms timer expires.
Any ideas on whether it is possible at all to get an effect with no visible window of my application?
Wollen Sie ganz einfach Ihre eigene Homepage erstellen, ohne HTML-Kenntnisse, einfach, professionell und mit viel Freude? Probieren Sie unser Desktop Content Management System (CMS) Zeta Producer für Windows aus. Komplett mit eigenem Shop, Gästebuch, Weblog, Bildergalerien, Integration von YouTube-Videos. Wir haben eine aktive Anwender-Community, schnellen Support, sympathische Support-Mitarbeiter.
|
|
|
|

|
I just tested this code, works fine:
private void hideButton_Click(object sender, EventArgs e)
{
Hide();
int x = Convert.ToInt32(xTextBox.Text);
int y = Convert.ToInt32(yTextBox.Text);
System.Drawing.Rectangle locusRect = new Rectangle(x, y, 1, 1);
locusEffectsProvider.ShowLocusEffect(null, locusRect, m_activeLocusEffectName);
for (int i = 0; i < 400; i++)
{
System.Threading.Thread.Sleep(5);
Application.DoEvents();
}
this.Close();
}
A long sleep is not good as you're are putting the main UI thread to sleep. What I wrote is a busy loop which forces the message pump to work (by calling Application.DoEvents) but still does not make the CPU work 100% of the time. Locus effects is after all a window that needs that message pump to work.
I checked-in the revised code to Google Code.
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
modified 27 Jun '12 - 23:51.
|
|
|
|

|
Thanks Yuval, that makes sense, I've overseen that message loop thing.
I'll try out immediately
Wollen Sie ganz einfach Ihre eigene Homepage erstellen, ohne HTML-Kenntnisse, einfach, professionell und mit viel Freude? Probieren Sie unser Desktop Content Management System (CMS) Zeta Producer für Windows aus. Komplett mit eigenem Shop, Gästebuch, Weblog, Bildergalerien, Integration von YouTube-Videos. Wir haben eine aktive Anwender-Community, schnellen Support, sympathische Support-Mitarbeiter.
|
|
|
|
|

|
Are you planning to create a wpf library as well?
|
|
|
|

|
Hi,
Thanks - Glad to see you like it.
Unfortunately, I do not have spare time to re-create Locus Effects in WPF..sorry.
Maybe one day.
Cheers
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Yuval Naveh wrote an article on Locus effects. At the bottom there was a revision list and one revision stated that a fix was made for effects not showing on non-primary monitors in a mutliple monitor configuration.
I'm having the same trouble with a project I'm working on and so I was wondering what the code change was in Yuval's project that fixed the problem for him?
thanks very much for your contribution!
Fritz
|
|
|
|

|
Fritz,
The code changes are in the code already.
I tested it on multi monitors and it worked fine.
What kind of problems are you experiencing?
(The latest code is in Google Code)
Thanks
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Thanks Yuval for your reply. I'm not having trouble with your project, just wondering what changes you made to get it to work on multiple monitors since I have an unrelated project that's experiencing the same kind of problem (drawing an image via gdi and using UpdateLayeredWindow on an XP pro machine with 2 monitors works on the primary monitor but doesn't show up on the secondary one). So I thought if I knew what differences there were for your project to fix that problem I might learn from it.
regards,
Fritz
|
|
|
|

|
Hi Fritz,
First, I'm glad to share information between projects.
Second, it is a relief to know the Locus Effects does not have a bug
As for your question:
I think the way I handled it was to use Screen.FromPoint & SystemInformation.VirtualScreen.
If you look at EffectWindow.CalculateBitmapBounds you will see the framework's calculation of where to position the effect.
if ( locusScreenBounds.Top - newSize.Height <= SystemInformation.VirtualScreen.Top )
{
newLocation.Y = locusScreenBounds.Bottom;
south = false;
}
...
else if ( m_effect.AnchoringMode == AnchoringMode.CenterMonitor )
{
Screen screen = Screen.FromPoint( new Point(
locusScreenBounds.Left + locusScreenBounds.Width / 2,
locusScreenBounds.Top + locusScreenBounds.Height / 2 ) );
newLocation.X = screen.WorkingArea.Left + ( screen.WorkingArea.Width - newSize.Width ) / 2;
newLocation.Y = screen.WorkingArea.Top + ( screen.WorkingArea.Height - newSize.Height ) / 2;
}
Good luck,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
lol, yeah, I'm glad I didn't find a bug for you either. Actually your project is a bit complicated for me right now but it's a good learning experience because I've not used C# before, so I was just trying to find the piece that hopefully made the difference. I really appreciate you getting back to me so fast as I've been stuck on this for a while now. Hopefully I'll figure this out tonight with this input.
Cheers, and happy holidays!
By the way, I checked out a few of your photos (I'm a photographer myself on the side with a B&W darkroom at home)--nice!
Thanks again for sharing your work.
Fritz
|
|
|
|

|
yeay! found my problem. I was making a call to CreateCompatible bitmap with a size that was too small. I figured it out by playing with values in my project after looking at what values you were passing to UpdateLayeredWindow in the debugger. I'll probably look at your code in more detail when I get around to making it faster.
I think this article is great from a human factors perspective too. I went back to get my masters in human factors (finished in early 2008), but there's always more to learn. thanks again for your post--great work!
|
|
|
|

|
Hello dear users,
Following a very good suggestion from one of the users, John Hatton, I have decided to change the license to LGPL.
The code with new license can be found in GoogleCode:
http://code.google.com/p/locus-effects/[^]
Thanks,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
The new version is under Trunk.
Version 1.0 is under Branches/V1. It contains the original CodeProject code (VS.2003) + an exception fix found by one of the users) .
I tested it and it seems to be working just fine, but please let me know if there are any issues.
Thanks,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
So very happy to see you do that. Thanks. The lack of an ongoing, version-controlled project is in my opinion the weakest aspect of Code Project. It encourages us all to fork and not give back. It means, in the end, that the .net open source environment is weaker than some other platforms.
May I request that you reconsider the license you put on the google code version? By making it GPL, you put your great work off limits from any project which cannot, itself, be GPL. All my work (e.g. wesay.org) is open-source, but we need to stay with more permissive licenses, otherwise we shut the door to ever including a commercial component, ever.
Thanks for considering this.
|
|
|
|

|
I totally agree about Code Project weakness point.
But this combination of Google Code could work out well. Code Project for article, Google Code for code.
As for GPL license - sure, I'm all open to that and it could be changed quickly.
[Edit] Looking into LGPL right now.
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
modified on Tuesday, April 28, 2009 8:45 PM
|
|
|
|

|
Hi John,
Following your suggestion the license has been changed to LPGL - please see announcement above.
Thanks,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Hi Yuval,
I love your locus effect framework and suggest some new features:
- Allow showing (ShowLocusEffect function)the locus only one time at beginning with supporting automatically loop
- Support ShowLocus for Control (not Form in this function), such as ShowLocusEffectControl(Control activatorControl, Rectangle locusScreenBounds). This doesn't require absolute coordinates (screen coordinates), only control's coordinates
- Allow manually setting position for the locus
Hopefully, you will consider and add the new features
Thanks you so much !
Keep up the good workd,
modified on Thursday, November 5, 2009 8:42 PM
|
|
|
|

|
Hi,
Thanks for the feedback!
As for the suggestions you raised:
1. I don't quite understand this suggestion. Could you please elaborate or give an example?
The locus effect shows only one time, how does the loop work with that requirement?
2. This is a very good suggestion - It is already possible to do it today, though it does require some extra work.
So I decided to add this functionality as a helper function which will accept two parameters - the control and the locus effect name. The effect will point to the center of the control (I might add an optional enumeration to allow control on the position inside the control - e.g. TopLeft, Center, etc.)
public void ShowLocusEffect(Control locusControl, string locusEffectName);
3. Manual positioning of the locus effect was possible since day 1.
If you look at the example tab in the demo application, you will see a test case that shows manual positioning of the locus effects, but here is the code of that sample to make it easier for you to understand:
private void showScreenButton_Click( object sender, EventArgs e )
{
int x = Convert.ToInt32( xTextBox.Text );
int y = Convert.ToInt32( yTextBox.Text );
System.Drawing.Rectangle locusRect = new Rectangle( x, y, 1, 1 );
locusEffectsProvider.ShowLocusEffect( this, locusRect, m_activeLocusEffectName );
}
Important note: All code changes will be committed to the GoogleCode repository. I am no longer uploading code to CodeProject as it has become too hard to maintain - SVN is much easier and can be done at any time.
Look at: http://code.google.com/p/locus-effects/[^]
Thanks!
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Awesome, you have replied me, thanks
- In the first 'new feature' i have suggested, i mean,the locus can automatically loop until we stop it.
After we call, locusEffectProvider.ShowLocusEffect(...), then the locus effect will automatically check when animation stops, it will automatically start again (that is my LOOP) until we call the stop function (PLEASE SUUPORT !!!)
- In the second 'new feature', i mean, we can display the locus effect with local coordinate of control, such as, a panel with: width = 100, height = 100 then we can display the locus effect at pair of coordinates (x,y with x = 0 to 99 and y = 0 to 99). So I need a function like: ShowLocusEffect(Control activatorControl, int coordX, int coordY, string name);
where coordX and coordY is coordinates on Control
in the function you updated:
public void ShowLocusEffect(Control locusControl, string locusEffectName);
What happen if locusControl lies on a pane1, panel1 lies on a panel2, panel2 lies on a tab....
One more feature: smoothing efect !!!
I have a question, i have picture box on form, how can I display the locus effect at pixel coordinates of image in picture box ?
Thank you so much for the locus effect !
Btw, The locus effect should open a showcase page ?
modified on Friday, November 6, 2009 4:04 AM
|
|
|
|

|
OK - I see that you are full of enthusiasm, which is great.
So:
1. You don't need to run in a loop like you are doing it today. The easiest way is simply to use the AnimationTime property and set it to what ever you want (Very big number will be infinite practically)
m_customTimedLocusEffect.AnimationTime = int.Parse(animationLengthTextBox.Text);
locusEffectsProvider.ShowLocusEffect(demoControl, "CustomTimed");
2. Will implement offset, but later. Pretty swamped right now. I'll reply to this thread once I'm done, so you'll get a notification.
3. Smoothing effect - what do you mean? Can you give an example? Fade In and Fade Out are implemented already.
4. Picture Box or any other control - you need to convert the control coordinates to screen coordinates using the Control.PointToScreen method. This also is the reason why the panel1/panel2 scenario example you gave will work - .NET knows how to take care of this hierarchy properly.
Be sure to take the latest version from Google Code.
Thanks
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
" m_customTimedLocusEffect.AnimationTime = int.Parse(animationLengthTextBox.Text)"
This is only the time from start to stop of one cycle, the locus effect doesn't automatically start again when it stops !
I mean, we don't need to cal ShowLocusEffect again after we call it yet
|
|
|
|

|
http://code.google.com/p/locus-effects/
The main reason behind this is to have Subversion source control & issue tracking.
The article remains here in Code Project and will be updated from time to time, if needed.
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Dim efText As New BigMansStuff.LocusEffects.TextLocusEffect
efText.Text = "Hellow world !"
Me.LocusEffectsProvider.ShowLocusEffect(Me, screenP, efText)
========================================
It didn't work.
|
|
|
|

|
Hi,
Did you initialize the framework?
locusEffectsProvider.Initialize();
What exactly doesn't work?
Is there an error? If so what is the error you get?
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Carefully Read your Example ,i get it.
by the way ,do the TextEffect surpport multiline text?
|
|
|
|

|
Sorry about the late answer - missed the question.
Yes: there is multi-line text support.
If you look at the demo application, there is a radio button 'Full Screen Text'.
Use it and you should see a two line message 'Operation Cancelled!' across the screen.
HTH,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
hi ,you make a elegant Artefact
|
|
|
|

|
Thanks!
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
I have search for a long time on the Internet for code that mimic the beautiful visual effect of Code Rush like in the example that you talk on the introduction. The visual effect that you have created was a great work... lot of time to program I'm sure and I have no other word to say except: WOW!!!
I'll don't ask you when you will enhance this component because I'm sure that it take lot of brain to create this nice result but with your permission, I will print this article and read it with the company of your code to etablish a strategy to integrate this to my application. I'm not sure if it's a good idea to add to much visual effect to an application but I love the concept of "Locus". A term that I have search for a long time ago...
Thank you again. Great work.
|
|
|
|

|
Thank you for your appreciation.
You are more than welcome to do whatever comes up to your mind with Locus Effects.
Read the license which is in every source file, on top.
My view on usage of this component is simple: It has to be done when appropriate. When overdone (i.e. Locus Effect in every corner of the application) the concept might be missed altogether to produce UI which can be distracting to the user.
Yuval
P.S. About upgrades - I am really sorry, but I am totally out of time (Work, Family, Studies..) and releasing an untested version is something I will not do. Version 1.0 is stable and working just fine.
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Hello,
This library is great. You're talking about the next version since a few months.
Do you think we'll be able to see it soon ? If yes, when ?
I plan to start a project using it and would like to use the version 2 from the start, as I guess it'll be even better !
Julien
|
|
|
|

|
Hi Julien,
I will try to do this by the end of this month (September).
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Sorry - can't get to publish it yet. Just choked on time.
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Julien,
It took me way too much time..but 2.0 is out now.
Thanks,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
I get an InvalidOperation "Object is currently in use elsewhere." with the message "Object is currently in use elsewhere." x when attempting to show 100 effects in a loop:
for (int i = 0; i < 100; ++i )
locusEffectsProvider1.ShowLocusEffect(this, new Rectangle(200+4*i, 200+4*i, 100, 100), LocusEffectsProvider.DefaultLocusEffectArrow);
|
|
|
|

|
Hi,
Yes, I see this bug too.
This issue needs to be investigated. It seems to do with some assumptions I made thread already running.
As a temporary workaround, try adding a short Sleep in the loop (10 msec works for me):
// Show the selected locus effect
for (int i = 0; i < 100; ++i)
{
locusEffectsProvider.ShowLocusEffect(this, new Rectangle(200 + 4 * i, 200 + 4 * i, 100, 100), LocusEffectsProvider.DefaultLocusEffectArrow);
System.Threading.Thread.Sleep(10);
}
Once I have the fix, it will be posted.
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Hi,
This is a fantastic library - I've encountered the above exception as well though, I'm doing much the same but intead of a loop I'm calling ShowLocusEffect when cells on a grid control change. If the cells change to quickly the exception gets thrown.
Regards
Dave
|
|
|
|

|
Hi Dave,
Thanks again for your appreciation.
Your diagnostic seems logical - this exception seems to happen on rapid re-launch of an effect.
Give me a some time (I have no time now..) and you guys will see a fix.
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|

|
Hi Yuval.
Thanks, I look forward to the fix. Out of interest, once fixed is it possible to have several animations running simulataneously using a single LocusEffectsProvider?
Dave
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
.NET/C# visual effects framework for changing the user's locus of attention to an area on the screen.
| Type | Article |
| Licence | CPOL |
| First Posted | 3 Jul 2005 |
| Views | 171,688 |
| Bookmarked | 181 times |
|
|