private void btnAdd_Click(object sender, EventArgs e) { using (var dlg = new LogoDialog(_conn)) { if (dlg.ShowDialog() == DialogResult.OK) { var pos = _layout.CreateLogoPosition(dlg.PositionLeft, dlg.PositionBottom, dlg.PositionUnits); var size = _layout.CreateLogoSize(dlg.SizeWidth, dlg.SizeHeight, dlg.SizeUnits); var logo = _layout.CreateLogo(dlg.SymbolLibraryID, dlg.SymbolName, size, pos); logo.Rotation = dlg.Rotation; _logos.Add(logo); } } }
private void btnEdit_Click(object sender, EventArgs e) { if (lstCustomLogos.SelectedItems.Count > 0) { var item = lstCustomLogos.SelectedItems[0]; var logo = item.Tag as ILogo; if (logo != null) { using (var dlg = new LogoDialog(_conn)) { dlg.SymbolLibraryID = logo.ResourceId; dlg.SymbolName = logo.Name; dlg.PositionBottom = logo.Position.Bottom; dlg.PositionLeft = logo.Position.Left; dlg.PositionUnits = logo.Position.Units; dlg.SizeHeight = logo.Size.Height; dlg.SizeUnits = logo.Size.Units; dlg.SizeWidth = logo.Size.Width; dlg.Rotation = logo.Rotation.HasValue ? logo.Rotation.Value : 0.0f; if (dlg.ShowDialog() == DialogResult.OK) { logo.ResourceId = dlg.SymbolLibraryID; logo.Name = dlg.SymbolName; logo.Position.Bottom = dlg.PositionBottom; logo.Position.Left = dlg.PositionLeft; logo.Position.Units = dlg.PositionUnits; logo.Size.Height = dlg.SizeHeight; logo.Size.Units = dlg.SizeUnits; logo.Size.Width = dlg.SizeWidth; logo.Rotation = dlg.Rotation; item.Text = logo.Name; OnResourceChanged(); } } } } }