Solved

Form Manipulation

Posted on 2006-10-29
9
215 Views
Last Modified: 2010-04-16
Lets say you have a form that is 300 high by 700 long.... now the user fires an event and the bottom half of the form slides out slowly so not you have a form that is 700 high by 700 long.

You see the effect I am looking for, any code examples would be greatly appreciated.
0
Comment
Question by:schenkp
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 29

Expert Comment

by:anarki_jimbel
ID: 17830636
Not exactly sure what do you want to achieve. However, if for example user presses a button the form should change its height to 700. Slowly :)
That's pretty easy:

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Height += 10;
            if (this.Height >= 700)
                timer1.Stop();
        }

All you need is to twick a bit with timer interval and increment (this.Height += 10).
0
 
LVL 13

Expert Comment

by:newyuppie
ID: 17830655
i think the timer is overhead, why not simply put the height in the event handler and avoid the timer?

private void button1_Click(object sender, EventArgs e)
        {
            while (this.Height < 700) {
                this.Height += 50;
            }
        }
0
 

Author Comment

by:schenkp
ID: 17830686
Not the effect I’m looking for maybe i did not explain myself thoroughly enough....

I would like the hidden area to slide into the bottom of the form over say 4 seconds....
0
 
LVL 13

Expert Comment

by:newyuppie
ID: 17830697
if you want to do it in a predefined time you will need to use a timer as anarki_jimbel suggested...
so you need to make the form 700 height, and currently its 300 height. so you need to sum about 100 to its height every second to get to 700.

set the timer's interval to 1000 (1s) and

private void timer1_Tick(object sender, EventArgs e)
        {
            this.Height += 100;
            if (this.Height >= 700)
                timer1.Stop();
        }

as he suggested.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 13

Assisted Solution

by:newyuppie
newyuppie earned 250 total points
ID: 17830706
if you would like nicer slide effect, you should do some calculations on your head. for example, drop the Interval to 500 (half a second) and increase height by 50. or drop the timer interval to 250 (quarter of a second) and increase height by 25. just simple math, as you keep getting the interval smaller, calculate how many intervals it will take to get the correct height when it hits 4 seconds.
if you keep calculating where i left off and use my system, you need to halve the interval and halve the height. this way you wont get lost.

0
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 250 total points
ID: 17830726
2 newyuppie

"i think the timer is overhead"
Don't think so: while you run 'while' loop you form is effectivly unaccessible. Bad practice.

2 schenkp
Pls explain your scenario once more.
As I understand now, avter the event 'hidden' area became visible and dissapears after say for seconds?
Or some 'hidden are' stretches to bottom after 4 seconds?
Or what?
0
 

Author Comment

by:schenkp
ID: 17830828
OK I have 2 panels visible in the 300 x 700 area, in the hidden area I have a some more panels and some controls  etc.   When an event is fired in the 300 x 700 area I would like the bottom half to slide out from 300 x 700 to 700 x 700 over a 4 second period.  
I don’t want the opacity to fade in, I would like to have the panel slide out if possible.  
I am will to buy a 3rd party piece of software to achieve this effect if I have to.
0
 
LVL 29

Expert Comment

by:anarki_jimbel
ID: 17830891
It's not too basic task, I think.
say I have two panes, one visible and one hiddent beneath. When I click the button I shift panel2 location to make it visible.
That's easy. However redrawing the form may look ugly but this is another story:

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Height += 10;

            panel2.SetBounds(panel2.Location.X, panel2.Location.Y+10,panel2.Height, panel2.Width);
            if (this.Height >= 700)
                timer1.Stop();
        }

0
 
LVL 12

Expert Comment

by:sandip132
ID: 17832580
use Javascript :

http://www.dhtmlcentral.com/script/script.asp?id=25

In this example you can write your html code in menu division.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now