def FromControl(self, control: '<STR_LIT>', x: int = <NUM_LIT:0>, y: int = <NUM_LIT:0>, width: int = <NUM_LIT:0>, height: int = <NUM_LIT:0>) -> bool:
rect = control.BoundingRectangle<EOL>while rect.width() == <NUM_LIT:0> or rect.height() == <NUM_LIT:0>:<EOL><INDENT>control = control.GetParentControl()<EOL>if not control:<EOL><INDENT>return False<EOL><DEDENT>rect = control.BoundingRectangle<EOL><DEDENT>if width <= <NUM_LIT:0>:<EOL><INDENT>width = rect.width() + width<EOL><DEDENT>if height <= <NUM_LIT:0>:<EOL><INDENT>height = rect.height() + height<EOL><DEDENT>handle = control.NativeWindowHandle<EOL>if handle:<EOL><INDENT>left = x<EOL>top = y<EOL>right = left + width<EOL>bottom = top + height<EOL><DEDENT>else:<EOL><INDENT>while True:<EOL><INDENT>control = control.GetParentControl()<EOL>handle = control.NativeWindowHandle<EOL>if handle:<EOL><INDENT>pRect = control.BoundingRectangle<EOL>left = rect.left - pRect.left + x<EOL>top = rect.top - pRect.top + y<EOL>right = left + width<EOL>bottom = top + height<EOL>break<EOL><DEDENT><DEDENT><DEDENT>return self.FromHandle(handle, left, top, right, bottom)<EOL>
Capture a control to Bitmap.
control: `Control` or its subclass.
x: int.
y: int.
width: int.
height: int.
x, y: the point in control's internal position(from 0,0)
width, height: image's width and height from x, y, use 0 for entire area,
If width(or height) < 0, image size will be control's width(or height) - width(or height).
Return bool, True if succeed otherwise False.