WPF中将四个数字字符串值(比如:"10,10,300,300")转为Rect

RectConverter rectConverter = new RectConverter();
string parseString = viewportEntry.Text;
if (parseString != null && parseString != string.Empty)
{
      imageBrush.Viewport = (Rect)rectConverter.ConvertFromString(parseString);
}
else
{
      imageBrush.Viewport = Rect.Empty;
       viewportEntry.Text = "Empty";
}

 

posted @ 2013-08-21 11:27  Dino.Tang  阅读(369)  评论(0编辑  收藏  举报