[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Drawing a diagram and saving it

Ken Allen

12/19/2004 10:39:00 PM

I have an older program, written in REALbasic for MacOS, but the program
is also capable of compiling under Windows, which is used to generate
double elimination playoff diagrams for tournaments (used primarily for
Little League Baseball, but could be used for any sport). The program
accepts the number and names of the teams as input and then generates a
file to keep track of all of the games. As scores are entered, the teams
are automatically advanced along the diagram.

The program is capable of drawing the diagram for display on the screen,
drawing it to a graphics object associated with a printer, or drawing it
into a graphics object that is then saved as a JPEG image, for inclusion
on a web site.

I am trying to figure out how to do the same thing in C# and .Net, as an
exercise and learning curve, but with limited success.

In the REALbasic program I wrote a generic procedure that accepts the
tournament records as input, along with a graphics object, and it simply
performs the drawing into that graphics object. The only thing being
drawn are straight lines with specific endpoints, and text that is
placed along the lines to explain the format (team names, winners,
etc.). Wrapper classes invoke this procedure to use it appropriately:
the OnPaint handler for a viewing form invokes this procedure passing
the graphics object for the form; the printer context passes its
graphics object; and a generic graphics object is passed and then used
to save the file as a JPEG.

I suspect that I can figure out how to draw the image onto a form, but I
am having more difficulty determining how to draw the image for printing
or being able to save it in a format that can be displayed on a web
page. This is especially tricky because the REALbasic code automatically
scales the drawing to fit the target graphics object, such that resizing
the windows form automatically redraws the information to fit, in the
same ratio as 8.5x11 paper. When printing the graphics object is scaled
to represent the printable portion of the target printer. When saving to
a file for use on a web page, the graphics object is set to a
reasonable size for display (but this can be controlled from the code).

Does anyone have any suggestions on how I might develop the same level
of capability using C# and .Net?

-ken