Is it possible to bind a control to another control?

Is it possible to bind a control to another control?

Let's say I want Button1 to keep a distance of 4 pixels from the Textbox1 control without
using the FlowLayoutTable control?

"Why would it be beneficial?" - may I ask

Ok, let's say you have a SplitContainer with a vertical separator, and you have Textboxes
in SplitContainer.Panel1 , which are anchored left and right, but have a maximum size
width is less than allowed for the width of SplitContainer.Panel1 (may be
because you want the text to appear there, or because extra indentation or something else, you name it)

Let's say you also have a button next to Textbox1 , and you don't want Textbox1 be
Button1 overlaps because it extends far.

If I want my textbox populate SplitContainer.Panel1 so that there is room for
Button1 control, although both are tied to the right, how would I do it?

+7
source share
2 answers

I use TableLayoutPanels and FlowLayoutPanels extensively for this. For you, a special circumstance I would use a TableLayoutPanel with three columns and a row for each TextBox.

Column 1: Auto-width, contains shortcuts all with AutoSize = True .
Column 2: 100% width, contains TextBoxes all with Anchor = Left, Right .
Column 3: Auto-width, contains a button in the corresponding row.

Then I set all the text fields except the button next to ColumnSpan = 2 . Then just put the TableLayoutPanel in the SplitPanel and set Dock = Fill .

+7
source

it will be a sequence in live that should flow to the left and continue to work so that the right side is the layout.

  • List item must be provided.
  • List item: all things that are used in this method should be provided and checked;
0
source

Source: https://habr.com/ru/post/896085/


All Articles