Re: Should this be an object?




"MP" <NoSpam@xxxxxxxxxx> wrote

does this seem like the right direction to head?

No.

Turn 180 degrees and start thinking about how you can
de-couple your objects from everything else. You don't
really want them to know about the outside world, any more
than you want to require the outside world to know how your
object works.

The less code they are 'required' to include in 'handling' eachother
the better....

As others have said, if its text that needs to be displayed,
then offer a function to return the text. If it is something
to be drawn, then you might pass in the hDC or other canvas
on which to draw itself. It could care less if that 'canvas' is a
form, picturebox, or printer, etc... And the code that calls on
the object to draw itself, doesn't care how it does it, as long as
it draws itself to the place indicated by the passed in hDC or
other canvas. (form, picturebox...)

LFS



.



Relevant Pages

  • Re: Should this be an object?
    ... back to the "thinking board" ... then you might pass in the hDC or other canvas ... on which to draw itself. ... the object to draw itself, doesn't care how it does it, as long as ...
    (microsoft.public.vb.general.discussion)
  • SWT painting
    ... I can't draw a line over a SWT control component as canvas. ... Take care ...
    (comp.lang.java.gui)
  • SWT painting
    ... I can't draw a line over a SWT control component as canvas. ... Take care ...
    (comp.lang.java.gui)
  • Re: Questions about drawing on Canvas
    ... I am attempting for the first time to do some drawing on a canvas. ... Why do you subclass from JPanel to draw rectangles, ... // TODO Find out what effect removing these LOC will have. ...
    (comp.lang.java.programmer)
  • Re: Questions about drawing on Canvas
    ... axes and then superimpose a line on the canvas as well, ... Why do you subclass from JPanel to draw rectangles, ... // TODO Find out what effect removing these LOC will have. ...
    (comp.lang.java.programmer)