在C#中单击鼠标的视觉效果 [英] Visual effect on a mouse click in C#
本文介绍了在C#中单击鼠标的视觉效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望如果我点击图像,它会产生视觉效果,如旋转效果或发光效果,或者在我用鼠标点击的点周围的特定部位上的任何其他效果。例如,如果有人使用了我想要的Windows手机UC浏览器的图片密码。
我尝试了什么:
我没有尝试任何东西,因为我不知道动画和图形因此我没有尝试任何东西。
I want that if i click on an image it gives a visual effect like whirl effect or glow effect or anything else on specific part around the point where i clicked with the mouse. for example if anyone has used the picture password of UC browser of windows phone exactly the same i want.
What I have tried:
I have not tried anything because i have no knowledge of animation and graphics hence i haven't tried anything.
推荐答案
这是Win Forms动画控件的库:为程序员设计的动画眼霜 [ ^ ]
如果您收到Nunit错误,只需在解决方案资源管理器中删除UnitTests
项目。
我认为Form1中的这段代码对你很感兴趣:
Here is a library for Win Forms animated controls: Animated Eye Candy for Programmers[^]
If you get an "Nunit" error, just delete theUnitTests
project in Solution Explorer.
I think this piece of code in Form1 will be of interest to you:
/// <summary>
/// Put a moving spinning star over the Pause button, just to show we can :)
/// </summary>
private void RunAnimationOnPauseButton() {
AnimationAdapter pauseButtonAnimationAdaptor = new AnimationAdapter(this.buttonPause);
Animation pauseButtonAnimation = pauseButtonAnimationAdaptor.Animation;
Sprite imagesprite = new ImageSprite(Properties.Resources.smallGoldstar);
imagesprite.Add(0, 3000, Effects.Move(Corner.MiddleLeft, new Point(-20, 0),
Corner.MiddleRight, new Point(20, 0)));
imagesprite.Add(0, 3000, Effects.Rotate(0, 680));
pauseButtonAnimation.Add(0, imagesprite);
pauseButtonAnimation.Start();
}
这篇文章显示了WPF中的GIF动画: WPF中的GIF动画 [ ^ ]
因为你看起来有点迷茫,我还建议阅读入门使用图形编程:图形编程入门 [ ^ ]
这篇关于在C#中单击鼠标的视觉效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文