need to find current textbox line in relationship to screen position - c#

I have created a texteditor along with a function window.
the functionwindow is a listbox that is populated with all of the functions located in the textbox.
when the user double clicks on an item in the listbox, the textbox will find the function that was clicked on. its just using a simple search to find the text. the issue is that if the text is at the bottom of the window, then you still need to scroll to display it properly. is there a way to ... If line 200 of a textbox was located at the bottom of the screen to make it show at the top??? does this make any sense to anybody

Is it the ScrollToCaret function you want?

Related

How to bring an element inside a list view item to the front of the entire app?

Using UWP XAML, I am trying to recreate this textbox UX from Postman whereby it pops up above all other elements in the app to display the full text: https://streamable.com/avrixo. I've almost fully recreated this UX, but I am having trouble bringing the textbox to the "front" of the app while the textbox is inside a listview.
What I have tried:
I have tried creating a UserControl for a custom text box with Canvas as its parent. Like this:
<Canvas>
<TextBox/>
</Canvas
I added some event handling to change the text wrapping and the Canvas.Zindex attached property of the textbox when the user focuses on it (I've tried setting the z-index to 1, 10, 100, and 1000000). However, I found that as the textbox expands vertically, it remains "behind" the listview item below it no matter what z-index I give it.
How can I bring the textbox inside a listview item to the "front" of the UI?
I don't think your problem is with z-index (per say) in this case. The problem here in the ListView is that each ListViewItem has it's own bounds, so the TextBox is being clipped by the bounding box of the item. You can double-check the bounding areas with the Visual Tree tools at least to confirm that's the issue.
If you don't want the ListViewItem to expand in size to match, I can see two options. When the user clicks to edit, you put a 'fake' TextBox (bound to the original in the ListView or the data item) either in 1) a Pop-up that you display or 2) in an overlay that's part of your page's XAML that has the textbox.
You can grab the selection state and cursor positions and such from the original textbox, and move focus to the new one and mirror that same state.
That's the approach I think I'd take.

Disable line wrapping in .NET ListView

Can anyone help with this simple question.
I have a c# ListView. It's the only control on the form. The View property is set to details. When I resize the form I programmatically resize the ListView to fill the whole form.
Problem is, when the form width gets too small to show the lines of text in the ListView it wraps each onto more lines of text - I can just see the top of the characters of the second line.
Thing is, I would rather only have one line per item and the user would have to use the mouse to horizontally scroll the "too long" items - just like in an edit box when the text is too long.
Thanks for any help,
Mitch.

how to make a prescrollable tab control so i can add in tons of text boxes without having the form not take up the entire screen

so I have a tab control in my c# program that's going to be getting a lot of information from a user. this is in the form of like 40 checkboxes/textboxes. I'm trying to figure out how in the designer to add a scroll bar ahead of time so I can have the form be a nice 800x500 but allow the user to scroll threw all the boxes and fill them up. idk if this is possible in the designer, or if I need to add them in through code with like a loop or something and then have autoscrollbar on so it works that way. Any ideas?
Open the designer. Select your tab page in the Properties window. Set AutoScroll property to True. Expand AutoScrollMinSize property and enter some value (let say 1000) for Height. Now your tab page should have a vertical scrollbar.

How to create an number line control?

I'm planning to create a number-line control similar to the image below (only one of them):
I'm creating a program where the children can detect where's the position's number. I mean, instruct them to write the number 4 (and the boy writes a vertical line).
The idea is when the cursor is on the control, it shows a vertical line. And when the user presses OK, returns with an event the X position and hold it the line.
Do you know if there's a similar control on the web?
Just use a Slider with a new template.
How to Create/Apply a Slider Template

C# Dropdown Slide Form

Is there any built-in control like a dropdown/slider? For instance, I want to display some info on dialog/control/form and inside that form there is a arrow which expands it to show more information?
alt text http://img227.imageshack.us/img227/4945/73068794.jpg
When I click the black arrow, the form should expand vertically to show more info. That's what I want to achieve. If there isn't any built-in control, can you please tell me what do I need to do to implement it myself? And how can I add a little animation when it is expanding?
Like here (when you click the menu header it doesn't expand/contract instantly rather it does little slowly, that's the kind of animation I would like to add)
This CodeProject article should help you get started.

Categories