jhz
2022-09-08 eb045e76eb29f6c2bb23e644561d68e535129898
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
 
namespace DAL
{
    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;
        public Int64 HCusID;
        DAL.ClsGy_Material_View oMater = new DAL.ClsGy_Material_View(); 
        DAL.ClsGy_MatePriceCus_Ctl oMatePriceCus = new DAL.ClsGy_MatePriceCus_Ctl();
 
        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//ÏÔʾ ÏúÊÛ¼Û¸ñ
            {
                
            }
        }
 
        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;
            }
        }
 
        private void grdMain_CellLeave(object sender, DataGridViewCellEventArgs e)
        {
            
        }
 
        private void grdMain_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (grdMain.CurrentRow == null)
            {
                return;
            }
            else
            {
                Int64 lMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[0].Value);
                if (oMater.GetInfoByID(lMaterID))
                {
                    txtHStdPrice.Text = oMater.omodel.HSalePrice.ToString();
                    txtHLastPrice.Text = DBUtility.ClsPub.isStrNull(oMatePriceCus.GetMatePriceByCus(oMater.omodel.HItemID, HCusID));
                    txtHKFQty.Text = DBUtility.ClsPub.isStrNull(oMater.GetKFQtyByID(lMaterID));
                }
            }
        }
 
 
 
    }
}