public override void ScaleRestrict(double width, BokehMode bokeh)
 {
     switch (bokeh)
     {
         case BokehMode.InsideMode:
             if (width > _minWidth)
             {
                 _bokehData.Margin = new Thickness(_bokehData.Margin.Left - (width - _bokehData.InsideWidth) / 2, _bokehData.Margin.Top - (width - _bokehData.InsideWidth) / 2, 0, 0);
                 _bokehData.Width = _bokehData.Height = _bokehData.Height + (width - _bokehData.InsideWidth);
                 _bokehData.InsideWidth = width;
             } break;
         case BokehMode.OutsideMode:
             if (width > _bokehData.InsideWidth + _minWidth)//内外圆相差minWidth
             {
                 _bokehData.Margin = new Thickness(_bokehData.Margin.Left - (width - _bokehData.Width) / 2, _bokehData.Margin.Top - (width - _bokehData.Width) / 2, 0, 0);
                 _bokehData.Width = _bokehData.Height = width;
             } break;
     }
 }
Beispiel #2
0
        public override void ScaleRestrict(double width, BokehMode bokeh)
        {
            switch (bokeh)
            {
                case BokehMode.InsideMode:
                    //中心2线相距大于minWidth
                    if (width > _minWidth)
                    {
                        _bokehData.Margin = new Thickness(_bokehData.Margin.Left - (width - _bokehData.InsideWidth) / 2, _bokehData.Margin.Top, 0, 0);
                        _bokehData.Width += width - _bokehData.InsideWidth;
                        _bokehData.InsideWidth = width;
                    }
                    break;
                case BokehMode.OutsideMode:
                    //外面2线相距
                    if (width > _bokehData.InsideWidth + _minWidth)
                    {
                        _bokehData.Margin = new Thickness(_bokehData.Margin.Left - (width - _bokehData.Width) / 2, _bokehData.Margin.Top, 0, 0);
                        _bokehData.Width = width;

                    }
                    break;
            }
            SetGradient();
        }
Beispiel #3
0
 /// <summary>
 ///  放大缩小时限制图形最大最小宽高,并调整位置
 /// </summary>
 /// <param name="width">新宽高</param>
 public virtual void ScaleRestrict(double width, BokehMode bokeh)
 {
 }