Autor Beitrag
Csharp-programmierer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 696
Erhaltene Danke: 10

Windows 8.1
C# (VS 2013)
BeitragVerfasst: Di 12.07.16 22:46 
Hallo,
ich habe 11 MetroTiles, die ich manuell der Form hinzufüge. Ziel ist es, dass wenn die Maus über das Element fährt, die Größe per MetroFramework verkleinert wird. Wenn man die Maus dann wieder loslässt, dann soll das Tile wieder auf die normale Größe vergrößert werden. Das habe ich schon ein wenig hinbekommen:

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
private void CreateOpenTile()
        {
            MetroTile tile = new MetroTile();
            tile.Style = MetroColorStyle.Blue;
            tile.UseTileImage = true;
            tile.TileImage = global::Mainlysoft_Modern_Plugin.Properties.Resources.OpenProjekt;
            tile.TileImageAlign = ContentAlignment.MiddleCenter;
            tile.Size = new Size(00);
            tile.MouseHover += new EventHandler(x);
            tile.Name = "Open";
            tile.MouseLeave += new EventHandler(yTile1);
            tile.Click += new EventHandler(TileClick);
            tile.Location = new Point(31,31);
            this.Controls.Add(tile);

            MetroFramework.Animation.ExpandAnimation animation = new MetroFramework.Animation.ExpandAnimation();
            animation.Start(tile, new Size(100100), MetroFramework.Animation.TransitionType.EaseInCubic, 20);
        }


Hier werden alle Tiles erstellt, und mit den Events verknüpft.

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
private void yTile1 (object sender, EventArgs e)
        {
            var v = sender as MetroTile;
            if (v != null)
            {
                if (v.Name == "Open")
                {
                    this.label2.Text = "";
                    MetroFramework.Animation.ExpandAnimation an = new MetroFramework.Animation.ExpandAnimation();
                    an.Start(v, new Size(100,100), MetroFramework.Animation.TransitionType.EaseInCubic, 15);
                }
            }
        }


ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
private void x(object sender, EventArgs e)
        {
            var v = sender as MetroTile;
            if (v.Name == "Open")
            {
                this.label2.Text = "Projekt öffnen";
                MetroFramework.Animation.ExpandAnimation an = new MetroFramework.Animation.ExpandAnimation();
                an.Start(v, new Size(8585), MetroFramework.Animation.TransitionType.EaseInCubic, 20);
            }
}


Soo. Wenn ich die Maus langsam über die Tiles bewege, dass funktioniert es auch. Wenn ich die Maus schnell bewege, dann fangen alle Elemente an zu zappeln. Ich denke mal es liegt daran, dass die eine Methode das Tile vergrößert/verkleinert, währen die andere Methode schon wieder etwas neues macht, ohne dass die andere schon fertig war.

Wie kann ich das Problem nun lösen?

_________________
"Wer keinen Sinn im Leben sieht, ist nicht nur unglücklich, sondern kaum lebensfähig" - Albert Einstein
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 13.07.16 01:40 
- Nachträglich durch die Entwickler-Ecke gelöscht -
Csharp-programmierer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 696
Erhaltene Danke: 10

Windows 8.1
C# (VS 2013)
BeitragVerfasst: Do 14.07.16 22:04 
Okay, ich habe jetzt alle MouseHovers durch Mouseenter ersetzt. Es funktioniert aber immer nocht nicht.

ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
 private void yTile9(object sender, EventArgs e)
        {
            var v = sender as MetroTile;
            if (v != null)
            {
                if (v.Name == "YouTube")
                {
                    this.label2.Text = "";
                    MetroFramework.Animation.ExpandAnimation an = new MetroFramework.Animation.ExpandAnimation();
                    an.Start(v, new Size(100100), MetroFramework.Animation.TransitionType.EaseInCubic, 10);
                }
            }
        }

        private void yTile10(object sender, EventArgs e)
        {
            var v = sender as MetroTile;
            if (v != null)
            {
                if (v.Name == "Google+")
                {
                    this.label2.Text = "";
                    MetroFramework.Animation.ExpandAnimation an = new MetroFramework.Animation.ExpandAnimation();
                    an.Start(v, new Size(100100), MetroFramework.Animation.TransitionType.EaseInCubic, 10);
                }
            }
        }


private void CreateHomepageTile()
        {
            MetroTile tile = new MetroTile();
            tile.Style = MetroColorStyle.Blue;
            tile.UseTileImage = true;
            tile.TileImage = global::Mainlysoft_Modern_Plugin.Properties.Resources.Homepage;
            tile.TileImageAlign = ContentAlignment.MiddleCenter;
            tile.Size = new Size(00);
            tile.MouseLeave += new EventHandler(yTile9);
            tile.Name = "Homepage";
            tile.MouseEnter += new EventHandler(x);
            tile.Click += new EventHandler(TileClick);
            tile.Location = new Point(381,171);
            this.Controls.Add(tile);

            MetroFramework.Animation.ExpandAnimation animation = new MetroFramework.Animation.ExpandAnimation();
            animation.Start(tile, new Size(13665), MetroFramework.Animation.TransitionType.EaseInCubic, 20);
        }

        private void CreateYouTubeTile()
        {
            MetroTile tile = new MetroTile();
            tile.Style = MetroColorStyle.Blue;
            tile.UseTileImage = true;
            tile.TileImage = global::Mainlysoft_Modern_Plugin.Properties.Resources.YouTube;
            tile.TileImageAlign = ContentAlignment.MiddleCenter;
            tile.Size = new Size(00);
            tile.MouseLeave += new EventHandler(yTile10);
            tile.Location = new Point(452,31);
            tile.Click += new EventHandler(TileClick);
            tile.Name = "YouTube";
            tile.MouseEnter += new EventHandler(x);
            this.Controls.Add(tile);

            MetroFramework.Animation.ExpandAnimation animation = new MetroFramework.Animation.ExpandAnimation();
            animation.Start(tile, new Size(6565), MetroFramework.Animation.TransitionType.EaseInCubic, 20);
        }

var v = sender as MetroTile;
            if (v.Name == "Open")
            {
                this.label2.Text = "Projekt öffnen";
                MetroFramework.Animation.ExpandAnimation an = new MetroFramework.Animation.ExpandAnimation();
                an.Start(v, new Size(8585), MetroFramework.Animation.TransitionType.EaseInCubic, 10);
            }
            if (v.Name == "New")
            {
                this.label2.Text = "Neues Projekt erstellen";
                MetroFramework.Animation.ExpandAnimation an = new MetroFramework.Animation.ExpandAnimation();
                an.Start(v, new Size(8585), MetroFramework.Animation.TransitionType.EaseInCubic, 10);
            }

_________________
"Wer keinen Sinn im Leben sieht, ist nicht nur unglücklich, sondern kaum lebensfähig" - Albert Einstein
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 15.07.16 00:39 
- Nachträglich durch die Entwickler-Ecke gelöscht -
Csharp-programmierer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 696
Erhaltene Danke: 10

Windows 8.1
C# (VS 2013)
BeitragVerfasst: Fr 15.07.16 09:29 
Okay. Das habe ich gemacht, an sich funktioniert es ja, aber wenn man die Maus schnell (unter 1s) über die Elemente bewegt, flackern sie :(

_________________
"Wer keinen Sinn im Leben sieht, ist nicht nur unglücklich, sondern kaum lebensfähig" - Albert Einstein
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 15.07.16 09:48 
- Nachträglich durch die Entwickler-Ecke gelöscht -