Why were the British able to successfully conquer almost all of India but not able to do the same with China?

As mentioned above. From what Ive read of Indian history, many kings put up a heroic struggle and were crushed. In contrast China appears to have been colonized by the british, Russia, French and Portugal all at the same time. How did they allocate territories between themselves and why did they not fight with each other when in places like India, they fought each other using proxies ie Tipu Sultan used French guns and artillery against the British.