Solved

Form Manipulation

Posted on 2006-10-29
9
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 30

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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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
 
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 30

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 30

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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