I am creating a Windows Form Application using C#
I require a checkbox to be greyed out until the user scrolls to the bottom of a text box.
How can I get the value of the textbox's scrollbar position?
I am creating a Windows Form Application using C#
I require a checkbox to be greyed out until the user scrolls to the bottom of a text box.
How can I get the value of the textbox's scrollbar position?
This should be a RichTextBox so you can use its SelectionProtected property to ensure that the user cannot change the text. It does not have a Scroll event but that can be added by overriding WndProc() and detecting the WM_VSCROLL message. Checking if the last line is visible like @TaW does is not reliable unless the WordWrap property is set to False. Easier to just check the state of the scrollbar.
Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form. Subscribe the LicenseViewed event and set the checkbox' Enabled property to true. I would be remiss if I did not point out that only lawyers ever think this is a good idea, users find these kind of text boxes universally annoying and hate them with a passion. You only have one chance to create a good first impression.
Here is a function that tells you if the last line is visible:
You will still need to detect the scrolling event itself. See here on how to detect the scrolling.