Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a marquee application (a marquee is a box with scrolling text) that allows the user to enter a sentence and click the Marquee
Create a marquee application (a marquee is a box with scrolling text) that allows the user to enter a sentence and click the Marquee button (as shown). The entered text will then scroll through the larger text box at the bottom at a periodic scroll rate of 600ms. The application should adhere to the following requirements: The box at the bottom is a disabled text box with a font-size of 72pt. The Marquee Text label should be a shortcut for the text box. The Marquee button should be the form's AcceptButton (see the form's AcceptButton property). The Marquee button should initially be disabled. The Marquee button should only be enabled when the text box contains text. The form should create a BlockingCollection as a class field. When the user clicks the Marquee button, the text in the text box should be added to the BlockingCollection , the text box should be cleared, and the focus should be put back in the text box. When the application starts, a thread (described below) should be created and started. Use a foreground thread. A Cancellation Token will be used to stop the thread. When the application is closed (i.e., the form's FormClosed event), the program should indicate that adding to the BlockingCollection is complete and should signal cancel to the thread (using the cancellation token source). The thread should behave as follows: Ensure that when the cancellation token signals cancel, the thread is interrupted. Then, as long as the BlockingCollection is not complete (adding not complete or not empty), the thread should: . Get a string from the BlockingCollection (blocking if necessary). Pass the cancellation token to the collection's Take method. Set the string as the text in the display text box at the bottom adding enough spaces in the front to ensure that the text is pushed just out of the view in the text box (you'll have to discover how many spaces you need through trial and error). Then, every 600ms, the thread should remove the first character from the display text box until the text box is empty. Make sure that all reading and writing of control properties is done in a thread-safe manner. Be sure to catch the appropriate exceptions when the thread is interrupted or if the blocking collection's Take operation is aborted. These exceptions signal that the thread should exit (end).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
1 Create a new Windows Forms Application in Visual Studio 2 Design the form with the following controls TextBox for user input Label for Marquee Text ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started