This is my favorite quote from Rafael Nadal, who (as of this writing) has won more Grand Slams in tennis than anyone in history. But I think you'll find that the other two players close to him on this - Roger Federer and Novak Djokovic - would say the same, as would most great players from any sport. In fact, I think you'd find that most top players, when they lose a close one - react mostly in surprise. They were so intent on their performance (i.e. doing the shots it takes to win) that they weren't thinking about the actual outcome. And so, when they do lose, their first reaction is surprise and shock, maybe even disbelief, since losing, something they were not thinking about, caught them off guard.
So, instead of focusing on winning or losing, focus on having a great performance. After a match, separate in your mind your performance and the result, always knowing that if you maximize your performance, you'll maximize your chances of winning.
If, for example, you play a great match but lose close to a stronger player, then sure, there's disappointment. But separate your disappointment at losing from what should be satisfaction at your performance. Analyze both why you lost and why you played so well, so you can change the first and repeat the latter!