My experience has been:
If in an approach control's territory but not at towered field, I get a local code (02xx).. Once I leave the approach area for center, I get told squawk 1200 and told to call up someone else.
If im leaving a towered airport (inside an approach control or not) when calling up ground I can request FF and they will give me a "center" code and tower hands me to approach, and approach hands me off to center, seamlessly.
If departing an untowered field in a center-controlled area, once airborne I can be given a "center" code that will carry me to my destination or until I cancel FF...