I want to modify a TImage's appearance (Bitmap).

I want to modify a TImage's appearance (Bitmap).

My concern is that while I'm making the modifications, the user may resize the form, which would change the size of the image, invalidating what I've done.

I don't know of a way to prevent resizing for a short period. If I put a critical section in the resize event of the form, would that prevent resizing while I'm modifying the form?

Or, although slower, I could write to a local bitmap and the copy it to the TImage if that is an atomic operation that wouldn't be preempted during the copy.

Any suggestions on how to approach this?

Comments

  1. The user can't resize while your code is working because the resize requires code to run in your main thread, and your main thread is otherwise occupied. In other words, you don't need to do anything.

    Obviously I'm assuming that you aren't doing anything daft like calling ProcessMessages.

    ReplyDelete
  2. You can also disable TImage (or the Form????) and enable it back when you are done but depends on what sort of modification you are talking about

    ReplyDelete

Post a Comment