Applications and operating systems have a ton of windows and controls, sub windows and sub controls. I've noticed its common to have sub controls have their coordinate systems reset to start at 0 making drawing much easier. However I'm not sure how that is done and how I'd be able to do that.
I'm going to be creating an application that does a lot of 2d drawing and includes things like my own implemented scrollbars and lots of controls that have sub controls. I want the coordinate system of sub controls to reset to 0 and I want the controls to have minimal knowledge of their location within parent controls, and parent parent controls, ect.
The only thing I can think of is to pass in transform coordinates and have each sub control when drawing add the x and y transform coordinates to their objects being drawn so it gets transformed to the correct location. That quickly gets very tiring when I know there are better ways.
I'm not sure what I'll be using, weather it will be GDI+, OpenGL, or Direct2D. I'm just looking for general information on how this done so sub controls can draw at x and y 0 and it pops up at whatever location the actual control is located at.
Graphics.create(int,int,int,int)