1212using Group = EZCode . Groups . Group ;
1313using Player = Sound . Player ;
1414using Types = EZCode . Variables . Ivar . Types ;
15- using System . Security . Cryptography ;
1615
1716namespace EZCode
1817{
@@ -2738,7 +2737,7 @@ async Task<Group> DoGroup(string[] parts, int _index, string keyword, bool globa
27382737 {
27392738 varray . Add ( getControl ( values_ . Trim ( ) ) ) ;
27402739 }
2741- else if ( values_ . StartsWith ( ":" ) )
2740+ else if ( values_ . StartsWith ( ":" ) )
27422741 {
27432742 string [ ] allv = values_ . Remove ( 0 , 1 ) . Split ( "," ) . Select ( x => x . Trim ( ) ) . ToArray ( ) ;
27442743 for ( int i = 0 ; i < allv . Length ; i ++ )
@@ -3604,6 +3603,20 @@ string ColonResponse(string value, string[] parts = null)
36043603 Control control = getControl ( ind [ 0 ] ) ;
36053604 switch ( ind [ 1 ] . ToLower ( ) )
36063605 {
3606+ case "align" :
3607+ if ( control is GLabel _glb1 )
3608+ {
3609+ value = _glb1 . TextAlign . ToString ( ) ;
3610+ }
3611+ else if ( control is GButton _gbt1 )
3612+ {
3613+ value = _gbt1 . TextAlign . ToString ( ) ;
3614+ }
3615+ else
3616+ {
3617+ ErrorText ( parts , ErrorTypes . custom , custom : $ "Only Labels or Buttons have '{ ind [ 1 ] } ' property") ;
3618+ }
3619+ break ;
36073620 case "id" :
36083621 value = control . AccessibleName ;
36093622 break ;
@@ -4023,6 +4036,21 @@ string ColonResponse(string value, string[] parts = null)
40234036 name = n ;
40244037 }
40254038 }
4039+ if ( name . Contains ( "'" ) )
4040+ {
4041+ string [ ] varray = name . Split ( "'" ) ;
4042+ for ( int j = 0 ; j < varray . Length ; j ++ )
4043+ {
4044+ if ( j % 2 == 1 )
4045+ {
4046+ for ( int k = 0 ; k < vars . Count ; k ++ )
4047+ {
4048+ if ( varray [ j ] == vars [ k ] . Name ) varray [ j ] = vars [ k ] . Value ;
4049+ }
4050+ }
4051+ }
4052+ name = string . Join ( "" , varray ) ;
4053+ }
40264054
40274055 switch ( controltype )
40284056 {
@@ -4257,6 +4285,10 @@ async Task<Control> Change(Control _control, string[] _parts, int index, bool te
42574285 ScrollBars scrollbars = control is GTextBox tb4 ? tb4 . ScrollBars : ScrollBars . None ;
42584286 Font font = control . Font ;
42594287 PointF [ ] _points = control is GShape gsa3 ? gsa3 . Points : Array . Empty < PointF > ( ) ;
4288+ ContentAlignment align =
4289+ align = control is GLabel lb1 ? lb1 . TextAlign :
4290+ align = control is GButton bt1 ? bt1 . TextAlign :
4291+ ContentAlignment . TopLeft ;
42604292
42614293 foreach ( string p in parts )
42624294 {
@@ -4265,6 +4297,28 @@ async Task<Control> Change(Control _control, string[] _parts, int index, bool te
42654297 string [ ] after = getString_value ( values , int . Parse ( before [ 1 ] ) , true ) ;
42664298 switch ( before [ 0 ] . Trim ( ) . ToLower ( ) )
42674299 {
4300+ case "align" :
4301+ if ( control is GButton or GLabel )
4302+ {
4303+ switch ( after [ 0 ] )
4304+ {
4305+ case "topleft" : align = ContentAlignment . TopLeft ; break ;
4306+ case "topright" : align = ContentAlignment . TopCenter ; break ;
4307+ case "topcenter" : align = ContentAlignment . TopRight ; break ;
4308+ case "middleleft" : align = ContentAlignment . MiddleLeft ; break ;
4309+ case "middlecenter" : align = ContentAlignment . MiddleCenter ; break ;
4310+ case "middleright" : align = ContentAlignment . MiddleRight ; break ;
4311+ case "bottomleft" : align = ContentAlignment . BottomLeft ; break ;
4312+ case "bottomcenter" : align = ContentAlignment . BottomCenter ; break ;
4313+ case "bottomright" : align = ContentAlignment . BottomRight ; break ;
4314+ default : ErrorText ( parts , ErrorTypes . custom , custom : $ "Expected 'topleft', 'topright', 'topcenter', 'middleleft', 'middlecenter', 'middleright', 'bottomleft', 'bottomcenter', or 'bottomright' for '{ control . Name } '") ; break ;
4315+ }
4316+ }
4317+ else
4318+ {
4319+ ErrorText ( parts , ErrorTypes . custom , custom : $ "Expected 'label' or 'button' for '{ control . Name } '") ;
4320+ }
4321+ break ;
42684322 case "id" :
42694323 {
42704324 if ( ! AllControls . Any ( x => x . AccessibleName == after [ 0 ] ) )
@@ -4605,6 +4659,14 @@ async Task<Control> Change(Control _control, string[] _parts, int index, bool te
46054659 a2 . AcceptsTab = ! wordwrap ;
46064660 a2 . AllowDrop = ! wordwrap ;
46074661 }
4662+ if ( control is GLabel a3 )
4663+ {
4664+ a3 . TextAlign = align ;
4665+ }
4666+ if ( control is GButton a4 )
4667+ {
4668+ a4 . TextAlign = align ;
4669+ }
46084670 if ( instance & control . Name == "" )
46094671 {
46104672 ErrorText ( parts , ErrorTypes . custom , custom : $ "Control instance created has no name. Please add the name property, `name:`, to the control") ;
0 commit comments