Beispiel #1
0
        private void TypeList_comboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            //更新界面中的显示
            if (Flag)
            {
                ActivityList_flowLayoutPanel.Controls.Clear();
                ActivityItem_flowLayoutPanel.Controls.Clear();

                //创建按钮
                KeyValuePair <int, Dictionary <int, string> > kvp = ((KeyValuePair <int, Dictionary <int, string> >)TypeList_comboBox.SelectedItem);
                Dictionary <int, string> dic = kvp.Value;
                int nCount = dic.Count;
                for (int i = 0; i < nCount; i++)
                {
                    Button btn      = new Button();
                    string luaTable = dic[i + 1];
                    if (luaTable != null)
                    {
                        //设置button背景
                        string ImagePath = mfo.GetImagePathByControl(GamePath, mfo.GetControlText(GamePath), mre.GetTabConfigTitleByItem(luaTable), 1);

                        if (ImagePath != "")
                        {
                            //设置button边框样式
                            btn.FlatStyle = FlatStyle.Flat;
                            btn.FlatAppearance.BorderSize = 0;
                            btn.BackgroundImage           = Image.FromFile(ImagePath);
                            btn.Height = btn.BackgroundImage.Height;
                            btn.Width  = btn.BackgroundImage.Width;
                            btn.BackgroundImageLayout = ImageLayout.Stretch;
                        }
                        else
                        {
                            //读取不到图片
                            //判断button代表的类型,设置button文字
                            btn.Text = mre.GetLuaTableType(luaTable);
                        }
                        btn.Tag = mre.GetLuaTableType(luaTable);
                    }
                    btn.Click += TypeList_Btn_Click;
                    ActivityList_flowLayoutPanel.Controls.Add(btn);
                }
            }
        }
Beispiel #2
0
        private void ActivityItemForm_Load(object sender, EventArgs e)
        {
            Form form = sender as Form;
            MyRegularExpression mre = new MyRegularExpression();
            MyFilesOpration     mfo = new MyFilesOpration();
            string ImagePath        = mfo.GetImagePathByControl(GamePath, mfo.GetControlText(GamePath), mre.GetTaskListIcoByItem(TableText), 0);

            //设置图标
            if (ImagePath != "")
            {
                //设置button边框样式
                label_activity.BackgroundImage = Image.FromFile(ImagePath);
                label_activity.Height          = label_activity.BackgroundImage.Height;
                label_activity.Width           = label_activity.BackgroundImage.Width;
            }
            //读取不到图片
            else
            {
                //判断button代表的类型,设置button文字
                label_activity.Text = TaskId;
            }

            //标题文字
            Title_label.Text = mre.GetTaskListTitleByItem(TableText);

            //推荐图标
            if (mre.GetTaskListRecommendByItem(TableText))
            {
                Recommend_label.Visible = true;
            }

            //人数文字
            if (mre.GetTaskListTeamNumStrByItem(TableText) != "")
            {
                TeamNumStr_label.Text = mre.GetTaskListTeamNumStrByItem(TableText);
            }

            //展示物品组
        }