Click here to Skip to main content
15,885,890 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hiii all,

I have converted the text say 'abc' into my handwriting .... for this i have called the samples of a, b,c from my sql database, and finally render them one by one using Ink object , now finally they are render on picture box.. means i have three strokes now... i want to do clipp operation on them ... I have Inkoverlay object which contains the each stroke information (like stroke count etc) Now when i see the properties of inkoverlay of the rendered strokes it shows only one count of stroke although i have rendered three strokes on picture box now how can i combine all the strokes and preserve them in Inkoverlay class ... iam not able to get bounding boxes of each strokes. i have the code snippet as below

VB
Dim mink As New Ink
            mink.Load(mByte)
            boundingBox = mink.Strokes.GetBoundingBox

dim bytearr as new arraylist

bytearr.Add(mByte)('iam reading mbyte from sqldatabase for ecah character one by one ')

VB
byteink.Load(bytearr(0))
       Dim byteink1 As New Ink
       byteink1.Load(bytearr(1))
       'Next
       'byteink.Load(mByte)

       Dim rect1 As Rectangle
       Dim rect2 As Rectangle
       Dim rtf As Rectangle

       ' For Each Stroke In byteink.Strokes
       rect1 = byteink.GetBoundingBox
       rect2 = byteink1.GetBoundingBox
       ' Next
       rtf = New Rectangle(rect1.X + rect1.Width, rect2.Y, rect2.Width - rect1.X - rect1.Width + rect2.X, rect2.Height)
       ' rtf = New Rectangle(rect1.X, rect1.Y, rect2.Left - rect1.X, rect1.Height)
       mink.Clip(rtf)


here mink contains the information of stroke on the basis of mbyte so each time mink.strokes count appears as 1 only .... but i want all the strokes information aftr rendering all them on Picture box


so please help me out how can i get the information of all the strokes on picture box into single Inkoverlay object


with regards
Zoya
Posted

1 solution

It makes no sense whatsoever. The class PictureBox holds pixel graphics, and your vector graphics represented by the ink data get lost. Pixel (bitmap) graphics is not a proper container for the ink. Use the ink object itself, preserve it.

Moreover, the use of PictureBox makes no sense even just for presentation. The only value of this control is presenting an image in a very simple way; it presents no useful features when used for something dynamic, animated or interactive (like ink image); in such cases it only adds implementation hassles and eats up resources and performance without any useful return.

This is a very common mistake, discussed many times on CodeProject.

I'll explain what to do instead; please see my past answers:
How do I clear a panel from old drawing[^],
draw a rectangle in C#[^].

For more detail in rendering of graphics, see my other answers:
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^].

—SA
 
Share this answer
 
Comments
zoyakhan 21-Feb-12 8:29am    
Thanks for the reply , now iam worried as my INK .load method once loaded with byte information , at a time i cant reload it with other byte , then i have to create new ink object , i dont want that i want to preserve both the bytes and want to load them in single ink object use any method like ink.load so that i can get my both the ink stroke information in single ink object
Sergey Alexandrovich Kryukov 21-Feb-12 10:25am    
Whatever you do, you need to preserve your ink object or serialize it into other vector object holding all information you need, to store it in the database. I don't understand why are your talking about both; it looks like you need many of ink object, for letters, etc.
You post sound like you have or you are developing your own hand-written recognition system, it that right? This is a whole science... have you had some progress?
--SA
zoyakhan 22-Feb-12 5:12am    
yes you are right , iam working on my handwriting synthesis system not recogniztion system ... k will try to your method thanks will communicte further

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900