So i am creating a BOT that responds according the user's question while doing it,i am creating two labels one which print user's question on the right and print respond of BOT at left side, while doing it i want scroll as the panel go overflow but unfortunately or maybe lack of my approach i cant do it while docking label at the bottom here is the code of my labels (i am new to c# kindly ignore childish stuff)
LEFT SIDE (BOT):
Label label = new Label();
label.Size = new Size(35, 20);
label.Font = new Font("Microsoft Sans Serif", 8F);
label.Text = "IceFrog : I am unable to understand you try expressing in other way";
label.RightToLeft = RightToLeft.No;
splitContainer1.Panel1.RightToLeft = RightToLeft.No;
//label.BorderStyle = BorderStyle.Fixed3D;
// label.BackColor = Color.LightBlue;
label.Dock = DockStyle.Bottom;
splitContainer1.Panel1.Controls.Add(label);
RIGHT SIDE (human):
Label label = new Label();
label.Size = new Size(35, 20);
label.Font = new Font("Microsoft Sans Serif", 8F);
label.Text = "Human : "+textBox1.Text;
label.RightToLeft = RightToLeft.No;
splitContainer1.Panel2.RightToLeft = RightToLeft.No;
label.TextAlign = ContentAlignment.BottomRight;
//label.BorderStyle = BorderStyle.Fixed3D;
// label.BackColor = Color.LightBlue;
label.Dock = DockStyle.Bottom;
splitContainer1.Panel2.Controls.Add(label);
Change the AutoScrollMinSize
for each pannel
this.splitContainer1.Panel1.AutoScrollMinSize = new Size(1, 0);
this.splitContainer1.Panel2.AutoScrollMinSize = new Size(1, 0);
Alternatively, you can do the same using the designer
To keep newly added items visible (at the bottom) add those lines to your codes
splitContainer1.Panel1.VerticalScroll.Value = splitContainer1.Panel1.VerticalScroll.Maximum;
splitContainer1.Panel2.VerticalScroll.Value = splitContainer1.Panel2.VerticalScroll.Maximum;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.