简体   繁体   中英

How to access events of a properties.settings.default field in C#?

I have two forms, Form A and Form B. My Properties.Settings.Default has a timer object that when "ticked" needs to open Form B. What I would like to do is program the timer_tick(object sender, Eventargs e) event for the timer object that is in the solution's properties. Is this possible? If so how?

The issue I am having is I don't know the syntax to program events for properties.

Any help/alternate ways would be much appreciated.

PS What I am essentially trying to do is trigger a screen saver (Form B) after x seconds but when Form B is clicked it needs to re-enable the timer and close itself.

Add a timer object property on Form B. When the timer goes off and you are opening Form B, assign the timer property on the new Form B your timer object. When Form B is clicked, set the the timer property to start again and close your form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM