Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

repaint in c++

Options
  • 23-04-2003 10:28am
    #1
    Registered Users Posts: 2,593 ✭✭✭


    hi all
    i trying to repaint a tpanel but i have added timages to it dynamically and they will not "disappear2 when i call the repaint function the code i am using is shown below i am also using this function for a tpaintbox am it works fine.

    mainFrame->Repaint(); //tpaintbox
    BackPanel->Repaint(); //tpanel

    is there anyway that i can remove these timages i.e blank the tpanel again..

    tanx in advance
    tommycahir


Comments

  • Registered Users Posts: 1,237 ✭✭✭GUI


    u talking about c++ console app now?
    or windows app?


  • Registered Users Posts: 2,593 ✭✭✭tommycahir


    i talking bout the windows app
    i got it blanking the stuff now but i need it to remove the timages that were there previously.


  • Registered Users Posts: 2,150 ✭✭✭dazberry


    I'm not sure exactly what you're trying to do here, but (guessing) that the TImages are children to the TPanel, when you call Repaint, this causes an Invalidate and then an Update. You need to call update only (avoiding the invalidate) ... why ?

    BackPanel->Update();

    D.


  • Registered Users Posts: 2,593 ✭✭✭tommycahir


    i am designing a logic gate simulator and i add the timages to the tpanel then i have a tpaintbox on top of that in which to draw the connections i am able to clear the paint box and the tpanel with floodfill but i am not able to remove the timages that were added to the tpanel


  • Registered Users Posts: 2,150 ✭✭✭dazberry


    Ok,

    well you could, either:

    [1]
    Set the TImages.visible = False
    In the TPaintBox.OnPaint methods, depending on the specific logic, you could manually draw the TImage contents on to the paint box.
    Cons: You will have to deal with transparency as well, if thats a problem.

    [2]
    Delete all the TImages
    Add a TImageList to the form and load all the images in to it.
    In the TPaintBox.OnPaint method, again depending on logic, do something like the following (In Delphi):

    If (SomeState) then
    begin
    ImageList1.Draw(PaintBox1.Canvas,10,10,0);
    end;

    Check out the help on TCustomImageList.Draw.
    Cons: All the images need to be the same size, or at least you'll need to use multiple TImageLists.

    [3]
    or alternately In TPaintBox.OnPaint (Depending on state)

    for nLoop:=0 to ComponentCount-1 do
    begin
    if Components[nLoop] is TImage then
    With Components[nLoop] as TImage do
    if Parent = Panel1 then
    Visible:=False;
    end;

    Should be similar in BCB.

    HTH

    D.


  • Advertisement
Advertisement