Adding Components from Code
Our sample projects and report templates can help you learn the basics of working with our products.This example is outdated, you can check out the many other new examples in this category.This example shows how to add components from code.
private void AddLogoAndCompanyName(StiForm form)
{
var image = new StiImageElement()
{
Geometry = new Stimulsoft.Form.Properties.StiRectangleGeometry(0, 0, 200, 100),
Image = System.IO.File.ReadAllBytes(@"Data\Logo.png")
};
var companyName = new StiLabelElement()
{
Geometry = new Stimulsoft.Form.Properties.StiRectangleGeometry(0, 20, 400, 70),
};
companyName.Text.Expression = "Company Name";
companyName.Text.Font = new System.Drawing.Font("Arial", 22);
companyName.Text.HorizontalAlignment = Stimulsoft.Form.StiHorizontalAlignment.Left;
form.Pages[0].Elements.Add(image);
form.Pages[0].Elements.Add(companyName);
}