public void Check() {
if (ImageWidth < MinWidth) ImageWidth = MinWidth;
if (ImageHeight < MinHeight) ImageHeight = MinHeight;
if (ImageWidth > MaxWidth) ImageWidth = MaxWidth;
if (ImageHeight > MaxHeight) ImageHeight = MaxHeight;
if (OffsetX < 0) OffsetX = 0;
if (OffsetY < 0) OffsetY = 0;
if (OffsetX + ImageWidth > TotalWidth) OffsetX = TotalWidth - ImageWidth;
if (OffsetY + ImageHeight > TotalHeight) OffsetY = TotalHeight - ImageHeight;
}