private void _btnLegend_Click(object sender, EventArgs e) { LayoutLegend lsb = _layoutControl.CreateLegendElement() as LayoutLegend; List <LayoutElement> mapElements = _layoutControl.LayoutElements.FindAll(delegate(LayoutElement o) { return(o is LayoutMap); }); if (mapElements.Count > 0) { lsb.Map = mapElements[0] as LayoutMap; } lsb.LayoutControl = _layoutControl; _layoutControl.AddElementWithMouse(lsb); }
// Fires the open method on the layoutcontrol private void BtnBitmapClick(object sender, EventArgs e) { using (var ofd = new OpenFileDialog { Filter = @"Images (*.png, *.jpg, *.bmp, *.gif, *.tif)|*.png;*.jpg;*.bmp;*.gif;*.tif", FilterIndex = 1, CheckFileExists = true }) { if (ofd.ShowDialog(Parent) == DialogResult.OK) { var newBitmap = new LayoutBitmap { Size = new SizeF(100, 100), Filename = ofd.FileName }; _layoutControl.AddElementWithMouse(newBitmap); } } }
private void _btnLegend_Click(object sender, EventArgs e) { _layoutControl.AddElementWithMouse(_layoutControl.CreateLegendElement()); }