public static System.Drawing.Icon FromString(string IconName) { try { string IconPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\Icons\\" + IconName + ".ico"; if (System.IO.File.Exists(IconPath)) { System.Drawing.Icon nI = new System.Drawing.Icon(IconPath); return nI; } } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, (string) ("Couldn\'t get Icon from String" + Constants.vbNewLine + ex.Message)); } return null; }
/// <summary> /// Constructs base icon object /// </summary> public NotifyIconUtility() { notifyIcon = new NotifyIcon(); //icon = System.Drawing.Icon.ExtractAssociatedIcon(@".\res\WebPaperIcon.ico"); icon = Properties.Resources.WebPaperIcon; notifyIcon.Icon = icon; notifyIcon.Visible = true; }
public MainWindow() { InitializeComponent(); System.Drawing.Icon i = new System.Drawing.Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream("IISExpressProxy.Images.Gear_XP.ico")); _icon = new System.Windows.Forms.NotifyIcon() { Icon = i, Visible = true }; _icon.DoubleClick += new EventHandler(_icon_DoubleClick); }
public MainWindow() { // Handle global exceptions AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledException); InitializeComponent(); if (true)//ApplicationDeployment.CurrentDeployment.IsFirstRun) { SetRegistryKeys(); SetAddRemoveProgramsIcon(); } // Set Data Context (for data bindings, as per MVVM) DataContext = TriggrViewModel.Model; // Extract icon var iconStream = System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/Resources/Images/favicon.ico")).Stream; var iconImage = new System.Drawing.Icon(iconStream); // Set tray icon MainWindow.icon = new NotifyIcon(); icon.Icon = iconImage; // Set tray icon menu items System.Windows.Forms.MenuItem[] menuItems = { new System.Windows.Forms.MenuItem("Show", showWindow_Handler), new System.Windows.Forms.MenuItem("Exit", exit_Handler) }; var ctxMenu = new System.Windows.Forms.ContextMenu(menuItems); icon.Click += new EventHandler(showWindow_Handler); icon.BalloonTipClicked += new EventHandler(showWindow_Handler); icon.ContextMenu = ctxMenu; // Enable tray icon icon.Visible = true; var showBalloon = true; try { showBalloon = !ApplicationDeployment.CurrentDeployment.IsFirstRun && DateTime.Now - Properties.Settings.Default.LastLaunch < TimeSpan.FromDays(15); } catch(InvalidDeploymentException) { showBalloon = true; } if (showBalloon) { icon.ShowBalloonTip(5000, "", "Triggr is running in the background", ToolTipIcon.Info); } else { this.Show(); } Properties.Settings.Default.LastLaunch = DateTime.Now; Properties.Settings.Default.Save(); }
public CmdCommit() : base(null, CAPTION, 0, null, MESSAGE, NAME, TOOLTIP) { System.Drawing.Icon icon = new System.Drawing.Icon(GetType().Assembly. GetManifestResourceStream("ISDUTLib.tm.ui.images.commitTrans.ico")); if(icon!=null) { base.m_bitmap = icon.ToBitmap(); } }
/// <summary> /// 返回ICO /// </summary> /// <param name="resxname"></param> /// <returns></returns> public System.Drawing.Icon GetIco(string resxname) { if (resxname.IsNullOrEmptyOrSpace()) return null; var stream = GetType().Assembly.GetManifestResourceStream("App.Resx.ICO." + resxname); if (stream == null) { return null; } var icon = new System.Drawing.Icon(stream); return icon.IsEmptyIcon() ? null : icon; }
//Deliberately specify the default constructor with various overrides public RouteViewer(int width, int height, GraphicsMode currentGraphicsMode, string openbve, GameWindowFlags @default): base (width,height,currentGraphicsMode,openbve,@default) { try { System.Drawing.Icon ico = new System.Drawing.Icon("data\\icon.ico"); this.Icon = ico; } catch { } }
//We need to explicitly specify the default constructor public OpenBVEGame(int width, int height, GraphicsMode currentGraphicsMode, GameWindowFlags @default): base(width, height, currentGraphicsMode, Interface.GetInterfaceString("program_title"), @default) { try { var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); System.Drawing.Icon ico = new System.Drawing.Icon(OpenBveApi.Path.CombineFile(OpenBveApi.Path.CombineDirectory(assemblyFolder, "Data"), "icon.ico")); this.Icon = ico; } catch { } }
private void GetFlowList(ViewType vt) { // 数据处理 BindData.Clear(); DataTable dt = new DataTable(); if (vt == ViewType.TheDay) { dt = Histroy.GetDataTale(DateTime.Now); } else if (vt == ViewType.Yesterday) { dt = Histroy.GetDataTale(DateTime.Now.AddDays(-1)); } else if (vt == ViewType.TheMonth) { dt = Histroy.GetDataTale(DateTime.Now.ToString("MM")); } foreach (DataRow data in dt.Rows) { Flow f = new Flow(); int id = Convert.ToInt32(data[0]); string name = (string)data[1]; string path = (string)data[2]; UInt32 up = Convert.ToUInt32(data[3]); UInt32 down = Convert.ToUInt32(data[4]); UInt32 total = up + down; System.Drawing.Icon icon = null; try { icon = System.Drawing.Icon.ExtractAssociatedIcon(path); } catch (Exception e) { icon = new System.Drawing.Icon("program_icon.ico"); } f.id = id; f.name = name; f.path = path; f.up = up; f.down = down; f.icon = icon; //f.iconPath = icon; BindData.Add(f); } }
public static void systray_icon_setup() { if (systray_icon != null) return; systray_icon = new System.Windows.Forms.NotifyIcon(); systray_icon.Visible = true; systray_icon.Click += systray_icon_Click; dnd_icon = Properties.Resources.phone_dnd; normal_icon = Properties.Resources.phone; systrayicon_SetIcon(normal_icon); Broker.get_instance().DNDChanged += BrokerDNDChanged; }
private void LoadCustomBranding(Properties.Settings settings) { if (!String.IsNullOrWhiteSpace(settings.CustomAppIconPath) && System.IO.File.Exists(settings.CustomAppIconPath)) { System.Drawing.Icon ico = new System.Drawing.Icon(settings.CustomAppIconPath); this.Icon = ico; } if (!String.IsNullOrWhiteSpace(settings.CustomMainFormTitle)) { this.Text = settings.CustomMainFormTitle; } }
/// <summary> /// 返回ICO /// </summary> /// <param name="icoResxName"></param> /// <returns></returns> public System.Drawing.Icon GetIco(string icoResxName) { #region 返回ICO if (icoResxName.IsNullOrEmptyOrSpace()) return null; using (var stream = GetType().Assembly.GetManifestResourceStream("App.Resx.ICO." + icoResxName)) { if (stream == null) { return null; } var icon = new System.Drawing.Icon(stream); return icon.IsEmptyIcon() ? null : icon; } #endregion }
static ResourceElement CreateSerializedImage(Stream stream, string filename) { object obj; if (filename.EndsWith(".ico", StringComparison.OrdinalIgnoreCase)) obj = new System.Drawing.Icon(stream); else obj = new System.Drawing.Bitmap(stream); var serializedData = Serialize(obj); var userType = new UserResourceType(obj.GetType().AssemblyQualifiedName, ResourceTypeCode.UserTypes); var rsrcElem = new ResourceElement { Name = Path.GetFileName(filename), ResourceData = new BinaryResourceData(userType, serializedData), }; return rsrcElem; }
public static System.Drawing.Bitmap GetIconAsImage(string Name) { System.IO.Stream stm = typeof(ResourceManager).Assembly.GetManifestResourceStream(string.Format("NzbDrone.Core.{0}.ico", Name)); if (stm == null) return null; System.Drawing.Bitmap bmp; using (System.Drawing.Icon ico = new System.Drawing.Icon(stm)) { bmp = new System.Drawing.Bitmap(ico.Width, ico.Height); using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp)) { g.DrawIcon(ico, 0, 0); } } return bmp; }
public CmdActivate() : base(null, CAPTION, 0, null, MESSAGE, NAME, TOOLTIP) { try { base.m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("ISDUTLib.tm.ui.images.redlight.png")); } catch (Exception e) { System.Drawing.Icon icon = new System.Drawing.Icon(GetType().Assembly. GetManifestResourceStream("ISDUTLib.tm.ui.images.database.ico")); if (icon != null) { base.m_bitmap = icon.ToBitmap(); } } }
public MediaFile(string path) { if (!File.Exists(path)) throw new FileNotFoundException("The file added to FileItem was not found!", path); filePath = path; var fileInfo = new FileInfo(filePath); displayName = fileInfo.Name; m_fileLength = fileInfo.Length; var shinfo = new SHFILEINFO(); IntPtr hImg = NativeMethods.SHGetFileInfo(filePath, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), SHGFI_ICON | SHGFI_SMALLICON); //The icon is returned in the hIcon member of the shinfo struct fileIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon); }
public int AddIcon(System.Drawing.Icon icon) { int pos = ((ImageList)_imageLists[0]).Images.Count; //store current count -- new item's index if (ManageBothSizes == true) { //managing two lists, so add it to small first, then large ((ImageList)_imageLists[0]).Images.Add(icon); ((ImageList)_imageLists[1]).Images.Add(icon); } else { //only doing one size, so use IconSize as specified in _iconSize. ((ImageList)_imageLists[0]).Images.Add(icon); //add to image list } //AddExtension(extension.ToUpper(), pos); // add to hash table return(pos); }
// Public methods /// <summary> /// Returns a NotificationModel built by choosing a random key from mAllQuotesDictionary and /// a random quote from the key's associated List of quotes from mUnusedQuotesDictionary. /// </summary> /// <returns></returns> public NotificationModel GetRandomNotificationModel() { NotificationModel notification = new NotificationModel(); // Get a random Dictionary key to be used as the notification's Sender string key = GetRandomKey(); notification.Sender = key; // Get a random quote from key's List in the Dictionary notification.Message = GetRandomQuote(key); // Set notification.Icon based on sender System.Drawing.Icon icon = GetIconBySender(key); notification.Icon = icon; return(notification); }
public static System.Drawing.Icon LoadResourceIcon(string FileName, string IconName) { System.Drawing.Icon result = null; IntPtr File = LoadLibrary(FileName); if (File != null && File != IntPtr.Zero && File != (IntPtr)(-1)) { IconName += (char)0; IntPtr p_Icon = user32.LoadIcon(File, IconName); if (p_Icon != null && p_Icon != IntPtr.Zero) { result = System.Drawing.Icon.FromHandle(p_Icon); CloseHandle(p_Icon); } FreeLibrary(File); } return(result); }
private void LoadCustomIcon() { try { string file = Utils.GetPath(Global.CustomIconName); if (System.IO.File.Exists(file)) { Icon = new System.Drawing.Icon(file); return; } Icon = Properties.Resources.NotifyIcon1; } catch (Exception e) { Utils.SaveLog($"Loading custom icon failed: {e.Message}"); } }
private ImageSource ToImageSource(System.Drawing.Icon icon) { System.Drawing.Bitmap bitmap = icon.ToBitmap(); IntPtr hBitmap = bitmap.GetHbitmap(); ImageSource wpfBitmap = Imaging.CreateBitmapSourceFromHBitmap( hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); if (!DeleteObject(hBitmap)) { throw new Win32Exception(); } return(wpfBitmap); }
public void ShowIcon(string iconPath, string text = null, float dpi = _defaultDpi) { if (string.IsNullOrWhiteSpace(iconPath)) { throw new ArgumentNullException(nameof(iconPath)); } var iconResource = System.Windows.Application.GetResourceStream(new Uri(iconPath)); if (iconResource != null) { using (var iconStream = iconResource.Stream) { var icon = new System.Drawing.Icon(iconStream); ShowIcon(icon, text, dpi); } } }
private stdole.IPictureDisp getImage() { stdole.IPictureDisp tempImage = null; try { System.Drawing.Icon newIcon = Properties.Resources.MedPC; ImageList newImageList = new ImageList(); newImageList.Images.Add(newIcon); tempImage = ConvertImage.Convert(newImageList.Images[0]); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(tempImage); }
private void WebLogin_Click(object sender, RoutedEventArgs e) { this.WebLogin.IsEnabled = false; System.Drawing.Icon LoginIcon = null; var source = this.Icon as System.Windows.Media.Imaging.BitmapSource; if (source != null) { var bitmap = source.ToBitmap(); var hicon = bitmap.GetHicon(); LoginIcon = System.Drawing.Icon.FromHandle(hicon); } var authenticationContext = this.GetAuthenticationContext(); this.Hide(); authenticationContext.Parameters.EmbedTo = null; authenticationContext.Parameters.WindowTitle = "Log into Examples.Desktop app"; authenticationContext.Parameters.WindowIcon = LoginIcon; authenticationContext.AcquireTokenAsync().ContinueWith( (t) => { if (t.IsFaulted) { Debug.WriteLine("AcquireTokenAsync failed: " + t.Exception); } else { this.DisplayAuthenticationResult(t.Result); } if (LoginIcon != null) { Helper.DestroyIcon(LoginIcon.Handle); } this.WebLogin.IsEnabled = true; this.Show(); }, TaskScheduler.FromCurrentSynchronizationContext() ); }
private void LanzarConsulta() { Wsd.GetFacturasRecibidasPagos(_PetPagoFactRecEnviadas); // Muestro el xml de respuesta recibido de la AEAT en el web browser FormXmlViewer frmXmlViewer = new FormXmlViewer { Path = Settings.Current.InboxPath + _PetPagoFactRecEnviadas.GetReceivedFileName() }; //frmXmlViewer.ShowDialog(); // Obtengo la respuesta de facturas recibidas del archivo de // respuesta de la AEAT. RespuestaConsultaPagos respuesta = new Envelope(frmXmlViewer.Path).Body.RespuestaConsultaPagos; if (respuesta == null) { SoapFault msgError = new Envelope(frmXmlViewer.Path).Body.RespuestaError; if (msgError != null) { MessageBox.Show(msgError.FaultDescription, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } // Tenemos que recorrernos la respuesta y rellenar el datagrid con los datos de cada factura. grdInvoices.Rows.Clear(); if (respuesta.ResultadoConsulta == "ConDatos") { foreach (var invoice in respuesta.RegistroRespuestaConsultaPagos) { System.Drawing.Icon _marcaFact = MSeniorSII.Properties.Resources.Tag_Ok; decimal TotalTmp = Convert.ToDecimal(invoice.Pago.Importe, DefaultNumberFormatInfo); grdInvoices.Rows.Add(invoice.Pago.Fecha, TotalTmp.ToString("#,##0.00"), invoice.Pago.Medio, invoice.Pago.Cuenta_O_Medio, invoice, _marcaFact, invoice.DatosPresentacion.TimestampPresentacion); } } }
public static void LaunchBrowser(string url, Action <bool> success, System.Drawing.Icon icon = null) { var thread = new Thread(() => { var form = new System.Windows.Forms.Form(); if (icon != null) { form.Icon = icon; } var browser = new System.Windows.Forms.WebBrowser { ScriptErrorsSuppressed = true, Dock = DockStyle.Fill }; form.SuspendLayout(); form.Width = 568; form.Height = 1012; form.Text = $"Authenticate"; form.Controls.Add(browser); form.ResumeLayout(false); form.FormClosed += (sender, args) => { success(false); }; browser.Navigated += (sender, args) => { if (browser.Url.AbsoluteUri.Equals("https://login.microsoftonline.com/common/login", StringComparison.InvariantCultureIgnoreCase) || browser.Url.AbsoluteUri.StartsWith("https://login.microsoftonline.com/common/reprocess", StringComparison.InvariantCultureIgnoreCase)) { form.Close(); success(true); } }; browser.Navigate(url); form.Focus(); form.ShowDialog(); browser.Dispose(); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); }
public static void OpenBrowser(string url, Action <bool> success, System.Drawing.Icon icon = null) { var thread = new Thread(() => { var form = new System.Windows.Forms.Form(); if (icon != null) { form.Icon = icon; } var browser = new System.Windows.Forms.WebBrowser { ScriptErrorsSuppressed = true, Dock = DockStyle.Fill }; form.SuspendLayout(); form.Width = 568; form.Height = 1012; form.Text = $"Authenticate"; form.Controls.Add(browser); form.ResumeLayout(false); form.FormClosed += (sender, args) => { success(false); }; browser.Navigated += (sender, args) => { if (browser.DocumentText.Contains("You have signed in to the PnP Office 365 Management Shell application on your device. You may now close this window.")) { form.Close(); success(true); } }; browser.Navigate(url); form.Focus(); form.ShowDialog(); browser.Dispose(); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.SuspendLayout(); // // Form1 // this.ClientSize = new System.Drawing.Size(1198, 585); this.Name = "Form1"; this.ShowIcon = true; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Getting Started - Layout Modes"; this.ResumeLayout(false); try { System.Drawing.Icon ico = new System.Drawing.Icon(GetIconFile(@"common\Images\Grid\Icon\sfgrid.ico")); this.Icon = ico; } catch { } }
public static System.Drawing.Icon FromString(string iconName) { try { var iconPath = $"{GeneralAppInfo.HomePath}\\Icons\\{iconName}.ico"; if (System.IO.File.Exists(iconPath)) { var nI = new System.Drawing.Icon(iconPath); return(nI); } } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, $"Couldn\'t get Icon from String" + Environment.NewLine + ex.Message); } return(null); }
private static void Main(string[] args) { bool createdNew; channelName = String.Concat(WindowsIdentity.GetCurrent().Name, "@GmailNotifierPlus"); Program.Icon = Utilities.ResourceHelper.GetIcon("gmail-classic.ico"); String guid = "{421a0043-b2ab-4b86-8dec-63ce3b8bd764}"; String name = String.Concat(@"Local\GmailNotifierPlus", guid); using (new Mutex(true, name, out createdNew)) { if (!createdNew) { if (args.Length > 0) { CallRunningInstance(args); } } else { InitRemoting(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += Application_ThreadException; AppDomain appDomain = AppDomain.CurrentDomain; appDomain.UnhandledException += AppDomain_UnhandledException; try { Config.Init(); mainForm = new GmailNotifierPlus.Forms.Main(args); } catch (Exception e) { Application_ThreadException(null, new System.Threading.ThreadExceptionEventArgs(e)); } Application.Run(mainForm); } } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (icon != null) { icon.TrayBalloonTipClicked -= icon_TrayBalloonTipClicked; icon.TrayLeftMouseDown -= icon_TrayMouseDown; icon.TrayRightMouseDown -= icon_TrayMouseDown; icon.Dispose(); icon = null; } if (_icon != null) { _icon.Dispose(); _icon = null; } } }
public static System.Drawing.Icon FromString(string iconName) { try { var iconPath = $"{GeneralAppInfo.HomePath}\\Icons\\{iconName}.ico"; if (System.IO.File.Exists(iconPath)) { var nI = new System.Drawing.Icon(iconPath); return nI; } } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, $"Couldn\'t get Icon from String" + Environment.NewLine + ex.Message); } return null; }
/// <summary> /// The meat and potatoes of the get icon functions above. Gets an icon based on the /// given path and flags. Will attempt to fetch icons from Image Lists if they use /// those (eg: .lnk/.url files). /// </summary> /// <param name="path">The path to get the icon for.</param> /// <param name="flags">A bitfield representing flags to pass to /// <see cref="Trampolines.ShellGetFileInfo(string, FileAttributes, uint)"/></param> /// <param name="attribs">FileAttributes of the given path.</param> /// <returns>The requested icon.</returns> private static SDIcon GetIcon(string path, uint flags, FileAttributes attribs = 0) { (SHFILEINFO info, IntPtr list) = Trampolines.ShellGetFileInfo(path, attribs, flags); SDIcon icon = null; if (info.hIcon != IntPtr.Zero) { icon = SDIcon.FromHandle(info.hIcon).Clone() as SDIcon; DestroyIcon(info.hIcon); return(icon); } else if (list != IntPtr.Zero && info.iIcon != IntPtr.Zero) { icon = Trampolines.GetIconFromList(list, info.iIcon.ToInt32()); } return(icon); }
private void VentasDetalleRpt_Load(object sender, EventArgs e) { System.Drawing.Icon ico = Properties.Resources.icono_app; this.Text = " Ventas en detalle"; this.Icon = ico; this.ControlBox = true; FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; ReportParameter parameters = new ReportParameter("parametroLocal", nombreLocal); this.reportViewer1.ProcessingMode = ProcessingMode.Local; string path = Application.StartupPath + @"\Informes\VentasDetalle.rdlc"; this.reportViewer1.LocalReport.ReportPath = path; reportViewer1.LocalReport.DataSources.Add( new ReportDataSource("Dataset_informes", tblVentasDetalle)); this.reportViewer1.LocalReport.SetParameters(parameters); this.reportViewer1.RefreshReport(); this.WindowState = FormWindowState.Maximized; }
private void StartGame_StartGameFinish() { //自動最小化到工具列 System.Drawing.Icon icon = new System.Drawing.Icon(Application.StartupPath + "\\lol.ico"); ni.Icon = icon; ni.Visible = true; ni.ShowBalloonTip(3000, "", "遊戲啟動成功!", ToolTipIcon.None); if (Variable.curClient == "台服") { TwTools tt = new TwTools(); tt.Dispose(); } else { NaTools nt = new NaTools(); nt.Dispose(); } }
private void icon() { string path = System.IO.Path.GetFullPath(@"icon\icon.ico"); if (File.Exists(path)) { this.notifyIcon = new NotifyIcon(); this.notifyIcon.Text = "WhyFi_Surfer_Win"; System.Drawing.Icon icon = new System.Drawing.Icon(path);//程序图标 this.notifyIcon.Icon = icon; this.notifyIcon.Visible = true; notifyIcon.MouseDoubleClick += OnNotifyIconDoubleClick; notifyIcon.Visible = false; } }
public GraphicCell(int i, int j, MainForm papaForm, System.Drawing.Icon Icon) { this.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Location = new System.Drawing.Point(j * 50 + 30, i * 50 + 25); this.Size = new System.Drawing.Size(50, 50); this.UseVisualStyleBackColor = true; this.Icon = Icon; this.OriginalColor = i % 2 == j % 2 ? System.Drawing.Color.WhiteSmoke : System.Drawing.Color.Gray; papaForm.Controls.Add(this); this.Click += new System.EventHandler(this.OnClick); this.BackColor = OriginalColor; I = i; J = j; Papa = papaForm; }
public TaskBarIcon() { var attr = Assembly.GetExecutingAssembly().GetCustomAttribute <AssemblyTitleAttribute>(); Uri uri = new Uri("/AppIcon.ico", UriKind.Relative); var res = Application.GetResourceStream(uri); System.Drawing.Icon icon = new System.Drawing.Icon(res.Stream); NIcon = new System.Windows.Forms.NotifyIcon { Text = attr.Title, Icon = icon, }; NIcon.MouseClick += NIcon_MouseClick; NIcon.MouseDoubleClick += NIcon_MouseDoubleClick; NIcon.BalloonTipClicked += NIcon_BalloonTipClicked; }
private NotifyIconHandler(int itemCount, string inputText, System.Drawing.Icon icon, System.Action actMethod) { this.menu = new System.Windows.Forms.ContextMenu(); // Menu 객체 this.ni = new NotifyIcon(); for (int count = 0; count < itemCount; count++) { System.Windows.Forms.MenuItem item = new System.Windows.Forms.MenuItem(); item.Index = count; menu.MenuItems.Add(item); } this.ni.Icon = icon; this.ni.Visible = true; this.ni.DoubleClick += delegate(object senders, EventArgs args) // Tray icon의 더블 클릭 이벤트 등록 { actMethod(); }; this.ni.ContextMenu = this.menu; this.ni.Text = inputText; }
public static System.Drawing.Bitmap GetIconAsImage(string Name) { System.IO.Stream stm = typeof(ResourceManager).Assembly.GetManifestResourceStream(string.Format("NzbDrone.Core.{0}.ico", Name)); if (stm == null) { return(null); } System.Drawing.Bitmap bmp; using (System.Drawing.Icon ico = new System.Drawing.Icon(stm)) { bmp = new System.Drawing.Bitmap(ico.Width, ico.Height); using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp)) { g.DrawIcon(ico, 0, 0); } } return(bmp); }
public Navigation() { InitializeComponent(); m_owlIcons = new System.Drawing.Icon[6]; System.IO.Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl.ico")).Stream; m_owlIcons[0] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16)); iconStream.Dispose(); iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl_2.ico")).Stream; m_owlIcons[1] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16)); iconStream.Dispose(); iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl_4.ico")).Stream; m_owlIcons[2] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16)); iconStream.Dispose(); iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl_6.ico")).Stream; m_owlIcons[3] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16)); iconStream.Dispose(); iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl_8.ico")).Stream; m_owlIcons[4] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16)); iconStream.Dispose(); iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl_10.ico")).Stream; m_owlIcons[5] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16)); iconStream.Dispose(); m_notifyIcon = new System.Windows.Forms.NotifyIcon(); m_notifyIcon.BalloonTipText = "The app has been minimized. Click the tray icon to show."; m_notifyIcon.BalloonTipTitle = "Owl"; m_notifyIcon.Text = "Owl"; m_notifyIcon.Icon = m_owlIcons[0]; //System.Drawing.Icon as a Resource //new Icon(GetType(),"Icon1.ico"); //m_notifyIcon.Icon = new System.Drawing.Icon(new System.Uri("Media/owl.ico")); //new System.Drawing.Icon("D:\\Perso\\Dev\\littlebeagle\\LittleBeagle\\Media\\owl.ico"); m_notifyIcon.Click += new EventHandler(m_notifyIcon_Click); m_notifyIcon.MouseMove += new System.Windows.Forms.MouseEventHandler(m_notifyIcon_BalloonTipShown); ((Application.Current as App).JobItems).CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Job_CollectionChanged); m_hotkey = new KeyboardHandler(this); m_hotkey.HotKeyPressed += m_notifyIcon_Click; }
/// <summary> /// 加载托盘 /// </summary> public void LoadNotifyIcon() { var uri = new Uri(@"Resources\image\icon\2.ico", UriKind.Relative); var info = System.Windows.Application.GetResourceStream(uri); if (info.Stream.Length > 0) { this.MyNotifyIcon = new System.Windows.Forms.NotifyIcon(); this.MyNotifyIcon.BalloonTipText = "久易-进项票管家"; //设置程序启动时显示的文本 this.MyNotifyIcon.Text = "久易-进项票管家"; //最小化到托盘时,鼠标点击时显示的文本 System.Drawing.Icon icon = new System.Drawing.Icon(info.Stream); //程序图标 this.MyNotifyIcon.Icon = icon; this.MyNotifyIcon.Visible = true; this.MyNotifyIcon.MouseClick += OnNotifyIconClick; this.MyNotifyIcon.ShowBalloonTip(1000); } LoadNotifyContextMenu(); }
public DirectoryItem(string directoryPath) { if (!Directory.Exists(directoryPath)) { throw new FileNotFoundException("File yang ditambahkan tidak ditemukan !!", directoryPath); } pathDirektori = directoryPath; FileInfo fileInfo = new FileInfo(pathDirektori); displayName = fileInfo.Name; string[] files = Directory.GetFiles(pathDirektori); foreach (string file in files) { mediaItems.Add(new FileItem(file)); } string[] directories = Directory.GetDirectories(pathDirektori); foreach (string directory in directories) { mediaItems.Add(new DirectoryItem(directory)); } SHFILEINFO shinfo = new SHFILEINFO(); IntPtr hImg = Win32.SHGetFileInfo(pathDirektori, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON); if (shinfo.hIcon != null) { System.Drawing.IconConverter imageConverter = new System.Drawing.IconConverter(); System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(shinfo.hIcon); try { fileIconImage = (System.Drawing.Image) imageConverter.ConvertTo(icon, typeof(System.Drawing.Image)); } catch (NotSupportedException) { } Win32.DestroyIcon(shinfo.hIcon); } }
public void SetDefaultImage(System.Drawing.Icon icon) { lock (this) { if (_imageList == null) { return; } if (icon == null) { _defaultImageSpecified = false; } else { _AddImageInternal(icon, 0); } } }
public GeometryDisplayWindow(Geometry.Geometry geometry) : base(800, 600, new GraphicsMode(32, 24, 8, 8), "Mesh Viewer", GameWindowFlags.Default, DisplayDevice.Default, 3, 3, GraphicsContextFlags.ForwardCompatible) { this.geometry = geometry; camera.distanceFromCenter = (geometry.BoundingBox.Upper - geometry.BoundingBox.Lower).Length * 1.0f; camera.moveSpeed = (geometry.BoundingBox.Upper - geometry.BoundingBox.Lower).Length * 0.01f; camera.rotationSpeed = 0.01f; controller = new CameraController(camera); controller.Attach(this); var a = System.Reflection.Assembly.GetExecutingAssembly(); var st = a.GetManifestResourceStream("GeometryModes.Resources.Icon.ico"); var icnTask = new System.Drawing.Icon(st); Icon = icnTask; }
public System.Drawing.Icon [] GetIcon(String trayBarIcon) { System.Drawing.Icon [] icon = new System.Drawing.Icon[2]; switch (trayBarIcon) { case "NanoSlider": icon[0] = Properties.Resources.NanoSlider; icon[1] = Properties.Resources.NanoSliderDis; break; case "NanoBento": icon[0] = Properties.Resources.NanoBento; icon[1] = Properties.Resources.NanoBentoDis; break; case "NanoWavez": icon[0] = Properties.Resources.NanoWavez; icon[1] = Properties.Resources.NanoWavezDis; break; case "NanoMizu": icon[0] = Properties.Resources.NanoMizu; icon[1] = Properties.Resources.NanoMizuDis; break; case "NanoWhite": icon[0] = Properties.Resources.NanoWhite; icon[1] = Properties.Resources.NanoWhiteDis; break; case "NanoDynamic": icon[0] = Properties.Resources.NanoWhite; icon[1] = Properties.Resources.NanoWhiteDis; break; default: icon[0] = dynamicIcon; icon[1] = Properties.Resources.NanoSliderDis; break; } return(icon); }
private void MainWindow_OnCloseTrayWindow() { App.Current.Dispatcher.Invoke(() => { try { if (_trayIcon != null) { _trayIcon.Icon = _appIcon == null ? _appIcon = new System.Drawing.Icon(LogoIcon) : _appIcon; _iconFlashTimer.Stop(); _counter = 0; } _trayWin?.Hide(); } catch (Exception ex) { } }); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); m_BaseDir = System.Windows.Forms.Application.StartupPath; m_Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath); GlobalConfig.Instance = Config.LoadOrCreate(String.Concat(m_BaseDir, "\\hlaeconfig.xml")); GlobalUpdateCheck.Instance = new UpdateCheck(); ProcessCommandLine(); Application.Run(new MainForm()); GlobalConfig.Instance.BackUp(); GlobalUpdateCheck.Instance.Dispose(); }
public MainWindow() { _downloadIcons = new System.Drawing.Icon[] { ResourceHelper.GetIcon("/Images/news0.ico"), ResourceHelper.GetIcon("/Images/news1.ico"), ResourceHelper.GetIcon("/Images/news2.ico"), }; _downloadCompletedIcon = ResourceHelper.GetIcon("/Images/Ready.ico"); _iconAnimationTimer = new DispatcherTimer(); _iconAnimationTimer.Interval = new TimeSpan(0, 0, 0, 0, 500); _iconAnimationTimer.IsEnabled = false; _iconAnimationTimer.Tick += _iconAnimationTimer_Tick; App.AppContext.CheckForNewAdsStart += AppContext_CheckForNewAdsStart; App.AppContext.CheckForNewAdsComplete += AppContext_CheckForNewAdsComplete; InitializeComponent(); }
public NotifyIcon() { BalloonTitle = "DaxStudio"; //TODO - get current version for title Uri iconUri = new Uri("pack://application:,,,/DaxStudio.UI;component/Images/DaxStudio.Ico"); System.Drawing.Icon ico; using (var strm = Application.GetResourceStream(iconUri).Stream) { ico = new System.Drawing.Icon(strm); } Dispatcher.CurrentDispatcher.Invoke(new System.Action(() => { icon = new TaskbarIcon { Name = "NotifyIcon", Icon = ico, Visibility = Visibility.Collapsed }; icon.TrayBalloonTipClicked += icon_TrayBalloonTipClicked; icon.TrayLeftMouseDown += icon_TrayMouseDown; icon.TrayRightMouseDown += icon_TrayMouseDown; })); }
public MainWindow() { logging.TraceEvent(TraceEventType.Information, 1, "Starting up..."); settings.LoadSettings(); //setup icons icons[0] = System.Drawing.Icon.ExtractAssociatedIcon(Application.ResourceAssembly.Location); using (System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("MailChecker.Resources.blankicon.ico")) { icons[1] = new System.Drawing.Icon(stream); } logging.TraceEvent(TraceEventType.Information, 1, "Systray..."); InitializeSystray(); Resources["Accounts"] = settings.accountsDict; logging.TraceEvent(TraceEventType.Information, 1, "UI..."); InitializeComponent(); Worker workerObj = new Worker(settings, workerCancel.Token, this); Thread workerThread = new Thread(new ThreadStart(workerObj.processWork)); logging.TraceEvent(TraceEventType.Information, 1, "Worker..."); workerThread.Start(); settingsWindow.Icon = null; }
public TaskBarItem(string filePath, IEnumerable<ExtendedSystemWindow> windows, string title, System.Drawing.Icon icon, int predictedPosition) { _openWindows = new List<ExtendedSystemWindow>(); FullPath = filePath; _title = title; _icon = icon; Position = predictedPosition; if (windows != null && windows.Count() > 0) _openWindows.AddRange(windows); }
protected void Parse() { try { rawContents = System.IO.File.ReadAllText(mmcFileInfo.FullName, Encoding.Default); if (rawContents != null && rawContents.Trim() != "" && rawContents.StartsWith("<?xml")) { System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); xDoc.LoadXml(rawContents); System.Xml.XmlNode node = xDoc.SelectSingleNode("/MMC_ConsoleFile/StringTables/StringTable/Strings"); foreach (System.Xml.XmlNode cNode in node.ChildNodes) { string name = cNode.InnerText; if (name != "Favorites" && name != "Console Root") { Name = name; Parsed = true; break; } } //System.Xml.XmlNode binarynode = xDoc.SelectSingleNode("/MMC_ConsoleFile/BinaryStorage"); //foreach (System.Xml.XmlNode child in binarynode.ChildNodes) //{ // string childname = child.Attributes["Name"].Value; // if (childname.ToLower().Contains("small")) // { // string image = child.InnerText; // byte[] buff = System.Convert.FromBase64String(child.InnerText.Trim()); // System.IO.MemoryStream stm = new System.IO.MemoryStream(buff); // if (stm.Position > 0 && stm.CanSeek) stm.Seek(0, System.IO.SeekOrigin.Begin); // System.IO.File.WriteAllBytes(@"C:\Users\Administrator\Desktop\foo.ico", buff); // System.Drawing.Icon ico = new System.Drawing.Icon(stm); // } //} System.Xml.XmlNode visual = xDoc.SelectSingleNode("/MMC_ConsoleFile/VisualAttributes/Icon"); if (visual != null) { string iconFile = visual.Attributes["File"].Value; int index = Convert.ToInt32(visual.Attributes["Index"].Value); System.Drawing.Icon[] icons = IconHandler.IconHandler.IconsFromFile(iconFile, IconHandler.IconSize.Small); if (icons != null && icons.Length > 0) { if (icons.Length > index) { SmallIcon = icons[index]; } else { SmallIcon = icons[0]; } } } } } catch (Exception exc) { Logging.Error("Error parsing MMC File", exc); } }
public void ShowIcon(string iconPath, string text = null, float dpi = _defaultDpi) { if (string.IsNullOrWhiteSpace(iconPath)) throw new ArgumentNullException(nameof(iconPath)); var iconResource = System.Windows.Application.GetResourceStream(new Uri(iconPath)); if (iconResource != null) { using (var iconStream = iconResource.Stream) { var icon = new System.Drawing.Icon(iconStream); ShowIcon(icon, text, dpi); } } }
private void InitIcon() { this.all_sleep_ico_ = Properties.Resources.Allsleep; this.part_sleep_ico_ = Properties.Resources.PartSleep; this.none_sleep_ico_ = Properties.Resources.NoneSleep; }
public NotifyIconHandler(System.Drawing.Icon standardIcon, System.Drawing.Icon workingIcon) { StandardIcon = standardIcon; WorkingIcon = workingIcon; NotifyIcon = new System.Windows.Forms.NotifyIcon { BalloonTipText = "GitList", Icon = standardIcon, Visible = true}; var menu = new System.Windows.Forms.ContextMenu(); menu.MenuItems.Add("Show", delegate(object sender, EventArgs e) { NotifyDoubleClick(sender, null); }); menu.MenuItems.Add("Exit", delegate(object sender, EventArgs e) { Application.Current.Shutdown(); }); NotifyIcon.ContextMenu = menu; NotifyIcon.MouseDoubleClick += (sender, e) => NotifyDoubleClick(sender, e); NotifyIcon.BalloonTipClicked += (sender, e) => BalloonTipClick(sender, e); ShowAlert("GitList is running...", TimeSpan.FromSeconds(30)); AutoShowInSystemTray(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VerInfoForm)); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // pictureBox1 // System.Drawing.Icon ico = new System.Drawing.Icon(Properties.Resources.Icon, 64, 64); System.Drawing.Bitmap bmp = ico.ToBitmap(); this.pictureBox1.Image = bmp; this.pictureBox1.Location = new System.Drawing.Point(12, 12); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(64, 64); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(82, 12); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(0, 12); this.label1.TabIndex = 1; // // button1 // this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; this.button1.Location = new System.Drawing.Point(247, 53); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 2; this.button1.Text = "OK"; this.button1.UseVisualStyleBackColor = true; // // VerInfoForm // this.AcceptButton = this.button1; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(334, 92); this.Controls.Add(this.button1); this.Controls.Add(this.label1); this.Controls.Add(this.pictureBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "VerInfoForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "バージョン情報"; this.Load += new System.EventHandler(this.VerInfoForm_Load); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
public HostWindow() { InitializeComponent(); lblVersion.Content = "BlipFace v"+ Settings.Default.Version.Substring(0,5); //położenie okna //this.Left = System.Windows.SystemParameters.PrimaryScreenWidth - this.Width - 20; //ikona dla aplikacji, pozakuje się na pasku //blipFace_logo_round.png" Uri iconUri = new Uri("pack://application:,,,/Resource/Img/blipFace.ico", UriKind.RelativeOrAbsolute); this.Icon = BitmapFrame.Create(iconUri); normalNotifyIcon = IconFromResource(iconUri.ToString()); statusAddedNotifyIcon = IconFromResource("pack://application:,,,/Resource/Img/blipFaceNewStatus.ico"); taskbarIcon.Icon = normalNotifyIcon; //ustawienie ikony w tray'u kiedy jest ustawiona opcja aby była ona tam ciągle if (Properties.Settings.Default.AlwaysInTray) ChangeIconInTray(IconInTrayState.Normal); mgr = new ViewsManager(this); //gdy zmienią się ustawienia aplikacji trzeba ustawić odpowiednie elementy okna //todo:trzeba pomyśleć jak to zrobić inaczej Properties.Settings.Default.PropertyChanged += new PropertyChangedEventHandler(Default_PropertyChanged); currentState = BlipFaceWindowsState.Normal; }
public MainWindow() { InitializeComponent(); m_app_running = new System.Drawing.Icon(Directory.GetParent(Assembly.GetExecutingAssembly().Location) + "\\Images\\autosnapshotRunning.ico"); m_app_not_running = new System.Drawing.Icon(Directory.GetParent(Assembly.GetExecutingAssembly().Location) + "\\Images\\autosnapshotNotRunning.ico"); m_app_exporting = new System.Drawing.Icon(Directory.GetParent(Assembly.GetExecutingAssembly().Location) + "\\Images\\autosnapshotBusy.ico"); }