コード例 #1
0
ファイル: WorkerForm.cs プロジェクト: temyahater/INTest
        public WorkerForm(MainForm GetBackForm, string TableName)
        {
            const int captionHeight = 25;

            InitializeComponent();

            BackColor = Color.FromArgb(106, 90, 205);

            var topPanel = new Panel();

            topPanel.Height     = captionHeight;
            topPanel.Width      = ClientSize.Width;
            topPanel.BackColor  = Color.FromArgb(72, 61, 139);
            topPanel.MouseDown += TitleMouseDown;

            var exitBtn = new Button();

            exitBtn.Text      = "";
            exitBtn.TextAlign = ContentAlignment.MiddleCenter;
            exitBtn.Height    = 15;
            exitBtn.Width     = 15;
            exitBtn.Left      = ClientSize.Width - exitBtn.Width - 5;
            exitBtn.Top       = 5;
            exitBtn.Click    += exitButton;
            exitBtn.FlatStyle = FlatStyle.Flat;
            exitBtn.FlatAppearance.BorderSize = 0;
            exitBtn.BackColor = Color.FromArgb(220, 20, 60);
            exitBtn.ForeColor = Color.FromArgb(255, 255, 255);

            var capt = new Label();

            capt.Left       = 5;
            capt.Top        = 5;
            capt.Height     = topPanel.Height - capt.Top;
            capt.Width      = exitBtn.Left - capt.Left;
            capt.Text       = TableName;
            capt.ForeColor  = Color.White;
            capt.BackColor  = topPanel.BackColor;
            capt.MouseDown += TitleMouseDown;

            Controls.Add(capt);
            Controls.Add(exitBtn);
            Controls.Add(topPanel);

            mainForm = GetBackForm;
            dbi      = new DataBaseInformation(TableName);
            UpdateAllSQL("Select * from [" + TableName + "]");
        }
コード例 #2
0
        public EditAddForm(DataBaseInformation dbi, EditAddOperation operation,
                           string PrimaryKeyValue = "")
        {
            InitializeComponent();
            this.operation       = operation;
            this.PrimaryKeyValue = PrimaryKeyValue;
            this.Text            = dbi.TableName;
            this.dbi             = dbi;

            this.dbi.Update("Select * from [" + dbi.TableName + "] where [" + dbi.PrimaryKeys[0] +
                            "] = \'" + PrimaryKeyValue + "\'");

            initInputs();
            Generate();
            if (operation == EditAddOperation.Edit)
            {
                FillFields();
            }
        }
コード例 #3
0
        public CheckForeignForm(string tableName, string command, string key = "")
        {
            const int captionHeight = 25;

            InitializeComponent();

            //Shitty:dddd
            var topPanel = new Panel();

            topPanel.Height     = captionHeight;
            topPanel.Width      = ClientSize.Width;
            topPanel.BackColor  = Color.FromArgb(72, 61, 139);
            topPanel.MouseDown += TitleMouseDown;

            var exitBtn = new Button();

            exitBtn.Text      = "";
            exitBtn.TextAlign = ContentAlignment.MiddleCenter;
            exitBtn.Height    = 15;
            exitBtn.Width     = 15;
            exitBtn.Left      = ClientSize.Width - exitBtn.Width - 5;
            exitBtn.Top       = 5;
            exitBtn.Click    += exitButton;
            exitBtn.FlatStyle = FlatStyle.Flat;
            exitBtn.FlatAppearance.BorderSize = 0;
            exitBtn.BackColor = Color.FromArgb(220, 20, 60);
            exitBtn.ForeColor = Color.FromArgb(255, 255, 255);
            //

            var capt = new Label();

            capt.Left       = 5;
            capt.Top        = 5;
            capt.Height     = topPanel.Height - capt.Top;
            capt.Width      = exitBtn.Left - capt.Left;
            capt.Text       = tableName;
            capt.ForeColor  = Color.White;
            capt.BackColor  = topPanel.BackColor;
            capt.MouseDown += TitleMouseDown;

            Controls.Add(capt);
            Controls.Add(exitBtn);
            Controls.Add(topPanel);

            dbi      = new DataBaseInformation(tableName);
            Text     = tableName;
            this.key = key;
            UpdateDataGridViewSQL(command);

            if (key != "")
            {
                foreach (DataGridViewRow row in gridOutput.Rows)
                {
                    if (row.Cells[dbi.PrimaryKeys[0]].Value.ToString() == key)
                    {
                        for (int i = 0; i < row.Cells.Count; i++)
                        {
                            if (row.Cells[i].Visible)
                            {
                                gridOutput.CurrentCell = row.Cells[i];
                                return;
                            }
                        }
                    }
                }
            }
        }