SONU GUPTA

SONU GUPTA

  • NA
  • 40
  • 4.3k

How to trace a written text is correct or not

Jun 1 2018 3:37 AM
This is the code for writing letter ka
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Drawing;  
  6. using System.Linq;  
  7. using System.Text;  
  8. using System.Threading.Tasks;  
  9. using System.Windows.Forms;  
  10. namespace WindowsFormsApplication56  
  11. {  
  12. public partial class Form1 : Form  
  13. {  
  14. public Form1()  
  15. {  
  16. InitializeComponent();  
  17. }  
  18. private void Drawcarc(object sender, PaintEventArgs e)  
  19. {  
  20. // Create pen.  
  21. Pen blackPen = new Pen(Color.Black, 3);  
  22. // Create coordinates of rectangle to bound ellipse.  
  23. float x1 = 460.0F;  
  24. float x2 = 510.0F;  
  25. float y = 190.0F;  
  26. float width = 40.0F;  
  27. float height = 75.0F;  
  28. // Create start and sweep angles on ellipse.  
  29. float startAngle1 = 35.0F;  
  30. float startAngle2 = 200.0F;  
  31. float sweepAngle1 = 300.0F;  
  32. float sweepAngle2 = 300.0F;  
  33. float[] dashValues = { 2, 2, 2, 2 };  
  34. blackPen.DashPattern = dashValues;  
  35. e.Graphics.DrawLine(blackPen, new Point(430, 150), new Point(590, 150));  
  36. e.Graphics.DrawLine(blackPen, new Point(505, 160), new Point(505, 290));  
  37. // Draw arc to screen.  
  38. e.Graphics.DrawArc(blackPen, x1, y, width, height, startAngle1 , sweepAngle1);  
  39. e.Graphics.DrawArc(blackPen, x2, y, width, height, startAngle2, sweepAngle2);  
  40. }  
  41. }  
  42. }  
  43. THIS IS THE CODE FOR DRAWING  
  44. using System;  
  45. using System.Collections.Generic;  
  46. using System.ComponentModel;  
  47. using System.Data;  
  48. using System.Drawing;  
  49. using System.Linq;  
  50. using System.Text;  
  51. using System.Threading.Tasks;  
  52. using System.Windows.Forms;  
  53. namespace WindowsFormsApplication58  
  54. {  
  55. public partial class Form1 : Form  
  56. {  
  57. Graphics g;  
  58. int x = -1;  
  59. int y = -1;  
  60. bool moving = false;  
  61. Pen pen;  
  62. public Form1()  
  63. {  
  64. InitializeComponent();  
  65. g = panel1.CreateGraphics();  
  66. g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;  
  67. pen = new Pen(Color.Black, 5);  
  68. pen.StartCap = pen.EndCap = System.Drawing.Drawing2D.LineCap.Round;  
  69. }  
  70. private void pictureBox1_Click(object sender, EventArgs e)  
  71. {  
  72. PictureBox p = (PictureBox)sender;  
  73. pen.Color = p.BackColor;  
  74. }  
  75. private void panel1_MouseDown(object sender, MouseEventArgs e)  
  76. {  
  77. moving = true;  
  78. x = e.X;  
  79. y = e.Y;  
  80. }  
  81. private void panel1_MouseMove(object sender, MouseEventArgs e)  
  82. {  
  83. if (moving && x != -1 && y != -1)  
  84. {  
  85. g.DrawLine(pen, new Point(x, y), e.Location);  
  86. x = e.X;  
  87. y = e.Y;  
  88. }  
  89. }  
  90. private void panel1_MouseUp(object sender, MouseEventArgs e)  
  91. {  
  92. moving = false;  
  93. x = -1;  
  94. y = -1;  
  95. }  
  96. }  
  97. }  
Now I want if I draw a line over text ka then it should show it is correct otherwise if the line is drawn outside text ka then should show it is not correct