private void setSubtitleProp(Subtitle sub) { if (CanvasMain.Kernel.SelectedShapesCount == 1) { RectShape rect = getSelectedRect(); if (sub.transparent) { rect.setTextProperty(TextProperty.BackColor, Color.Transparent); } else { rect.setTextProperty(TextProperty.BackColor, ColorEx.FromHtml(sub.backcolor)); } rect.setTextProperty(TextProperty.FontName, sub.fontname); rect.setTextProperty(TextProperty.FontSize, sub.fontsize); rect.setTextProperty(TextProperty.Bold, sub.bold); rect.setTextProperty(TextProperty.Italic, sub.italic); rect.setTextProperty(TextProperty.Underline, sub.underline); rect.setTextProperty(TextProperty.Direction, sub.direction); rect.setTextProperty(TextProperty.Speed, sub.speed); rect.setTextProperty(TextProperty.Text, sub.text); rect.setTextProperty(TextProperty.FontColor, ColorEx.FromHtml(sub.fontcolor)); } }
private static Color GetColor(string key) { var str = GetConfigKey(nameof(Window), nameof(Colors), key); var html = Ini.Read(Section, str); var color = ColorEx.FromHtml(html, GetDefColor(key), byte.MaxValue); return(color); }
// 从构造函数移动到这里, 优化性能 public void CreateEnd() { if (IsInCreating) { return; } switch (ItemType) { case AdItemType.Video: break; case AdItemType.Picture: break; case AdItemType.Subtitle: Subtitle sub = Prop as Subtitle; Mlabel = new MarqueeLabel(parent); Mlabel.Name = "subtitle_"; Mlabel.AutoSize = false; Mlabel.Width = (int)Path.GetBounds().Width; Mlabel.Height = (int)Path.GetBounds().Height; Mlabel.Location = new Point((int)(Path.GetBounds().Location.X), (int)(Path.GetBounds().Location.Y)); //Mlabel.MaximumSize = new Size(1900, 0); setTextProperty(TextProperty.FontName, sub.fontname); setTextProperty(TextProperty.FontSize, sub.fontsize); setTextProperty(TextProperty.Bold, sub.bold); setTextProperty(TextProperty.Italic, sub.italic); setTextProperty(TextProperty.Underline, sub.underline); setTextProperty(TextProperty.Direction, sub.direction); setTextProperty(TextProperty.Speed, sub.speed); setTextProperty(TextProperty.Text, sub.text); setTextProperty(TextProperty.FontColor, ColorEx.FromHtml(sub.fontcolor)); setTextProperty(TextProperty.BackColor, ColorEx.FromHtml(sub.backcolor)); parent.Controls.Add(Mlabel); // todo , remove func break; case AdItemType.Select: break; default: break; } }