I'm trying to get text to wrap around an image, the closest I've gotten so far is to place both the image in a FlowLayoutPanel and use this code to create labels to fit allow my text to fit:
private void Rules_Load(object sender, EventArgs e)
{
string RuleText = "some long string";
string[] RuleWords = RuleText.Split(' ');
Label[] RulesLabelArray = new Label[RuleWords.GetLength(0)];
for (int i = 0; i < RuleWords.GetLength(0); i++)
{
RulesLabelArray[i] = new Label();
flpRules.Controls.Add(RulesLabelArray[i]);
RulesLabelArray[i].Text = RuleWords[i];
RulesLabelArray[i].AutoSize = true;
}
}
however this technique creates them such that there are large spaces between words and only the first line next to the image has text on but not the next so it looks like this:
XXX ~ ~ ~ ~ ~ ~ ~
XXX
XXX
~ ~ ~ ~ ~ ~ ~
Where X represents the image and ~ represents text.
Why is this not working as expected and is there any other solution to this problem?
EDIT: as Sinatr said in comments, the outcome I want for this is for the text to be on the right of the image and continue below it if there is too much text so that it would appear like this (using same key as above):
XXX ~~~~~~~~~
XXX ~~~~~~~~~
XXX ~~~~~~~~~
~~~~~~~~~~~~~
~~~~~~~~~~~~~