public Rect GetCtrlLastRectWithOutScrollBar(EditorControl c) { Rect lastRectWithoutScrollBar = new Rect(); if ( (null == c) ) { return(lastRectWithoutScrollBar); } SCROLLBAR_DISP_STATUS scrollStatus = CheckScrollBarDispStatus(c.LastRect, c.LastContentRect); lastRectWithoutScrollBar = c.LastRect; switch (scrollStatus) { case SCROLLBAR_DISP_STATUS.SHOW_HORIZONTAL_SCROLLBAR: if (lastRectWithoutScrollBar.height > scrollBarWidth) { lastRectWithoutScrollBar.height -= scrollBarWidth; } break; case SCROLLBAR_DISP_STATUS.SHOW_VERTICAL_SCROLLBAR: if (lastRectWithoutScrollBar.width > scrollBarWidth) { lastRectWithoutScrollBar.width -= scrollBarWidth; } break; case SCROLLBAR_DISP_STATUS.SHOW_BOTH_SCROLLBAR: if (lastRectWithoutScrollBar.height > scrollBarWidth) { lastRectWithoutScrollBar.height -= scrollBarWidth; } if (lastRectWithoutScrollBar.width > scrollBarWidth) { lastRectWithoutScrollBar.width -= scrollBarWidth; } break; default: break; } return(lastRectWithoutScrollBar); }
public SCROLLBAR_DISP_STATUS CheckScrollBarDispStatus(Rect ctrlLastRect, Rect contentLastRect) { SCROLLBAR_DISP_STATUS dispStatus = SCROLLBAR_DISP_STATUS.SHOW_NONE_SCROLLBAR; if ( (ctrlLastRect.width < contentLastRect.width) && (ctrlLastRect.height < contentLastRect.height) ) { dispStatus = SCROLLBAR_DISP_STATUS.SHOW_BOTH_SCROLLBAR; } else if (ctrlLastRect.width < contentLastRect.width) { dispStatus = SCROLLBAR_DISP_STATUS.SHOW_HORIZONTAL_SCROLLBAR; } else if (ctrlLastRect.height < contentLastRect.height) { dispStatus = SCROLLBAR_DISP_STATUS.SHOW_VERTICAL_SCROLLBAR; } return(dispStatus); }