help student
April 26th, 1999, 08:08 AM
i need to select a cstring of text by clicking on any part of the text. the only problem is that the text can be of any length. how can i detect the area that the whole cstring of text covered?
one way is this: i create a CRect variable and this CRect variable in turn calls a function which inflate the rectangle which is supposed to contain the text by using this command, rect.inflate(x,y). this function will then return the size of the rectangle to the CRect variable.
then using the CRect variable.PtInRect(point) where point is the point where the mouse is click on, this function will return true if the mouse was click on the text. but how will i know how much to inflate the rectangle by? what value of x and y should i used since the cstring of text can be any length.
the main problem is how can i get the actual size of the text in terms of its x and y coordinates? or how do i get the x and y coordinates of the first and last letter of the cstring of text?
please help me
best regards
one way is this: i create a CRect variable and this CRect variable in turn calls a function which inflate the rectangle which is supposed to contain the text by using this command, rect.inflate(x,y). this function will then return the size of the rectangle to the CRect variable.
then using the CRect variable.PtInRect(point) where point is the point where the mouse is click on, this function will return true if the mouse was click on the text. but how will i know how much to inflate the rectangle by? what value of x and y should i used since the cstring of text can be any length.
the main problem is how can i get the actual size of the text in terms of its x and y coordinates? or how do i get the x and y coordinates of the first and last letter of the cstring of text?
please help me
best regards