The יעקב ישרש (written by Reb Yaakov Yehudah of Nardizin zt'l, son-in-law of Rebbe Mendel of Vorka zt'l) teaches from Yaakov Avinu's life that when he thought something was bad, it was good, and when he thought something was good it turned out to be bad. Yaakov Avinu escaped from his brother Eisav and came to Lavan's home. He thought it would be good in Lavan's home, but he endured many tzaros there, until he had to escape like a thief. When he traveled away from Lavan, he thought he would have tzaros meeting up with Eisav, but Eisav surprisingly kissed him and spoke kindly with him. So, when he thought it was good, it was the opposite; when he thought things were bad, they ended up being good.
Similarly, when Yaakov Avinu came to Shechem, it states (Bereishis 33:18) העיר פני את ויחן, and the Midrash states that he gave gifts to the people of the city and he sold them things for cheap because he wanted to befriend the people of Shechem. He thought good times had arrived, but then he soon suffered the tragedy that occurred with his daughter, "דינה צרת."
It also states יעקב וישב, and Rashi explains that he wanted to live in peace and then he suffered with the loss of Yosef, "יוסף צרת." Yaakov learned from these episodes that when one thinks matters are good, it might be the opposite, and when one thinks matters are bad, it might be good. All one can do is trust in Hashem that He will lead us in a good way.
When Yaakov had to go down to Mitzrayim, Yaakov Avinu knew that this was the beginning of the galus and slavery, as Hashem had told him in the Bris ben Habesarim (Bereishis 15:13), ארבע אותם וענו ועבדום שנה מאות, "They will enslave them and oppress them, for four hundred years," Nevertheless, he accepted the din, and he went willingly to Mitzrayim. He knew that although it appeared bad, it was really good.
Indeed, the nation increased immensely in Mitzrayim, as it states (Shemos 1:12) ירבה כן, "so did they multiply." Also, Chazal (Shabbos 89:) tell us that if Yaakov didn't go down to Mitzrayim, he would have descended to the land tied in iron chains.
יעקב ישרש concludes that the Torah tells us about this because it is a lesson for everyone. "A Yid shouldn't seek tricks and strategies on how to make life good for himself... He should trust in Hashem alone, and be batel to Him entirely. As it states (Tehillim 55:23) השלך יכלכלך והוא יהבך 'ה על, 'Cast your burden on Hashem, and He will sustain you,' and with this attitude, he will have his salvation."