I need to draw on a TPanel, ideally directly so I don’t have another component on top of it getting in the way of mousevent-event trapping (I want to draw a little “size-grip” on it). How should I go about doing this?
Share
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.
To really do it right, you should probably write a descendant class. Override the
Paintmethod to draw the sizing grip, and override theMouseDown,MouseUp, andMouseMovemethods to add resizing functionality to the control.I think that’s a better solution than trying to draw onto a
TPanelin your application code for a couple of reasons:Canvasproperty is protected inTPanel, so you have no access to it from outside the class. You can get around that with type-casting, but that’s cheating.Here’s something to get you started: