Re: Some advice creating a graph class
From: rs (removethis4spam.rastacey_at_nl.rogers.com)
Date: 02/20/05
- Next message: Mike: "Menu greyed out problem"
- Previous message: Edward H. Fabrega: "Re: Some advice creating a graph class"
- In reply to: Edward H. Fabrega: "Re: Some advice creating a graph class"
- Next in thread: River Ross: "Re: Some advice creating a graph class"
- Reply: River Ross: "Re: Some advice creating a graph class"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 20 Feb 2005 17:10:34 -0330
Thanks. I didn't realize I could use the dc in the view without passing it
in as a parameter.
"Edward H. Fabrega" <spiritualfields@wavecable.com> wrote in message
news:PYednVSm3qMrcoXfRVn-vg@wavecable.com...
>
> "rs" <removethis4spam.rastacey@nl.rogers.com> wrote in message
> news:B_udnaD6CuV5LYXfRVn-iA@rogers.com...
> >I am developing a program to draw a graph of database data using the
> >OnPaint
> > function in the View class.
> > In the CView class I am grabbing the device context and then passing it
to
> > a
> > function where I draw the actual graph by creating pens & brushes and
> > using
> > moveto/lineto functions etc.
> >
> > void CBView::OnPaint()
> > {
> > CPaintDC dc(this); // device context for painting
> > DrawGraph(&dc);
> > }
> >
> > This is working well but becoming quite large as a function and would
> > think
> > it is time to create a class to encapsulate the graph function.
> > This seemed pretty straight forward until I started and realized it's
not
> > all that straight forward.
> >
> > Questions like what base class should this be derived from? How should
the
> > parameters be passed? etc.
> >
> > Any ideas, or tutorials or examples would be appreciated.
> >
> > Thanks.
> >
> >
> >
>
> Take a look at this. Are you trying to draw a grid like this?
>
> http://members.aol.com/spiritualfields/main_screenshot.htm
>
> That screen shot is of a CView drawn to reperesent a database. All of the
> drawing takes place in the view. There is no way of keeping your OnPaint
> small. It is a monumental task to draw and then populate the cells.
> Especially if the "cell"s are really rectangles that you keep track of as
> you draw the grid. If your only problem is that the function is big then
you
> have no problem. If you get more specific as to functionality, i.e. "how
do
> I keep track of the data?" "How do I scroll the window so that different
> parts of the database are visible?" "How do I keep the column headers
from
> scrolling vertically" How do I keep the row headers from scrolling
> horizontally?" How do I write into the cells from the database?" then I
> might be able to help you, at least with the building of the grid. If you
> are also building your database, then I might be able to help you there,
as
> well. Joe Newcomer's advice about letting OnPaint (I use OnDraw) worry
about
> drawing the grid is a good one, as it makes no sense to farm out painting
> functionalilty to a function other than the one designed for painting.
>
> Ed
>
>
>
- Next message: Mike: "Menu greyed out problem"
- Previous message: Edward H. Fabrega: "Re: Some advice creating a graph class"
- In reply to: Edward H. Fabrega: "Re: Some advice creating a graph class"
- Next in thread: River Ross: "Re: Some advice creating a graph class"
- Reply: River Ross: "Re: Some advice creating a graph class"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|