private void btnTextTemplateEdit_Click(object sender, EventArgs e) { TemplateForm frm = new TemplateForm(); int selectedTextTemplate = (int)lvTextTemplates.SelectedItems[0].Tag; TextTemplate template = _textTemplateRepository.Get(selectedTextTemplate); template.Font = fontList.Find(f => f.Id == template.FontId); frm.Template = template; frm.Fonts = fontList; if (frm.ShowDialog(this) == DialogResult.OK) { template.Font = null; _textTemplateRepository.Save(); imageList.Images[lvTextTemplates.SelectedItems[0].ImageIndex] = Utils.ByteArrayToImage(template.Image); lvTextTemplates.SelectedItems[0].Selected = true; } else { template.Font = null; _textTemplateRepository.SetStateUnchanged(template); } lvTextTemplates.Select(); frm.Dispose(); }
private void tsbtnTemplateEdit_Click(object sender, EventArgs e) { TemplateForm frm = new TemplateForm(); int selectedClipartTemplate = (int)lvCliparts.SelectedItems[0].Tag; ClipartTemplate template = _clipartTemplateRepository.Get(selectedClipartTemplate); template.Font = fontList.Find(f => f.Id == template.FontId); frm.Template = template; frm.Fonts = fontList; if (frm.ShowDialog(this) == DialogResult.OK) { template.Font = null; _clipartTemplateRepository.Save(); imageList.Images[lvCliparts.SelectedItems[0].ImageIndex] = Utils.ByteArrayToImage(template.Image); lvCliparts.SelectedItems[0].Selected = true; } else { template.Font = null; _clipartTemplateRepository.SetStateUnchanged(template); } lvCliparts.Select(); frm.Dispose(); }
private void tsbtnClipartTemplateAdd_Click(object sender, EventArgs e) { TemplateForm frm = new TemplateForm(); ClipartTemplate template = new ClipartTemplate() { EffectType = 1, Name = "A", Text = "A", TextColor1 = Color.Red.ToArgb(), TextColor2 = Color.Tomato.ToArgb(), TextGradientEnable = true, OutlineColor1 = Color.Blue.ToArgb(), OutlineThickness1 = 1, OutlineColor2 = Color.Yellow.ToArgb(), OutlineThickness2 = 1, ShadowEnable = true, ShadowColor = Color.Black.ToArgb(), ShadowThickness = 1, ShadowOffsetX = 2, ShadowOffsetY = 2, FontId = fontList[0].Id, Font = fontList[0], //ToDo ClipartGalleryId = selectedClipartGalleryId }; frm.Template = template; frm.Fonts = fontList; if (frm.ShowDialog(this) == DialogResult.OK) { template.Font = null; _clipartTemplateRepository.Add(template); _clipartTemplateRepository.Save(); imageList.Images.Add(Utils.ByteArrayToImage(template.Image)); ListViewItem item = new ListViewItem(); item.ImageIndex = imageList.Images.Count - 1; item.Text = template.Name; item.Tag = template.Id; lvCliparts.Items.Add(item); item.Selected = true; } lvCliparts.Select(); frm.Dispose(); }
private void tsbtnTextTemplateAdd_Click(object sender, EventArgs e) { TemplateForm frm = new TemplateForm(); TextTemplate template = new TextTemplate() { EffectType = 1, Name = "New template", Text = "New template", TextColor1 = Color.Red.ToArgb(), TextColor2 = Color.Tomato.ToArgb(), TextGradientEnable = true, OutlineColor1 = Color.Blue.ToArgb(), OutlineThickness1 = 1, OutlineColor2 = Color.Yellow.ToArgb(), OutlineThickness2 = 1, ShadowEnable = true, ShadowColor = Color.Black.ToArgb(), ShadowThickness = 1, ShadowOffsetX = 2, ShadowOffsetY = 2, FontId = fontList[0].Id, Font = fontList[0], //ToDo TextGalleryId = selectedTextGalleryId }; frm.Template = template; frm.Fonts = fontList; if (frm.ShowDialog(this) == DialogResult.OK) { template.Font = null; _textTemplateRepository.Add(template); _textTemplateRepository.Save(); imageList.Images.Add(Utils.ByteArrayToImage(template.Image)); ListViewItem item = new ListViewItem(); item.ImageIndex = imageList.Images.Count - 1; item.Text = template.Name; item.Tag = template.Id; lvTextTemplates.Items.Add(item); item.Selected = true; } lvTextTemplates.Select(); frm.Dispose(); }