lang:csharp:ihm:commun
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| lang:csharp:ihm:commun [2016/11/21 18:20] – Création avec "Affiche un MessageBox sans bloquer la suite du process" root | lang:csharp:ihm:commun [2020/04/26 23:27] (Version actuelle) – Conversion de <note> vers <WRAP> root | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | [[lang: | ||
| + | |||
| =====Affiche un MessageBox sans bloquer la suite du process===== | =====Affiche un MessageBox sans bloquer la suite du process===== | ||
| Vive le thread tout simplement. Facilement adaptable à n' | Vive le thread tout simplement. Facilement adaptable à n' | ||
| Ligne 5: | Ligne 7: | ||
| { | { | ||
| MessageBox.Show(" | MessageBox.Show(" | ||
| - | })).Start(); | + | } |
| + | )).Start(); | ||
| </ | </ | ||
| + | |||
| + | Pour forcer la MessageBox à rester au dessus de l' | ||
| + | |||
| + | <code csharp> | ||
| + | MessageBox.Show(" | ||
| + | </ | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | =====Barre de progression dans la barre des tâches===== | ||
| + | <file java TaskbarProgress.java> | ||
| + | using System; | ||
| + | using System.Runtime.InteropServices; | ||
| + | |||
| + | public static class TaskbarProgress | ||
| + | { | ||
| + | public enum TaskbarStates | ||
| + | { | ||
| + | NoProgress = 0, | ||
| + | Indeterminate = 0x1, | ||
| + | Normal = 0x2, | ||
| + | Error = 0x4, | ||
| + | Paused = 0x8 | ||
| + | } | ||
| + | |||
| + | [ComImport()] | ||
| + | [Guid(" | ||
| + | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | ||
| + | private interface ITaskbarList3 | ||
| + | { | ||
| + | // ITaskbarList | ||
| + | [PreserveSig] | ||
| + | void HrInit(); | ||
| + | [PreserveSig] | ||
| + | void AddTab(IntPtr hwnd); | ||
| + | [PreserveSig] | ||
| + | void DeleteTab(IntPtr hwnd); | ||
| + | [PreserveSig] | ||
| + | void ActivateTab(IntPtr hwnd); | ||
| + | [PreserveSig] | ||
| + | void SetActiveAlt(IntPtr hwnd); | ||
| + | |||
| + | // ITaskbarList2 | ||
| + | [PreserveSig] | ||
| + | void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); | ||
| + | |||
| + | // ITaskbarList3 | ||
| + | [PreserveSig] | ||
| + | void SetProgressValue(IntPtr hwnd, UInt64 ullCompleted, | ||
| + | [PreserveSig] | ||
| + | void SetProgressState(IntPtr hwnd, TaskbarStates state); | ||
| + | } | ||
| + | |||
| + | [Guid(" | ||
| + | [ClassInterface(ClassInterfaceType.None)] | ||
| + | [ComImport()] | ||
| + | private class TaskbarInstance | ||
| + | { | ||
| + | } | ||
| + | |||
| + | private static ITaskbarList3 taskbarInstance = (ITaskbarList3)new TaskbarInstance(); | ||
| + | |||
| + | public static void SetState(IntPtr windowHandle, | ||
| + | { | ||
| + | taskbarInstance.SetProgressState(windowHandle, | ||
| + | } | ||
| + | |||
| + | public static void SetValue(IntPtr windowHandle, | ||
| + | { | ||
| + | taskbarInstance.SetProgressValue(windowHandle, | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | et son utilisation | ||
| + | <code java> | ||
| + | private static bool taskbarSupported = Environment.OSVersion.Version >= new Version(6, 1); | ||
| + | |||
| + | if (taskbarSupported) | ||
| + | { | ||
| + | // Utilisation | ||
| + | TaskbarProgress.SetState(this.Handle, | ||
| + | TaskbarProgress.SetValue(Handle, | ||
| + | |||
| + | // Désactivation | ||
| + | TaskbarProgress.SetState(this.Handle, | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | <WRAP center round important 60%> | ||
| + | Il n'est pas possible d' | ||
| + | |||
| + | Si un élément de cette classe est exécuté, le constructeur privé l'est aussi à cause de la variable '' | ||
| + | </ | ||
| + | |||
lang/csharp/ihm/commun.1479748834.txt.gz · Dernière modification : de root
