public override Size GetMinimumSize() { // these values are arbitrary, but chosen to match the 4:3 ratio that // likely to be common of many images. Hopefully the specification // designer will have elected to give us more information. int w = 140, h = 105; BinarySpace space = (BinarySpace)_imageState.Type.ValueSpace; try { if (space[MINIMUM_WIDTH] != null) { w = Int32.Parse((string)space[MINIMUM_WIDTH]); } else if (space[FIXED_WIDTH] != null) { w = Int32.Parse((string)space[FIXED_WIDTH]); } if (space[MINIMUM_HEIGHT] != null) { h = Int32.Parse((string)space[MINIMUM_HEIGHT]); } else if (space[FIXED_HEIGHT] != null) { h = Int32.Parse((string)space[FIXED_HEIGHT]); } } catch (Exception) { } return(new Size(w, h)); }
public override PreferredSize GetPreferredSize() { int w = PreferredSize.INFINITE, h = PreferredSize.INFINITE; BinarySpace space = (BinarySpace)_imageState.Type.ValueSpace; try { if (space[FIXED_WIDTH] != null) { w = Int32.Parse((string)space[FIXED_WIDTH]); } if (space[FIXED_HEIGHT] != null) { h = Int32.Parse((string)space[FIXED_HEIGHT]); } } catch (Exception) { } return(new PreferredSize(w, h)); }