Toasts – Diff between revs 41 and 51
?pathlinks?
Rev 41 | Rev 51 | |||
---|---|---|---|---|
Line 258... | Line 258... | |||
258 | /// Animates the form automatically when it is loaded |
258 | /// Animates the form automatically when it is loaded |
|
259 | /// </summary> |
259 | /// </summary> |
|
260 | private void Form_Load(object sender, EventArgs e) |
260 | private void Form_Load(object sender, EventArgs e) |
|
261 | { |
261 | { |
|
262 | // MDI child forms do not support transparency so do not try to use the Fade method |
262 | // MDI child forms do not support transparency so do not try to use the Fade method |
|
- | 263 | _form.BeginInvoke((Action)(() => |
||
- | 264 | { |
||
263 | if (_form.MdiParent == null || _method != AnimationMethod.Fade) |
265 | if (_form.MdiParent == null || _method != AnimationMethod.Fade) |
|
264 | NativeMethods.AnimateWindow(_form.Handle, _duration, AwActivate | (int)_method | (int)_direction); |
266 | NativeMethods.AnimateWindow(_form.Handle, _duration, AwActivate | (int)_method | (int)_direction); |
|
- | 267 | })); |
||
265 | } |
268 | } |
|
Line 266... | Line 269... | |||
266 | |
269 | |
|
267 | /// <summary> |
270 | /// <summary> |
|
268 | /// Animates the form automatically when it is shown or hidden |
271 | /// Animates the form automatically when it is shown or hidden |
|
269 | /// </summary> |
272 | /// </summary> |
|
270 | private void Form_VisibleChanged(object sender, EventArgs e) |
273 | private void Form_VisibleChanged(object sender, EventArgs e) |
|
271 | { |
274 | { |
|
- | 275 | // Do not attempt to animate MDI child forms while showing or hiding as they do not behave as expected |
||
- | 276 | _form.BeginInvoke((Action)(() => |
||
272 | // Do not attempt to animate MDI child forms while showing or hiding as they do not behave as expected |
277 | { |
|
273 | if (_form.MdiParent == null) |
278 | if (_form.MdiParent == null) |
|
274 | { |
279 | { |
|
275 | var flags = (int)_method | (int)_direction; |
280 | var flags = (int)_method | (int)_direction; |
|
276 | |
281 | |
|
277 | if (_form.Visible) |
282 | if (_form.Visible) |
|
278 | flags = flags | AwActivate; |
283 | flags = flags | AwActivate; |
|
279 | else |
284 | else |
|
280 | flags = flags | AwHide; |
285 | flags = flags | AwHide; |
|
281 | |
286 | |
|
- | 287 | NativeMethods.AnimateWindow(_form.Handle, _duration, flags); |
||
282 | NativeMethods.AnimateWindow(_form.Handle, _duration, flags); |
288 | } |
|
283 | } |
289 | })); |
|
Line 284... | Line 290... | |||
284 | } |
290 | } |
|
285 | |
291 | |
|
286 | /// <summary> |
292 | /// <summary> |
|
287 | /// Animates the form automatically when it closes |
293 | /// Animates the form automatically when it closes |
|
288 | /// </summary> |
294 | /// </summary> |
|
289 | private void Form_Closing(object sender, CancelEventArgs e) |
295 | private void Form_Closing(object sender, CancelEventArgs e) |
|
- | 296 | { |
||
- | 297 | if (!e.Cancel) |
||
- | 298 | { |
||
290 | { |
299 | _form.BeginInvoke((Action)(() => |
|
291 | if (!e.Cancel) |
300 | { |
|
292 | // MDI child forms do not support transparency so do not try to use the Fade method. |
301 | // MDI child forms do not support transparency so do not try to use the Fade method. |
|
- | 302 | if (_form.MdiParent == null || _method != AnimationMethod.Fade) |
||
- | 303 | NativeMethods.AnimateWindow(_form.Handle, _duration, AwHide | (int)_method | (int)_direction); |
||
293 | if (_form.MdiParent == null || _method != AnimationMethod.Fade) |
304 | })); |
|
Line 294... | Line 305... | |||
294 | NativeMethods.AnimateWindow(_form.Handle, _duration, AwHide | (int)_method | (int)_direction); |
305 | } |
|
295 | } |
306 | } |
|
296 | |
307 | |
|
297 | #endregion |
308 | #endregion |