Detect change of resolution c# WinForms

前端 未结 4 595
轮回少年
轮回少年 2020-11-30 07:18

is there an easy way to hook to an event that is triggered on change of global screen resolution?

4条回答
  •  天涯浪人
    2020-11-30 08:08

    Sure you don't have to unsubscribe to static events (or any events) if your program (process) is dying. The OS will take care of releasing all memory of your process to the OS. However, if you subscribe to a static event or to any event pointing to an object with a longer lifetime than your object subscribing, and you want that object to be eligible for GC - you need to unsubscribe (-=) to the event.

    AND it is always good practice to always unsubscribe to all events. You never know when the lifetime of your objects are changed (by someone else) during the lifespan of your source code / product...

提交回复
热议问题