Text marquee WinForms - winforms

I want to implement scrolling functionality in winforms. I need text to scroll like a marquee, but from the bottom to the top.
How can I do that?

The question is a bit vague, but I think what you want to do is set AutoScroll=true on your form and scrolling will be automatically provided.

I think I know what you want to do. (making a specific area scrollable)
You can do it this way:
Create a form
Drag a panel onto it.
Set the panel docking...the way you want it
Set AutoScroll = true for the panel(Eric has suggested this).
Now drag any other control onto the
the panel.
The panel area is now scrollable.
If you want to make the whole form scrollable then set AutoScroll = true for the form.

In relation to your comment to PK's answer, you'd need to simply code into a timer, or other method, to change the labels/controls Y (Or Top) value, decrementing it as required. Once it reaches -(control Height), change to (Form.Height)+(Control Height) and continue decrementing.

Related

How to scroll contents WHILE scrolling

I have created a usercontrol that is essentially a text editor (using Graphics.Drawstring in OnPaint).
I have set AutoScroll = true, and AutoScrollMinSize values appropriately. Everything is working how it should...
EXCEPT, i would like the control to scroll itself WHILST I am currently scrolling (i.e. click and drag the scroll bar... and whilst it is being dragged the control should be scrolling the entire time). At the moment it only scrolls when the scroll bar is released (mouse up).
I have tried implementing _Scroll and invalidating the control, but that just makes it flicker uncontrollably.
I cannot find any examples online for this, due to it being difficult to describe!
Can anyone point me in the right direction please?
Control.Invalidate() will make something flicker badly. I faced this problem drawing cross-hairs over a mouse position on a PictureBox drawing a line chart before. The trick is to use (and I cant remember which one is best to come first)
Control.Update();
Control.Refresh();
in the Scroll event. Depending on what else you are drawing in the Control and how you are drawing it this may be better for you. Also this is tested on PictureBox, Control may be another matter.

How can I make a panels contents resize with a zoom control?

I am using ExtJS 3.3
I have a main panel containing another panel (containing text) and a grid containing data with a paging toolbar and footer.
There is a zoom control (a combo with values like "100%, "50%", "page width","whole page" ) on the paging toolbar.
I wish to select a zoom level from the combo and have everything on the main panel resize to that zoom level.
I need all other panels on the page to appear unchanged in size.
I have Googled around but cannot see any solutions or extensions available.
How can I do this please? Any ideas?
You should be able to do this using CSS to define the size of each element at each required zoom level. Your combo zoom control would need to have an event handler which would switch the class of the (probably) DIV element which contains the content you want to resize.
There is a StackOverflow question here which is a useful discussion about some ways to acheive the scaling; there are many ways to do it and your choice depends on what you need to acheive. If you provide sight of the display or code you're working on then I could probably make some recommendations.

How should I display a notification bar in WinForms?

You all know the "You've got new answers!" notification bar on SO. I'd like the same thing in a Form, preferably just as smooth. Is there a simple way? Or do I have to completely create this myself?
My searches did not yield any good results, only lots of progress bars and popups in the system notification area, but that's not what I'm looking for.
The messages I want to display belong to a Form, not to the whole application
You could simply animate a panel dropping down from the top of the client area of the form.
Increasing the y coordinate of the panel in a timed loop. The panel would start invisible and slowly become visible. (The panel would start at -panel.height and work its way down to 0.)
Create two panels in your form, a notification panel docked to top, and below that a content panel anchored to top. In your Form.Load, set the height of the notification panel to zero. Don't set the height to zero in Design View, you won't be able to click on the notification panel to edit it.
Then when you get a notification, draw the contents in the notification panel and create a System.Windows.Form.Timer that increases the height of the notification panel by a few pixels every few dozen milliseconds or so. Stop when the panel is of the desired height. Do the same with a negative height to hide the panel.
This does not require repainting or recalculating sizes or positions of anything, does not overdraw anything, and looks slick. I have done this and it works.
If you want it constrained to a particular form, it should be easy enough to put a Panel on the form with its Dock set to DockStyle.Top, then place a label for the description and a button that hides it.
It's not difficult to do with a panel or a UserControl, but the fiddly part is making the contents of the form slide down as the bar slides down. To simplify that I would use a SplitContainer. The top splitpanel contains the notification bar and the splitter distance is initially 0. Slide the bar into view by incrementing the SplitterDistance property. Doing it this way means you don't have to worry about making the other contents of the form slide down (which is a hassle because it prevents you from using docking).
The only downside to using SplitContainer I can think of is that the animation of the bar will be slightly different: the text won't scroll down with the bar, it will be revealed in place as the bar slides down. If this bothers you, you can fix it by having the text (or your panel/custom control) slide down as you increase the splitter distance (only a couple more lines of code).
Showing the bar:
for (int i = 0; i <= 33; i++)
{
splitContainer1.SplitterDistance = i;
Thread.Sleep(5);
Refresh();
}
Hiding the bar:
for (int i = 33; i >= 0; i--)
{
splitContainer1.SplitterDistance = i;
Thread.Sleep(5);
Refresh();
}
Of course, if you don't mind the notification bar simply covering the top part of your form, then you can just do the whole thing very easily with a panel. :)
I was looking for the same thing just now and found this on code project
I have not used it yet, So I have no idea how solid it is.

Spreading controls to fill space as a dialog resizes

I have a dialog with column down the right side filled with buttons. The dialog is built with Windows Forms. I have a mockup at the following link:original dialog
(I would have included it but apparently i'm not allowed to use image tags)
I would like for the buttons in the right column to resize themselves to fill the remaining vertical space when the dialog resizes. It doesn't particularly matter to me whether or not buttons simply increase in size or whether the buttons remain the same size while the gaps between them increase. I'm simply want the buttons to go from the top to the bottom. (I have a mockup for this as well but apparenlty i can only include one link)
I've tried hosting the buttons in a FlowLayoutPanel but they do not increase as the dialog stretches, I only get whitespace at the bottom after I run out of buttons. I also tried a TableLayoutPanel and had the same result but I may have misused it. Does anyone have any ideas how I could accomplish this?
Thanks in advance,
Jeremy
To get you started. Use the TableLayoutPanel, set its Anchor property to top, bottom, left, and right. Set the rows and columns to percentages as needed. I suggest each control have it own cell. Note that each control in a "cell" can have its Dock and Anchor property set as needed.
You can do this with a TableLayoutPanel. Create a column for the buttons, with each button having it's own row / cell in the column. Set each row to be an even percentage for height (if there are 10 buttons, each row would be 10%), and dock the TableLayoutPanel to the right side of the screen. Then, put the buttons into their rows and set them to full docking. Then, when the dialog expands, the TableLayoutPanel will expand to fill the entire right side of the screen, each row will adjust proportionally, and each button would expand to fit the new row size.
You may have to adjust this a bit to fit your needs, especially in how it relates to the other content in the window.

Get airport display type transition when data changes

A client has asked for a display to flick over like an airport display screen, ie each row flicks over when information changes.
I am not sure which is the best control to use, or the method of getting each row to transform one after the other.
any suggestions woul b gratfully accepted
John
Here's what I would do in general concept..
Make a regular panel of, say 50px high. (This is arbitrary but this panel just holds the size in place so the control doesn't shrink with its contents.)
Create a panel inside that one that will be the 'animated' panel.
When it's time for information to animate, create a storyboard that uses a transformation to "stretch" the height down to 0, change the content to the updated information, then tranform stretch the height back to 50px. This will create the illusion that the panel is flipping over.
If you make this a user control, then you could simply add however many "rows" you needed of this control to a StackPanel to make your screen.
The best way of representing this effect easily is to randomize the text during the change.
Patrick Long implemented this effect as a custom animation here

Resources