In this paper we propose an original distributed control framework for DC microgrids. We first formulate the (optimal) control objectives as an aggregative game suitable for the energy trading market. Then, based on duality, we analyze the equivalent distributed optimal condition for the proposed aggregative game and design a distributed control scheme to solve it. By interconnecting the DC microgrid and the designed distributed control system in a power preserving way, we steer the DC microgrid's state to the desired optimal equilibrium, satisfying a predefined set of local and coupling constraints. Finally, based on the singular perturbation system theory, we analyze the convergence of the closed-loop system. The simulation results show e...