The gemara in Taanis 29a states
כשם משנכנס אדר מרבים בשמחה כך משנכנס אב ממעטין בשמחה
Just like when Adar comes we are joyous so too when Av comes we are sad
What is the connection between Adar and Av, the simcha in adar and the aveilus in Av seem to have no connection?
The answer may be as follows. The medrash quoted by Rashi in Parshas Shelach states on the pasuk ויבכו העם בלילה ההוא that it was the night of Tisha B'av and Hashem said that you cried for no reason, I will give you a reson to cry on the future. In other words, the חטא of the meraglim is the source of the Aveilus of Tisha B'av. Now we need to understand how does the חטא of the meraglim relate to the punishment? Where is the midda kneged midda?
What was the חטא of the meraglim?
One approach is as follows. The leaders made the following calculation. Things were good in the midbar. They had a spiritual life with no effort. Manna came down from heaven every morning. If they had a question they asked Moshe who asked Hashem. In short, spirituality was handed to them on a silver platter. On the other hand they realized that in Israel life would change radically. They would not live a life of nissim, manna would not fall from heaven. They would have to work hard to retain their spiritually. If they had a question in Torah they would have to figure out the answer.
Based on the above, the meraglim decided life was better in the midbar and therefore did what they did.
What was their sin? They didn't want to work hard at their spirituality. They wanted everything handed to them on a silver platter.
Given that we can understand the midda kneged midda. They wanted to have a life of miracles and easy spiritually. Hashem said, I am going to destroy the Beis Hamikdash on this day and go into hester panim. In other words, just the reverse of what the meraglim wanted. To be spiritual in Golus without the Beis Hamikdash takes even harder work. The Beis Hamikdash was a mini midbar. People could come and be spiritually recharged by the Nisim and the giluy hashechina in the Beis Hamikdash. Therefore Hashem says I am going to take even that away and send you into Golus so that you can fix the Aveira.
This also explains our original question. Purim is a holiday where we celebrate a Nes Nistar. They saw the Yad Hashem even though it was hidden. On Purim the Jewish people went even further. The gemara in Shabbos comments that Hashem held the mountain over the Jewish people's head and forced them to accept the Torah. The obvious question is that they said נעשה ונשמע. The acharonim point out that the medrash in Noach asks this question and answers that they said נעשה ונשמע on תורה שבכתב but they had to be forced to accept תורה שבעל פה because it is infinite and hard to master. It was only at the time of Purim where the Jews were mekabel תורה שבעל פה out of their own free will (קימו וקיבלו) and this is why the flowering of the תורה שבעל פה only came about in the time of the second beis hamikdash. We see that at the time of Purim Klal Yisrael did teshuva on this aveira by both recognizing the yad hashem of the nes nistar and being mekabel תורה שבעל פה out of their own free will (קימו וקיבלו). Therefore, the Gemara equates the simcha in Adar with the aveilus in Av because they stem from the same source.
Unfortunately the aveira of the meraglim is still with us nowadays in the executive summary/fast food society of ours. No one has time to work hard on something, everyone wants everything to come easy. No one wants to sit and sweat over pshat in a gemara, they want it spoon fed to them. This is one of the reasons why there is such a proliferation of (kitzur)handbook sefarim, people are not willing to put in the effort to learn the sources. this is why the Artscroll gemaras have become so popular, they make learning gemara easy.
We should take this lesson to heart during the 9 days and hopefully do teshuva and not have to fast this Tisha B'Av.