0

Is there any control for Winforms that allows both text wrap and smooth scrolling by default?

I´ve tried DataGridView but it seems that it doesn´t allow smooth scroll. Another was ListView but I couldn´t run scrolling per pixel despite the fact it should work after setting ShowGroups to true. And I´ve read that ListView doesn´t support text wrap.

Update: I am looking for grid-like control, meaning that I need to use it like a table.

PhilOs
  • 1
  • 1
  • What do you mean when you say smooth scrolling? smooth animation? or just show the last content? – Peyman Majidi Sep 23 '20 at 09:17
  • @PeymanMajidi I mean scrolling per pixel / scroll within one cell. In DGV it scrolls the whole cell and when one cell contains more rows wrapped, it skips content to another cell, so last rows are not visible. – PhilOs Sep 23 '20 at 09:22
  • Use a RichTextBox ! – TaW Sep 23 '20 at 09:29
  • There is [only one](https://stackoverflow.com/a/34358642/17034) control in the toolbox that can do this. If this is important to you then you need to uplift to the kind of GUI framework that takes advantage of GPU acceleration, WPF and UWP. https://stackoverflow.com/questions/20731402/animated-smooth-scrolling-on-scrollviewer – Hans Passant Sep 23 '20 at 10:48
  • Scrolling by lines would be enough, but it seems that there is no grid in Winforms that would support that and also wrap text, am I correct? Btw thanks y´all for comments. – PhilOs Sep 23 '20 at 11:03

1 Answers1

0

You can use a floating panel, and add new items to it then got focus to scroll down to that item. You can make your own user control as a new item, but in the example below I use a simple textbox. enter image description here

    private void btn_add_clicked(object sender, EventArgs e)
    {
        var textbox = new TextBox
        {
             Text = txtItem.Text,
             Width = flowLayoutPanel1.Width

        };
        flowLayoutPanel1.Controls.Add(textbox);
        textbox.Focus(); // set focus to it to make sure scroll down
    }

Just make sure flowLayoutPanel1.AutoScroll is true

flowLayoutPanel1.AutoScroll = true;

As I said before, you can make your own user control instead of a textbox.

How to Create User control in Windows Form Application

Peyman Majidi
  • 1,777
  • 2
  • 18
  • 31