Form's Paint Event

Hi;

When there's a component on the form aligned to the client, the OnPaint
event of the form does not occur.
(If there is not such a component, it occurs)

But i need this because i have a draw grid on the form aligned to the client. What should i do?

Thanx.

Comments

  • [b][red]This message was edited by zibadian at 2004-9-28 8:8:2[/red][/b][hr]
    : Hi;
    :
    : When there's a component on the form aligned to the client, the OnPaint
    : event of the form does not occur.
    : (If there is not such a component, it occurs)
    :
    : But i need this because i have a draw grid on the form aligned to the client. What should i do?
    :
    : Thanx.
    :
    :
    You could try to use Anchors instead of the Align property to simulate the alClient align. If that doesn't work, make the control 1 pixel lower than the ClientHeight of the form. This should leave a tiny part of the form exposed, causing the OnPaint event to fire.
    Alternatively, you could also call the Form's Onpaint() from the DrawGrid's OnPaint().

  • I tried your second advice, but now the OnPaint event is fired only if that tiny part of the form needs to be repainted.

    I have already checked the OnPaint event of the DrawGrid, but TDrawGrid has no such event on the object inspector.

    There should be a solution to this problem...




    : [b][red]This message was edited by zibadian at 2004-9-28 8:8:2[/red][/b][hr]
    : : Hi;
    : :
    : : When there's a component on the form aligned to the client, the OnPaint
    : : event of the form does not occur.
    : : (If there is not such a component, it occurs)
    : :
    : : But i need this because i have a draw grid on the form aligned to the client. What should i do?
    : :
    : : Thanx.
    : :
    : :
    : You could try to use Anchors instead of the Align property to simulate the alClient align. If that doesn't work, make the control 1 pixel lower than the ClientHeight of the form. This should leave a tiny part of the form exposed, causing the OnPaint event to fire.
    : Alternatively, you could also call the Form's Onpaint() from the DrawGrid's OnPaint().
    :
    :

  • : I tried your second advice, but now the OnPaint event is fired only if that tiny part of the form needs to be repainted.
    :
    : I have already checked the OnPaint event of the DrawGrid, but TDrawGrid has no such event on the object inspector.
    :
    : There should be a solution to this problem...
    :
    :
    :
    :
    : : [b][red]This message was edited by zibadian at 2004-9-28 8:8:2[/red][/b][hr]
    : : : Hi;
    : : :
    : : : When there's a component on the form aligned to the client, the OnPaint
    : : : event of the form does not occur.
    : : : (If there is not such a component, it occurs)
    : : :
    : : : But i need this because i have a draw grid on the form aligned to the client. What should i do?
    : : :
    : : : Thanx.
    : : :
    : : :
    : : You could try to use Anchors instead of the Align property to simulate the alClient align. If that doesn't work, make the control 1 pixel lower than the ClientHeight of the form. This should leave a tiny part of the form exposed, causing the OnPaint event to fire.
    : : Alternatively, you could also call the Form's Onpaint() from the DrawGrid's OnPaint().
    : :
    : :
    :
    :
    Then try to call the OnPaint() from the OnDrawCell(), although this might slow the application down. Or you could move the code of the OnPaint() into another event if that's possible.
  • Is there no way for you to call the form's Invalidate? This should force the OnPaint to be called. May this could work for you. See the OLH for details.

    : : I tried your second advice, but now the OnPaint event is fired only
    : : if that tiny part of the form needs to be repainted.

  • Thank you both, I used OnDrawCell event and it works nice.

    : Is there no way for you to call the form's Invalidate? This should force the OnPaint to be called. May this could work for you. See the OLH for details.
    :
    : : : I tried your second advice, but now the OnPaint event is fired only
    : : : if that tiny part of the form needs to be repainted.
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories