55
66namespace osf
77{
8- [ ContextClass ( "КлСтилиПривязки" , "ClAnchorStyles" ) ]
8+ [ ContextClass ( "КлСтилиПривязки" , "ClAnchorStyles" ) ]
99 public class ClAnchorStyles : AutoContext < ClAnchorStyles > , ICollectionContext , IEnumerable < IValue >
1010 {
1111 private int m_none = ( int ) System . Windows . Forms . AnchorStyles . None ; // 0 Элемент управления не привязан к краям контейнера.
@@ -39,6 +39,48 @@ IEnumerator<IValue> IEnumerable<IValue>.GetEnumerator()
3939 }
4040 }
4141
42+ [ ContextProperty ( "Количество" , "Count" ) ]
43+ public int CountProp
44+ {
45+ get { return _list . Count ; }
46+ }
47+
48+ [ ContextMethod ( "Получить" , "Get" ) ]
49+ public IValue Get ( int index )
50+ {
51+ return _list [ index ] ;
52+ }
53+
54+ [ ContextMethod ( "Имя" ) ]
55+ public string NameRu ( decimal p1 )
56+ {
57+ return namesRu . TryGetValue ( p1 , out string name ) ? name : p1 . ToString ( ) ;
58+ }
59+
60+ [ ContextMethod ( "Name" ) ]
61+ public string NameEn ( decimal p1 )
62+ {
63+ return namesEn . TryGetValue ( p1 , out string name ) ? name : p1 . ToString ( ) ;
64+ }
65+
66+ private static readonly Dictionary < decimal , string > namesRu = new Dictionary < decimal , string >
67+ {
68+ { 1 , "Верх" } ,
69+ { 4 , "Лево" } ,
70+ { 2 , "Низ" } ,
71+ { 0 , "Отсутствие" } ,
72+ { 8 , "Право" } ,
73+ } ;
74+
75+ private static readonly Dictionary < decimal , string > namesEn = new Dictionary < decimal , string >
76+ {
77+ { 1 , "Top" } ,
78+ { 4 , "Left" } ,
79+ { 2 , "Bottom" } ,
80+ { 0 , "None" } ,
81+ { 8 , "Right" } ,
82+ } ;
83+
4284 public ClAnchorStyles ( )
4385 {
4486 _list = new List < IValue > ( ) ;
@@ -52,31 +94,31 @@ public ClAnchorStyles()
5294 [ ContextProperty ( "Верх" , "Top" ) ]
5395 public int Top
5496 {
55- get { return m_top ; }
97+ get { return m_top ; }
5698 }
5799
58100 [ ContextProperty ( "Лево" , "Left" ) ]
59101 public int Left
60102 {
61- get { return m_left ; }
103+ get { return m_left ; }
62104 }
63105
64106 [ ContextProperty ( "Низ" , "Bottom" ) ]
65107 public int Bottom
66108 {
67- get { return m_bottom ; }
109+ get { return m_bottom ; }
68110 }
69111
70112 [ ContextProperty ( "Отсутствие" , "None" ) ]
71113 public int None
72114 {
73- get { return m_none ; }
115+ get { return m_none ; }
74116 }
75117
76118 [ ContextProperty ( "Право" , "Right" ) ]
77119 public int Right
78120 {
79- get { return m_right ; }
121+ get { return m_right ; }
80122 }
81123 }
82124}
0 commit comments