문제

I am developing windows form application. In that I am using FlowLayoutPanel. I am placing all the controls inside that FlowLayoutPanel panel. I am interested in doing something like the windows 8 home screen. I would place the controls inside the FlowLayoutPanel panel and have the controls one after another at a certain speed.

Is there any option to achieve that?

Actually what I am doing is,

In my form I have controls as like follows inside FlowLayoutPanel

Main FlowLayoutPanel properties.

this.flpFullLayout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                    | System.Windows.Forms.AnchorStyles.Left)));
this.flpFullLayout.AutoScroll = true;
this.flpFullLayout.BackColor = System.Drawing.SystemColors.Control;
this.flpFullLayout.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flpFullLayout.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flpFullLayout.Location = new System.Drawing.Point(2, 32);
this.flpFullLayout.Name = "flpFullLayout";
this.flpFullLayout.Size = new System.Drawing.Size(1014, 559);
this.flpFullLayout.Controls.Add(this.pnlDummy1);
this.flpFullLayout.Controls.Add(this.pnlAddUserFull);
this.flpFullLayout.Controls.Add(this.pnlDummy2);
this.flpFullLayout.Controls.Add(this.pnlAccess);
this.flpFullLayout.Controls.Add(this.pnlDummy3);
this.flpFullLayout.Controls.Add(this.pnlDashBord);

In form load I am reducing dummy panel sizes through background worker.

Thread.Sleep(200);
            if (pnlDummy2.InvokeRequired)
                pnlDummy2.Invoke(new MethodInvoker(delegate
                {
                    for (int len = 570; len > 0; len -= 10)
                   {
                        Thread.Sleep(2);
                        pnlDummy2.Size = new Size(950, len);
                        flpFullLayout.ScrollControlIntoView(pnlAddUser);
                    }
                    pnlDummy2.Visible = false;
                    flpFullLayout.ScrollControlIntoView(pnlAddUser);
                }));
            else
            {
                for (int len = 570; len > 0; len -= 10)
                {
                    Thread.Sleep(2);
                    pnlDummy2.Size = new Size(950, len);
                    flpFullLayout.ScrollControlIntoView(pnlAddUser);
                }
                pnlDummy2.Visible = false;
                flpFullLayout.ScrollControlIntoView(pnlAddUser);
            }
            Thread.Sleep(200);
            if (pnlDummy3.InvokeRequired)
                pnlDummy3.Invoke(new MethodInvoker(delegate
                {
                    for (int len = 570; len > 0; len -= 10)
                    {
                        Thread.Sleep(2);
                        pnlDummy3.Size = new Size(950, len);
                        flpFullLayout.ScrollControlIntoView(pnlAddUser);
                    }
                    pnlDummy3.Visible = false;
                    flpFullLayout.ScrollControlIntoView(pnlAddUser);
                }));
            else
            {
                for (int len = 570; len > 0; len -= 10)
               {
                    Thread.Sleep(2);
                   pnlDummy3.Size = new Size(950, len);
                   flpFullLayout.ScrollControlIntoView(pnlAddUser);
                }
                pnlDummy3.Visible = false;
                flpFullLayout.ScrollControlIntoView(pnlAddUser);
            }

I am doing this things to achieve simple animation. Is there any easy way to do like this.

도움이 되었습니까?

해결책

If you're doing this with Windows Forms, you're limiting yourself to what you can realistically achieve.

If you are rolling this solution yourself, you'd be better off rolling a completely custom control.

If you have some spare cash, there are already component companies out there who provide a windows 8 style, metro tile interface.

For best results, ditch Windows Forms and use WPF.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top