I am trying to draw a circle using Windows Form at runtime inside a label control. I am trying to display green or red circle and display the text(‘L1’ or ‘L2’) on top of it. Could you please help.
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.
First you need to SetStyle in the Constructor so you can control the paint
Then you are responsible for painting the entire label including the background and the text. Override OnPaint
After you have draw the label text, then use g.DrawEllipse to draw the circle you want and where you want. Then use g.DrawString to position the text above it.
Keep in mind that if you must provide everything bit of the paint that you set properties for so this is only to be used for the labels that conform to the standard you are going to set