Solved

Form Manipulation

Posted on 2006-10-29
9
214 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 13

Assisted Solution

by:newyuppie
newyuppie earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

16 Experts available now in Live!

Get 1:1 Help Now