Esempio n. 1
0
        private void AddNewHistory(string str1, string str2)
        {
            History his = new History(str1, str2);

            his.Click        += new System.EventHandler(this.History_Click);
            his.label1.Click += new System.EventHandler(this.History_Click);
            his.label2.Click += new System.EventHandler(this.History_Click);
            his.Leave        += new System.EventHandler(this.History_Leave);
            flpHistory.Controls.Add(his);
            flpHistory.ScrollControlIntoView(his);
            this.btnTrash.Visible = true;
        }
Esempio n. 2
0
        /// <summary>
        /// 将Note添加在面板的指定位置
        /// </summary>
        /// <param name="flp"></param>
        /// <param name="text"></param>
        public static void AddLabelToLocation(FlowLayoutPanel flp, Model.PostContents.PostContent post)
        {
            int labelCount = flp.Controls.Count;
            LabelExSolidBorder le = new LabelExSolidBorder();//此处可变更LabelEx样式,可配置
            int flag = 0;
            int X = LOCATION_X;
            int Y = CONTENT_MARGIN;
            if (labelCount == 0)
            {
                le.BackColor = ColorTranslator.FromHtml(ColorManager.ColorConvertor(flag));
                flag++;
            }
            for (int i = 0; i < labelCount; i++)
            {
                flag++;
                Y += CONTENT_HEIGHT;
                Y += CONTENT_MARGIN;
                le.BackColor = ColorTranslator.FromHtml(ColorManager.ColorConvertor(flag));

                if (flag > 19)
                {
                    flag = 0;
                }
            }

            le.Location = new Point(X, Y);
            le.Text = post.Content;
            le.Tag = post;
            flp.Controls.Add(le);
            flp.ScrollControlIntoView(le);
        }