Ejemplo n.º 1
0
        //既存セットを編集するときのインスタンス処理
        public addEditForm(IQueryable <SetTitle> setTitles, IQueryable <StartupProg> startupProgs)
        {
            InitializeComponent();
            Console.WriteLine($"setTitle_numData = {setTitles.Count()}");
            Console.WriteLine($"startupProgs_numData = {startupProgs.Count()}");
            foreach (var setTitle in setTitles)            //setTitlesの中身は1つのみ
            {
                setTitleId           = setTitle.SetTitleId;
                settitleTextBox.Text = setTitle.TitleName;
            }
            foreach (var startupProg in startupProgs)
            {
                string program_name = startupProg.StartupProgName;
                string program_path = startupProg.StartupProgPath;
                CreateComponentCluster(program_name, program_path);
            }

            //削除ボタン作成
            string       DELETEBUTTON_NAME = $"deleteButton";
            const string DELETEBUTTON_TEXT = "削除";
            int          DELETEBUTTON_TAG  = -1;

            int[] DELETEBUTTON_LOCATE =
            {
                31,
                404
            };
            int[] DELETEBUTTON_SIZE =
            {
                112,
                34
            };

            //削除ボタン作成
            Button deleteButton = CreateTools.createButton(DELETEBUTTON_NAME, DELETEBUTTON_TEXT, DELETEBUTTON_TAG, DELETEBUTTON_LOCATE, DELETEBUTTON_SIZE, this);

            deleteButton.Click       += deleteButton_Click;
            deleteButton.DialogResult = DialogResult.OK;

            isAdd   = false;
            isValid = true;
        }
Ejemplo n.º 2
0
        private void CreateComponentCluster(string program_name = "", string program_path = "")
        {
            //prognameLabel
            string    PNLABEL_NAME   = $"prognameLabel{numberofProgram}";
            string    PNLABEL_TEXT   = $"{numberofProgram + 1}. プログラム名";
            const int PNLABEL_OFFSET = 100;

            int[] PNLABEL_LOCATE =
            {
                204,                                                                //X座標
                PNLABEL_OFFSET *numberofProgram + allProgPanel.AutoScrollPosition.Y //Y座標
            };

            //pathLabel
            string       PATHLABEL_NAME   = $"pathLabel{numberofProgram}";
            const string PATHLABEL_TEXT   = "パス";
            const int    PATHLABEL_OFFSET = 100;

            int[] PATHLABEL_LOCATE =
            {
                423,                                                                  //X座標
                PATHLABEL_OFFSET *numberofProgram + allProgPanel.AutoScrollPosition.Y //Y座標
            };

            //prognameTextBox
            string    PNBOX_NAME         = $"prognameTextBox{numberofProgram}";
            const int PNBOX_OFFSET       = 100;       //テキストボックス間の距離(Y)
            const int PNBOX_FIRST_OFFSET = 28;        //Panelと最上部のテキストボックスとの距離(Y)

            int[] PNBOX_LOCATE =
            {
                204,                                                                                   //X座標
                PNBOX_OFFSET *numberofProgram + PNBOX_FIRST_OFFSET + allProgPanel.AutoScrollPosition.Y //Y座標
            };
            int[] PNBOX_SIZE =
            {
                150,               //テキストボックス幅
                31                 //テキストボックス高さ
            };

            //pathTextBox
            string    PATHBOX_NAME         = $"pathTextBox{numberofProgram}";
            const int PATHBOX_OFFSET       = 100;
            const int PATHBOX_FIRST_OFFSET = 28;             //Panelと最上部のテキストボックスとの距離(Y)

            int[] PATHBOX_LOCATE =
            {
                423,                                                                                       //X座標
                PATHBOX_OFFSET *numberofProgram + PATHBOX_FIRST_OFFSET + allProgPanel.AutoScrollPosition.Y //Y座標
            };
            int[] PATHBOX_SIZE =
            {
                150,               //テキストボックス幅
                31                 //テキストボックス高さ
            };

            //progRefeButton
            string       PRBUTTON_NAME         = $"progRefeButton{numberofProgram}";
            const string PRBUTTON_TEXT         = "参照";
            int          PRBUTTON_TAG          = numberofProgram;
            const int    PRBUTTON_OFFSET       = 100;
            const int    PRBUTTON_FIRST_OFFSET = 28;

            int[] PRBUTTON_LOCATE =
            {
                579,
                PRBUTTON_OFFSET *numberofProgram + PRBUTTON_FIRST_OFFSET + allProgPanel.AutoScrollPosition.Y
            };
            int[] PRBUTTON_SIZE =
            {
                74,
                31
            };

            CreateTools.createLabel(PNLABEL_NAME, PNLABEL_TEXT, PNLABEL_LOCATE, allProgPanel);
            CreateTools.createLabel(PATHLABEL_NAME, PATHLABEL_TEXT, PATHLABEL_LOCATE, allProgPanel);
            TextBox prognameTextBox = CreateTools.createTextBox(PNBOX_NAME, PNBOX_LOCATE, PNBOX_SIZE, allProgPanel);

            prognameTextBox.Text               = program_name;
            prognameTextBox.Validating        += prognameTextBox_Validating;
            prognameTextBoxes[numberofProgram] = prognameTextBox;
            TextBox pathTextBox = CreateTools.createTextBox(PATHBOX_NAME, PATHBOX_LOCATE, PATHBOX_SIZE, allProgPanel);

            pathTextBox.Text               = program_path;
            pathTextBox.Validating        += pathTextBox_Validating;
            pathTextBoxes[numberofProgram] = pathTextBox;
            Button button = CreateTools.createButton(PRBUTTON_NAME, PRBUTTON_TEXT, PRBUTTON_TAG, PRBUTTON_LOCATE, PRBUTTON_SIZE, allProgPanel);

            button.Click += progRefeButton_Click;

            numberofProgram++;
            return;
        }
Ejemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)         //InitForm起動時、1回のみ呼び出される
        {
            Console.WriteLine("Form1: Loaded");
            using (var db = new SetTitleDbContext())
            {
                var queryAllSetTiles = from setTitle in db.SetTitles
                                       select setTitle;
                int numberofData = 0;                 //クエリで取得したデータの個数
                foreach (var data in queryAllSetTiles)
                {
                    string    TITLELABEL_NAME   = "";
                    string    TITLELABEL_TEXT   = "";
                    const int TITLELABEL_OFFSET = 0;
                    int[]     TITLELABEL_LOCATE = new int[2] {
                        0, 0
                    };
                    int TITLELABEL_TAG = data.SetTitleId;

                    string       STARTUPBUTTON_NAME   = $"startupButton{numberofData}";
                    const string STARTUPBUTTON_TEXT   = "起動";
                    const int    STARTUPBUTTON_OFFSET = 0;
                    int[]        STARTUPBUTTON_LOCATE = new int[2] {
                        0, 0
                    };
                    int[] STARTUPBUTTON_SIZE = new int[2] {
                        112, 34
                    };
                    int STARTUPBUTTON_TAG = data.SetTitleId;

                    numberofData++;

                    if (numberofData % 2 == 1)                     //奇数番目の場合、フォームの左側に表示
                    {
                        //titleLabel
                        TITLELABEL_NAME   = $"titleLabel{numberofData}";
                        TITLELABEL_TEXT   = data.TitleName;
                        TITLELABEL_LOCATE = new int[2] {
                            88, 67 * (numberofData / 2 + 1)
                        };

                        //startupButton
                        STARTUPBUTTON_NAME   = $"startupButton{numberofData}";
                        STARTUPBUTTON_LOCATE = new int[2] {
                            215, 67 * (numberofData / 2 + 1)
                        };
                    }
                    else                     //偶数番目の場合、フォームの右側に表示
                    {
                        //titleLabel
                        TITLELABEL_NAME   = $"titleLabel{numberofData}";
                        TITLELABEL_TEXT   = data.TitleName;
                        TITLELABEL_LOCATE = new int[2] {
                            422, 67 * (numberofData / 2)
                        };

                        //startupButton
                        STARTUPBUTTON_NAME   = $"startupButton{numberofData}";
                        STARTUPBUTTON_LOCATE = new int[2] {
                            549, 67 * (numberofData / 2)
                        };
                    }
                    LinkLabel titleLabel = CreateTools.createLinkLabel(TITLELABEL_NAME, TITLELABEL_TEXT, TITLELABEL_LOCATE, panel1);
                    titleLabel.Tag          = TITLELABEL_TAG;
                    titleLabel.Font         = new Font("Yu Gothic UI", 9);
                    titleLabel.LinkClicked += titleLabel_LinkClick;

                    Button startupButton = CreateTools.createButton(STARTUPBUTTON_NAME, STARTUPBUTTON_TEXT, STARTUPBUTTON_TAG, STARTUPBUTTON_LOCATE, STARTUPBUTTON_SIZE, panel1);
                    startupButton.Tag    = STARTUPBUTTON_TAG;
                    startupButton.Click += startupButton_Click;
                }
            }
            return;
        }