Esempio n. 1
0
        /// <summary>
        /// 调用控件线程方法
        /// </summary>
        /// <param name="sender">调用者</param>
        /// <param name="args">参数</param>
        private void Invoke(object sender, object args)
        {
            CMessage     message = (CMessage)args;
            List <Macro> macros  = new List <Macro>();

            m_macroService.GetMacros(macros);
            GridRow row        = null;
            int     macrosSize = macros.Count;

            for (int i = 0; i < 20; i++)
            {
                if (i < 10)
                {
                    row = GetRow(1);
                }
                else
                {
                    row = GetRow(0);
                }
                int col = i;
                if (i >= 10)
                {
                    col -= 10;
                }
                GridIconCell iconCell = row.GetCell(col) as GridIconCell;
                if (i < macrosSize)
                {
                    Macro macro = macros[i];
                    iconCell.ID = macro.m_macroID;
                    iconCell.SetString(macro.m_icon);
                }
                else
                {
                    iconCell.ID = "";
                    iconCell.SetString("");
                }
            }
            Update();
            Invalidate();
        }
Esempio n. 2
0
        /// <summary>
        /// 加载图标
        /// </summary>
        private void LoadIcons()
        {
            String dir = DataCenter.GetAppPath() + "\\config\\icons\\";

            m_gridIcons.ResourcePath = dir;
            List <String> files = new List <String>();

            CFileA.GetFiles(dir, files);
            int filesSize   = files.Count;
            int columnsSize = m_gridIcons.GetColumns().Count;

            m_gridIcons.BeginUpdate();
            GridRow row = null;

            for (int i = 0; i < filesSize; i++)
            {
                int col = i;
                if (i >= columnsSize)
                {
                    col = i % columnsSize;
                }
                if (col == 0)
                {
                    row        = new GridRow();
                    row.Height = 64;
                    m_gridIcons.AddRow(row);
                }
                String file = files[i];
                file = file.Substring(file.LastIndexOf('\\') + 1);
                GridIconCell iconCell = new GridIconCell();
                iconCell.SetString(file);
                row.AddCell(col, iconCell);
            }
            m_gridIcons.EndUpdate();
            m_gridIcons.Invalidate();
        }