i did research about this, but nothing worked.
I created folder in my project in Visual Studio 2019 => Images
and i placed a file footer.png
here.
In Visual Studio => Right click on folder Images
, added new item Resources
and add this line => Name
-> FooterBG
and Value
-> Images/footer.png
in code:
string pathToFooter = Resource.FooterBG;
in debug get return Images\footer.png
When i want to add this to string with html tags, dont work:
String htmlTags = "<table background='"+ pathToFooter + "'><tbody><tr><td></td></tr></tbody></table>";
Please any tips what im doing wrong ?
Based on my test, the pathToFooter is not the actual path of the image.
Here is a code example you can refer to:
private void button1_Click(object sender, EventArgs e)
{
string pathToFooter = Resource1.FooterBG;
string path = AppDomain.CurrentDomain.BaseDirectory + Path.Combine(@"../..", pathToFooter);
String htmlTags = "<table background='" + path + "' width='1000' height='800' align='center'><tbody><tr><td></td></tr></tbody></table>";
webBrowser1.DocumentText = htmlTags;
}
Result: