Example #1
0
        /// <summary>
        /// 绑定新闻
        /// </summary>
        /// <param name="id"></param>
        private void BindStockNews(String id)
        {
            object       data     = StockNewsDataHelper.GetNewsById(id, "0", "100", "desc", "");
            NewsListRoot newsRoot = JsonConvert.DeserializeObject <NewsListRoot>(data.ToString());

            m_gridAllStockNews.ClearRows();
            foreach (NewsListNode stockNew in newsRoot.records)
            {
                GridRow row = new GridRow();
                m_gridAllStockNews.AddRow(row);
                row.Tag = stockNew;
                row.AddCell("colN1", new GridStringCell(stockNew.Date));
                row.AddCell("colN2", new GridStringCell(stockNew.Title));
                row.AddCell("colN3", new GridStringCell(stockNew.url));
                row.AddCell("colN4", new GridStringCell(stockNew.Id));
                row.GetCell("colN1").Style           = new GridCellStyle();
                row.GetCell("colN1").Style.ForeColor = COLOR.ARGB(255, 255, 80);
                row.GetCell("colN2").Style           = new GridCellStyle();
                row.GetCell("colN2").Style.ForeColor = COLOR.ARGB(255, 80, 80);
                row.GetCell("colN3").Style           = new GridCellStyle();
                row.GetCell("colN3").Style.ForeColor = COLOR.ARGB(255, 80, 255);
            }
            m_gridAllStockNews.Update();
            m_gridAllStockNews.Invalidate();
        }
Example #2
0
        /// <summary>
        /// 创建新闻
        /// </summary>
        public AllStockNews(MainFrame mainFrame)
        {
            m_mainFrame        = mainFrame;
            m_gridAllStockNews = mainFrame.GetGrid("gridAllStockNews");
            m_gridAllStockNews.GridLineColor      = COLOR.EMPTY;
            m_gridAllStockNews.BackColor          = COLOR.ARGB(0, 0, 0);
            m_gridAllStockNews.RowStyle           = new GridRowStyle();
            m_gridAllStockNews.RowStyle.BackColor = COLOR.ARGB(0, 0, 0);
            m_gridAllStockNews.RegisterEvent(new GridCellMouseEvent(GridCellClick), EVENTID.GRIDCELLCLICK);
            m_tvAllStockNews                    = mainFrame.GetTree("tvAllStockNews");
            m_tvAllStockNews.BackColor          = COLOR.ARGB(0, 0, 0);
            m_tvAllStockNews.ForeColor          = COLOR.ARGB(255, 255, 255);
            m_tvAllStockNews.RowStyle           = new GridRowStyle();
            m_tvAllStockNews.RowStyle.BackColor = COLOR.ARGB(0, 0, 0);
            m_tvAllStockNews.RegisterEvent(new GridCellMouseEvent(GridCellClick), EVENTID.GRIDCELLCLICK);
            object       data     = StockNewsDataHelper.GetLeftTree("F888011");
            NewsTypeRoot newsRoot = JsonConvert.DeserializeObject <NewsTypeRoot>(data.ToString());

            foreach (NewsTypeNode node in newsRoot.NodeList)
            {
                if (node.NodeList != null && node.NodeList.Count > 0)
                {
                    TreeNodeA tn = new TreeNodeA();
                    tn.Style           = new GridCellStyle();
                    tn.Style.ForeColor = COLOR.ARGB(255, 255, 255);
                    tn.Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                    tn.Text            = node.Name;
                    m_tvAllStockNews.AppendNode(tn);
                    foreach (NewsTypeNode subNode in node.NodeList)
                    {
                        TreeNodeA subTn = new TreeNodeA();
                        subTn.Text            = subNode.Name;
                        subTn.Style           = new GridCellStyle();
                        subTn.Style.ForeColor = COLOR.ARGB(255, 255, 255);
                        subTn.Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                        tn.AppendNode(subTn);
                        subTn.Tag = subNode.Id;
                    }
                }
            }
            BindStockNews("S888005001");
            m_tvAllStockNews.Update();
        }