Exemple #1
0
        //几处重载,用于显示返回的数据
        private void panel_load(Data.Cut_sentence_result result)
        {
            int height = 0;

            foreach (var potential in result.potentials)
            {
                foreach (var command in potential)
                {
                    foreach (var sen in command)
                    {
                        Label label = new Label();
                        label.Text     = sen.sen;
                        label.Location = new Point(0, height);
                        label.AutoSize = true;
                        height        += label.Height;
                        tabPage1.Controls.Add(label);
                    }
                }
            }
        }
        public static void Set_sentences(Panel panel, Data.Cut_sentence_result cut)
        {
            int number = 0;

            foreach (var potential in cut.potentials)
            {
                foreach (var command in potential)
                {
                    foreach (var sentence in command)
                    {
                        Button button = new Button();
                        button.Text      = sentence.sen;
                        button.TextAlign = ContentAlignment.MiddleLeft;
                        button.Tag       = number;
                        button.Width     = panel.Width;
                        button.Anchor    = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
                        button.Location  = new Point(0, number * button.Height);
                        button.Paint    += button_Paint;
                        panel.Controls.Add(button);
                        number++;
                    }
                }
            }
        }