YL
2022-02-21 a905b3df0d0c9ae045b51d1299fbb2f2dcbc2e2d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
 
namespace Pub_Control
{
    public partial class frmDownMenu_yt : Form
    {
        public frmDownMenu_yt()
        {
            InitializeComponent();
        }
 
        public int x;
        public int y;
        public int isOk;
        public string sWhere;
        public string sTitle;
        public Pub_Class.ClsPub.Enum_OKTag OKTag;
 
        private void frmDownMenu_yt_Load(object sender, EventArgs e)
        {
            this.Location = new Point(x, y);
            initGrid();
        }
 
        //³õʼ»¯GRID
        private void initGrid()
        {
            grdMain.RowTemplate.Height = 18;                //ÐиßÉèÖÃ
            grdMain.RowTemplate.MinimumHeight = 18;         //×îСÐиß
            grdMain.ColumnHeadersHeight = 20;               //±êÌâÐиß
            grdMain.RowHeadersVisible = false;              //¹Ì¶¨ÁÐÊÇ·ñÏÔʾ
            grdMain.ColumnHeadersVisible = true;            //¹Ì¶¨ÐÐÊÇ·ñÏÔʾ 
            grdMain.ReadOnly = true;                         //Ö»¶Á--ÊÇ
            //
            grdMain.RowsDefaultCellStyle.SelectionForeColor = Color.White;          //ÐÐÑ¡ÖÐ×ÖÌåÑÕÉ«
            grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;  //ÄÚÈݲ¼¾Ö£¨¾ÓÖУ¬¿¿ÓÒ£©
            grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;//±êÌâÐв¼¾Ö£¨¾ÓÖУ¬¿¿ÓÒ£©
            grdMain.SelectionMode = DataGridViewSelectionMode.FullRowSelect;                     //Ñ¡ÐÐģʽ 
            grdMain.EditMode = DataGridViewEditMode.EditOnEnter;                    //±à¼­Ä£Ê½
            grdMain.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;  //±êÌâÐиߠµ÷Õûģʽ
            grdMain.EnableHeadersVisualStyles = false;                              //±êÌâ ÏÔʾÑùʽ
            grdMain.AllowUserToAddRows = false;             //ÊÇ·ñÔÊÐí×ÔÔö--·ñ
            grdMain.AllowUserToDeleteRows = false;          //ÊÇ·ñÔÊÐíɾ³ý--·ñ 
            grdMain.AllowUserToResizeColumns = true;         //ÔÊÐíµ÷ÕûÁпí--ÊÇ
            grdMain.AllowUserToResizeRows = false;           //ÔÊÐíµ÷ÕûÐиß--·ñ
            grdMain.AllowUserToOrderColumns = false;            //ÊÇ·ñÔÊÐíÍÏ×§ÁÐ
            grdMain.BackgroundColor = Color.White;              //Íø¸ñ±³¾°É«
            grdMain.GridColor = Color.LightGray;                //Íø¸ñÏßÑÕÉ«
            grdMain.DefaultCellStyle.SelectionBackColor = Color.Black;   //Ñ¡ÖÐʱ±³¾°ÑÕÉ«
            grdMain.ShowCellToolTips = false;                                   //Êó±êÍ£Áô ÏÔʾÌáʾ
            grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;//Íø¸ñÄÚÈÝ ¶ÔÆë·½Ê½
            Pub_Class.ClsPub.GetGridView(grdMain, this.Name + this.sTitle, Pub_Class.ClsPub.AppPath);
 
        }
 
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;
 
        }
 
        private void grdMain_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                isOk = 0;
                OKTag = Pub_Class.ClsPub.Enum_OKTag.OKTag_Cancel;
                this.Visible = false;
            }
            if (e.KeyCode == Keys.Enter)
            {
                if ((e.KeyCode == Keys.Return))
                {
                    e.Handled = true;
                    if ((grdMain.FirstDisplayedScrollingColumnHiddenWidth > 0) && !grdMain.Columns[grdMain.SelectedCells[0].ColumnIndex].Frozen)
                    {
                        grdMain.FirstDisplayedScrollingColumnIndex = grdMain.SelectedCells[0].ColumnIndex;
                    }
                }
                isOk = 1;
                OKTag = Pub_Class.ClsPub.Enum_OKTag.OKTag_OK;
                Pub_Class.ClsPub.SaveGridView(grdMain, this.Name + this.sTitle, Pub_Class.ClsPub.AppPath);
                this.Visible = false;
            }
            else//ÏÔʾ ÏúÊÛ¼Û¸ñ
            {
                if (grdMain.CurrentRow == null)
                {
                    return;
                }
                else
                {
 
                }
            }
        }
 
        private void grdMain_DoubleClick(object sender, EventArgs e)
        {
            if (grdMain.CurrentRow == null)
            {
 
            }
            else
            {
                isOk = 1;
                OKTag = Pub_Class.ClsPub.Enum_OKTag.OKTag_OK;
                Pub_Class.ClsPub.SaveGridView(grdMain, this.Name + this.sTitle, Pub_Class.ClsPub.AppPath);
                this.Visible = false;
            }
        }
 
 
 
    }
}