cad sunny

cad sunny

  • NA
  • 138
  • 22.8k

How to draw widthwise and height wise when i click button

Apr 3 2020 7:01 AM
hi,
i have label1 ,label2 and textbox1,textbox2
 
label1.back color is Black.
label2.back color is White.
 
i want if i enter text in textbox1 like
 
10-A
3-B
and textbox2
10-A
3-B
 
here A = Label1.Back color i.e Black
Here B = Label2.back color.i.e White
 
Now,i want to click button or Mouse click on picturebox event draw Like Picture uploaded below
 
 
 
this below code is only for refrence idea
  1. private void Form1_Paint(object sender, PaintEventArgs e)  
  2. {  
  3. Graphics gForm = this.CreateGraphics();  
  4. gForm.FillRectangle(Brushes.Black, this.ClientRectangle);  
  5. for (int i = 1; i <= 100; ++i)  
  6. {  
  7. Rectangle r = new Rectangle(i * 40 - 15, 0, 15,  
  8. this.ClientRectangle.Height);  
  9. //Rectangle r = new Rectangle(i * 40 - 15, 0, 15, this.ClientRectangle.Width);  
  10. gForm.FillRectangle(Brushes.Gray, r);  
  11. }  
  12. }  
Please Help with source code