public CanvasTextBox( CanvasControl host, string text, Font font, Color fontColor, float height, float width, float paddingH = 1f, float paddingV = 1f, float textAdjustV = 0f ) : base(host) { Text = text; Font = font; PaddingH = paddingH; PaddingV = paddingV; TextAdjustV = textAdjustV; FontColor = fontColor; Size = new SizeF(width + 2 * paddingH, height + 2 * paddingV); }
public TagLabel( CanvasControl host, string text, Font font, float height, float maxTextWidth, float paddingH = 2f, float paddingV = 1f, float textAdjustV = 0f ) : base(host) { Text = text; Font = font; PaddingH = paddingH; PaddingV = paddingV; TextAdjustV = textAdjustV; var textSize = TextRenderer.MeasureText(text, font); TextWidth = Math.Min(maxTextWidth, textSize.Width); var totalWidth = height / 2 + TextWidth + 2 * paddingH + Inset / 2; Size = new SizeF(totalWidth, height + 2 * paddingV); }
public static FlowLayoutCanvasControlHost LabelHost(TH_Task task, CanvasControl host) { var labels = new List <CanvasControl>(); //nulls are used as each label's initial, as this is later added during the Host object construction if (task.Owner != "") { labels.Add(PersonLabel(task.Owner, null)); } labels.Add(StatusLabel(task.Status, null)); if (task.HasDate) { labels.Add(DatePart(task.Date, task.IsLate, null)); } if (task.Link != "") { labels.Add(FolderButton(task.Link, null)); } foreach (var tag in task.Tags) { labels.Add(Tag(tag, null)); } return(new FlowLayoutCanvasControlHost( host.TopLevelAttributes, labels, InnerWidth, LabelsPadH, LabelsPadV, new Separator(null, SeparatorThk, LabelHeight, Color.LightGray))); }
public void AddControl(CanvasControl control) { AddControl(control, default); Layout(); }
public Separator(CanvasControl host, float thickness, float height, Color color) : base(host) { Thk = thickness; Height = height; Color = color; }
protected CanvasButton(CanvasControl host, Action onClick) : base(host) { OnClick = onClick; OnDoubleClick = onClick; }
public static CanvasTextBox TaskName(string taskName, CanvasControl host) => new CanvasTextBox(host, taskName, TitleFont, Color.Black, TitleHeight, InnerWidth);
public static IconButton FolderButton(string link, CanvasControl host) => new IconButton(host, Resources.IconFolder, LinkOpening.GetLinkOpener(link), LabelHeight);
public static CardLabel PersonLabel(string personName, CanvasControl host) => new CardLabel(host, Resources.IconOwner, personName, LabelFont, Color.Black, LabelHeight, LabelMaxTextWidth);
public static CardLabel StatusLabel(TaskStatus status, CanvasControl host) => new CardLabel(host, status.GetIcon(), status.AsString(), LabelFont, status.GetColor(), LabelHeight, LabelMaxTextWidth);
public static TagLabel Tag(string text, CanvasControl host) => new TagLabel(host, text, LabelFont, LabelHeight, LabelMaxTextWidth);
public StatusBar(TaskStatus statusIn, TaskStatus taskStatus, float width, float height, float barHeight, CanvasControl host) : base(host) { var statusOut = (TaskStatus)Math.Min((int)statusIn, (int)taskStatus); ColorIn = TaskStatusColors.GetColor(statusIn); ColorOut = TaskStatusColors.GetColor(statusOut); Size = new SizeF(width, height); BarHeight = barHeight; }