Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/SharpVectorRenderingWpf/Texts/WpfTextStringFormat.cs @ 13237

Last change on this file since 13237 was 12762, checked in by aballeit, 9 years ago

#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)

File size: 1.3 KB
Line 
1using System;
2using System.Linq;
3using System.Text;
4using System.Collections.Generic;
5
6using System.Windows;
7using System.Windows.Media;
8
9namespace SharpVectors.Renderers.Texts
10{
11    public struct WpfTextStringFormat
12    {
13        public FlowDirection Direction;
14        public TextTrimming Trimming;
15        //public TextAlignment Alignment;
16        public WpfTextAnchor Anchor;
17
18        public WpfTextStringFormat(FlowDirection direction, TextTrimming trimming,
19            WpfTextAnchor anchor)
20        {
21            this.Direction = direction;
22            this.Trimming = trimming;
23            this.Anchor = anchor;
24        }
25
26        public TextAlignment Alignment
27        {
28            get
29            {
30                if (Anchor == WpfTextAnchor.Middle)
31                {
32                    return TextAlignment.Center;
33                }
34                if (Anchor == WpfTextAnchor.End)
35                {
36                    return TextAlignment.Right;
37                }
38
39                return TextAlignment.Left;
40            }
41        }
42
43        public static WpfTextStringFormat Default
44        {
45            get
46            {
47                return new WpfTextStringFormat(FlowDirection.LeftToRight,
48                    TextTrimming.None, WpfTextAnchor.Start);
49            }
50        }
51    }
52}
Note: See TracBrowser for help on using the repository browser.