Here's an easy piece for someone to start chipping into Zymail even
before the SourceForge project is set up.
We need a method to format a date so that it fits into a given width
-- and moreover, splits it into two parts, so that one can be left-
justified and the other right-justified, with a flexible space
between them. Some examples (manually formatted for a monospaced font):
November 17, 2007 6:56 PM
November 20, 2007 12:35 PM
Yesterday 10:13 AM
Today 5:45 PM
So we need a subroutine like this:
Sub FormatConstrained(extends d As Date, g As graphics, width As
Integer,
ByRef outLeftPart As String, ByRef outRightPart As String)
This takes whatever font settings are already on g, and stuffs
outLeftPart and outRightPart such that:
1. outLeftPart gets the date -- spelling out the month name if
that'll fit, otherwise switching to ShortDate form; and using
Yesterday, Today, and Tomorrow to refer to those dates.
2. outRightPart gets the time, but only if that'll fit; if the left
part can't be made short enough to fit the time, then outRightPart
should be the empty string.
3. The total of outLeftPart and outRightPart must be less than width,
if possible.
Somebody want to whip this out?
Thanks,
- Joe
--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|