滑动和放大器; C#的形式衰落控制 [英] Sliding & Fading controls on a C# form

查看:271
本文介绍了滑动和放大器; C#的形式衰落控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我想实现的方式滑动和放大器;优雅的褪色控制左右(超过一个在同一时间有可能)。因此,换句话说,说我在左上角的图片,并在右下角有一个texbox,我希望能够让他们滑动。不只是捕捉。滑动,以相对的角,并更换eachothers位置。香港专业教育学院已经工作了一段时间,但还没有拿出什么高效的,甚至只是一些基本的数学计算,将是一个很好的开始。

Hey there, I'm trying to implement a way to slide&fade controls around (more than one at the same time possibly) elegantly. So in other words, say i had a picture in the top left corner, and a texbox in the bottom right corner, i'd like to be able to have them slide. not just snap. slide, to the opposite corners and replace eachothers position. Ive been working for awhile but have not come up with anything efficient, even just some of the basic math calculations would be a great start.

推荐答案

查看点净转换在谷歌代码项目。它支持多种线性/非线性过渡,包括可用于更复杂的影响,如纹波复合过渡。

Check out the dot-net-transitions project on Google Code. It supports a variety of linear/non-linear transitions including composite transitions that can be used for more complex effects such as ripple.

下面是一个演示所需的工作示例行为:

Here is a working sample that demonstrates your desired behavior:

var pictureBox = new PictureBox
    {
        ImageLocation = "http://bit.ly/aTsxKI",
        SizeMode = PictureBoxSizeMode.AutoSize
    };
var textBox = new TextBox
    {
        Text = "Hello World",
        Location = new Point(140, 140)
    };
var form = new Form
    {
        Controls =
        {
            textBox,
            pictureBox
        }
    };
form.Click += (sender, e) =>
    {
        // swap the Left and Top properties using a transition
        var t = new Transition(new TransitionType_EaseInEaseOut(1000));
        t.add(pictureBox, "Left", textBox.Left);
        t.add(pictureBox, "Top", textBox.Top);
        t.add(textBox, "Left", pictureBox.Left);
        t.add(textBox, "Top", pictureBox.Top);
        t.run();
    };
form.ShowDialog();

这篇关于滑动和放大器; C#的形式衰落控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆