China was an established state with a good grip on the territories it controlled. The europeans did not "colonise" it but rather created trading posts.
First European settlement in the area became Macau, a small fishing place of little significance, which the Portuguese turned into a trade post in 1557. The Portuguese paid an annual tribute in order to stay there and eventually obtained self-administration while China still collected profits through commercial arrangements. Macau was also the last remaining European colony in Asia, its sofereignity was transferred back to China in 1999 but retained a high degree of autonomy. Even now Macau is only a "special administrative region" of China, mints its own money and participates in some sports events as a separate entity.
The Portuguese were the first Europeans to arrive in Guangzhou, an important port in the south of China, in 1514, establishing a monopoly on the external trade out of its harbour. They were later expelled from their settlements but instead granted use of Macau as a trade base. Guangzhou quickly emerged as one of the most suitable ports for international trade and long ships arrived from all over the world. By the middle of the 18th century, Guangzhou had emerged as one of the world's great trading ports. China fought wars to keep this one in control and today it's third largest city in the country.
After achieving control over India, the British did try to go into China as well. International attention to Shanghai grew in the 19th century due to European recognition of its economic and trade potential at the Yangtze River. During the First Opium War (1839–1842), British forces occupied the city. The war ended with a Treaty which allowed the British to dictate opening the treaty ports, Shanghai included, for international trade.
Hong Kong is another "special administrative region" of China today, ruled by the British until not long ago. Hong Kong being an island and Britain being a huge naval force, made it easier to capture and defend. It became a British colony after the First Opium War, when it was ceded to the UK, and returned to China in 1997. The decision to hand it back to China was mostly for economic reasons. What we know as "Hong Kong" consists of three areas which have different status and by 1997 it was impractical to separate them. Britain could profit much more if Hong Kong kept its economic strength and growth, regardless of who has political control over it. Economically, Hong Kong retains minimum government intervention from China anyways, and culturally it's a place where "East meets West". It even has a different political system and a high degree of autonomy.
Another european colony was Taiwan, where the ethnic Chinese actually started to arrive only after the Spanish and the Dutch settled there in the 17th century. Its population eventually did become chinese through ancestry or by assimilation, and a "Republic of China" was established there in 1912. For political reasons, Taiwan did not get fully absorbed into the "People's Republic of China".
source: "Hong Kong: The Road to 1997" by Roger Buckley