/* '============================================================================== ' Method: ButHide_Click ' ' Description: Cool function used to hide any icon from system tray icon ' then refresh the FlexGrid control. '============================================================================== */ private void ButHide_Click(object sender, System.EventArgs e) { short RowSelected = (short)MSFlexGrid1.RowSel; ASTC.TrayIconInfo[] TrayInfo = new ASTC.TrayIconInfo[100]; TrayInfo = (ASTC.TrayIconInfo[])axTrayList1.GetSysTrayIcons(); //Save the Icon Info before Remove it in order to use //when we restore the icon OldTrayInfo = TrayInfo[RowSelected - 1]; //Hide the selected Item from the System Tray area axTrayList1.HideIcon(ref RowSelected); //Clear the FlexGrid MSFlexGrid1.Clear(); //fill the FlexGrid FillFlexGrid(); }
/* '============================================================================== ' Method: FillFlexGrid ' ' Description: The core function here we get the information from GetSysTrayIcons ' then fill the FlexGrid control with these info. '============================================================================== */ private void FillFlexGrid() { ASTC.TrayIconInfo[] TrayInfo = new ASTC.TrayIconInfo[100]; initFlexGrid(); //Get the System Tray Data TrayInfo = (ASTC.TrayIconInfo[])axTrayList1.GetSysTrayIcons(); //Fill the FlexGrid with Data for (int i = 0; i != (int)axTrayList1.IconCount; i++ ) { int count = i + 1; MSFlexGrid1.set_TextMatrix(i + 1, 0, count.ToString() ); if (TrayInfo[i].APath == "") { MSFlexGrid1.set_TextMatrix(i + 1, 1, "N/A"); } else { MSFlexGrid1.set_TextMatrix(i + 1, 1, TrayInfo[i].APath); } MSFlexGrid1.set_TextMatrix(i + 1, 2, TrayInfo[i].uId.ToString() ); MSFlexGrid1.set_TextMatrix(i + 1, 3, TrayInfo[i].hwnd.ToString() ); MSFlexGrid1.set_TextMatrix(i + 1, 4, TrayInfo[i].hIcon.ToString() ); MSFlexGrid1.set_TextMatrix(i + 1, 5, TrayInfo[i].ToolTip.ToString() ); MSFlexGrid1.set_TextMatrix(i + 1, 6, TrayInfo[i].ucallbackMessage.ToString()); } }