.bottom of TextWidthHeight

R

Ronald Dodge

Question for Stephen Lebans or possibly someone else who can answer this
question?

Version: 4.5
Module: modTextHeightWidth
Method: fTextWidthOrHeight

Within the With block of "sRect"

Variable in question: ".Bottom"

Line of code:
lngRet = apiDrawText(hDC, sText, -1, sRect, DT_CALCRECT Or DT_TOP Or _
DT_LEFT Or DT_WORDBREAK Or DT_EXTERNALLEADING Or DT_EDITCONTROL Or
DT_NOCLIP)

Is there anything that can be done with this line of code to have it
properly calculate the .Bottom variable where the rowsource of a listbox is
an empty string?

Issue I have with this:

When the "RowSource" property of the listbox is set to "", this causes the
function to return a value of 0 (zero) as the line height of a single item
on the listbox, when this is obviously not correct.

Work Around:

Have the code arbutarily put in a string value that is not an empty string
within the "RowSource" property, run the function, reset the "RowSource"
property to "" (empty string).
 
S

Stephen Lebans

Just test for a zero length string before you call theDrawText API.

If len(sText and vbNullstring) = 0 then sText = "Ag"


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top