I’m new to C# Programming, I’m having three events like Mouse Key Down,Up and Drag.
On all this events I need to repaint the screen. Is there any Design pattern to do this.
Since, I need to call this Repaint method repeatedly on each events??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have three events and you want to call
Repaintfrom all of them. That’s three lines of code. Any abstraction you do to try to hide that repainting is going to cost you way more than three lines of code so you need a much more complicated use case before you can justify a more complex solution than just puttingRepaintinto each of your three event handlers.Edit:
I want to add that you are taking a lot of heat for your question and I for one do not agree. I think It’s a simple sincere question and one asked clearly. It’s actually a great beginner design question: “Should I use abstraction in such-and-such situation?” So, no, I don’t think you should in this situation. But good for you for trying to use abstraction every chance you get and don’t worry because you will get plenty of legitimate reasons soon enough!