Пример #1
0
 private int Sort_Font(sNFTR.PAMC.Type2.CharInfo c1, sNFTR.PAMC.Type2.CharInfo c2)
 {
     if (c1.chars_code < c2.chars_code)
     {
         return(-1);
     }
     else if (c1.chars_code > c2.chars_code)
     {
         return(1);
     }
     else
     {
         return(0);
     }
 }
Пример #2
0
        private void dataGridMapInfo_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            sNFTR.PAMC map = maps[(int)numericSection.Value];

            if (map.type_section == 2)
            {
                sNFTR.PAMC.Type2 type2 = (sNFTR.PAMC.Type2)map.info;
                if (e.ColumnIndex == 0)
                {
                    if ((e.RowIndex + 1) > type2.charInfo.Length)
                    {
                        List<sNFTR.PAMC.Type2.CharInfo> values = new List<sNFTR.PAMC.Type2.CharInfo>();
                        sNFTR.PAMC.Type2.CharInfo info = new sNFTR.PAMC.Type2.CharInfo();
                        info.chars = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[0].Value);
                        info.chars_code = 0;

                        values.AddRange(type2.charInfo);
                        values.Add(info);
                        type2.charInfo = values.ToArray();

                        type2.num_chars++;
                    }
                    else if (dataGridMapInfo.RowCount < type2.charInfo.Length)
                    {
                        List<sNFTR.PAMC.Type2.CharInfo> values = new List<sNFTR.PAMC.Type2.CharInfo>();

                        values.AddRange(type2.charInfo);
                        values.RemoveAt(e.RowIndex);
                        type2.charInfo = values.ToArray();

                        type2.num_chars--;
                    }
                    else
                        type2.charInfo[e.RowIndex].chars = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[0].Value);

                }
                else if (e.ColumnIndex == 1)
                {
                    if ((e.RowIndex + 1) > type2.charInfo.Length)
                    {
                        List<sNFTR.PAMC.Type2.CharInfo> values = new List<sNFTR.PAMC.Type2.CharInfo>();

                        sNFTR.PAMC.Type2.CharInfo info = new sNFTR.PAMC.Type2.CharInfo();
                        info.chars_code = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[1].Value);
                        info.chars = 0;

                        values.AddRange(type2.charInfo);
                        values.Add(info);
                        type2.charInfo = values.ToArray();

                        type2.num_chars++;
                    }
                    else if (dataGridMapInfo.RowCount < type2.charInfo.Length)
                    {
                        List<sNFTR.PAMC.Type2.CharInfo> values = new List<sNFTR.PAMC.Type2.CharInfo>();

                        values.AddRange(type2.charInfo);
                        values.RemoveAt(e.RowIndex);
                        type2.charInfo = values.ToArray();

                        type2.num_chars--;
                    }
                    else
                        type2.charInfo[e.RowIndex].chars_code = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[1].Value);
                }
                map.info = type2;
            }
            else if (map.type_section == 1)
            {
                sNFTR.PAMC.Type1 type1 = (sNFTR.PAMC.Type1)map.info;

                if (e.ColumnIndex == 0)
                {
                    if ((e.RowIndex + 1) > type1.char_code.Length)
                    {
                        List<ushort> values = new List<ushort>();
                        values.AddRange(type1.char_code);
                        values.Add(Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[0].Value));
                        type1.char_code = values.ToArray();
                    }
                    else if (dataGridMapInfo.RowCount < type1.char_code.Length)
                    {
                        List<ushort> values = new List<ushort>();
                        values.AddRange(type1.char_code);
                        values.RemoveAt(e.RowIndex);
                        type1.char_code = values.ToArray();
                    }
                    else
                        type1.char_code[e.RowIndex] = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[0].Value);
                }

                map.info = type1;
            }
            else
            {
                sNFTR.PAMC.Type0 type0 = (sNFTR.PAMC.Type0)map.info;

                if (e.ColumnIndex == 0 && e.RowIndex == 0 && dataGridMapInfo.RowCount > 0)
                {
                    type0.fist_char_code = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[0].Value);
                }

                map.info = type0;
            }

            maps[(int)numericSection.Value] = map;
        }
Пример #3
0
        private void dataGridMapInfo_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            sNFTR.PAMC map = maps[(int)numericSection.Value];

            if (map.type_section == 2)
            {
                sNFTR.PAMC.Type2 type2 = (sNFTR.PAMC.Type2)map.info;
                if (e.ColumnIndex == 0)
                {
                    if ((e.RowIndex + 1) > type2.charInfo.Length)
                    {
                        List <sNFTR.PAMC.Type2.CharInfo> values = new List <sNFTR.PAMC.Type2.CharInfo>();
                        sNFTR.PAMC.Type2.CharInfo        info   = new sNFTR.PAMC.Type2.CharInfo();
                        info.chars      = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[0].Value);
                        info.chars_code = 0;

                        values.AddRange(type2.charInfo);
                        values.Add(info);
                        type2.charInfo = values.ToArray();

                        type2.num_chars++;
                    }
                    else if (dataGridMapInfo.RowCount < type2.charInfo.Length)
                    {
                        List <sNFTR.PAMC.Type2.CharInfo> values = new List <sNFTR.PAMC.Type2.CharInfo>();

                        values.AddRange(type2.charInfo);
                        values.RemoveAt(e.RowIndex);
                        type2.charInfo = values.ToArray();

                        type2.num_chars--;
                    }
                    else
                    {
                        type2.charInfo[e.RowIndex].chars = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[0].Value);
                    }
                }
                else if (e.ColumnIndex == 1)
                {
                    if ((e.RowIndex + 1) > type2.charInfo.Length)
                    {
                        List <sNFTR.PAMC.Type2.CharInfo> values = new List <sNFTR.PAMC.Type2.CharInfo>();

                        sNFTR.PAMC.Type2.CharInfo info = new sNFTR.PAMC.Type2.CharInfo();
                        info.chars_code = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[1].Value);
                        info.chars      = 0;

                        values.AddRange(type2.charInfo);
                        values.Add(info);
                        type2.charInfo = values.ToArray();

                        type2.num_chars++;
                    }
                    else if (dataGridMapInfo.RowCount < type2.charInfo.Length)
                    {
                        List <sNFTR.PAMC.Type2.CharInfo> values = new List <sNFTR.PAMC.Type2.CharInfo>();

                        values.AddRange(type2.charInfo);
                        values.RemoveAt(e.RowIndex);
                        type2.charInfo = values.ToArray();

                        type2.num_chars--;
                    }
                    else
                    {
                        type2.charInfo[e.RowIndex].chars_code = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[1].Value);
                    }
                }
                map.info = type2;
            }
            else if (map.type_section == 1)
            {
                sNFTR.PAMC.Type1 type1 = (sNFTR.PAMC.Type1)map.info;

                if (e.ColumnIndex == 0)
                {
                    if ((e.RowIndex + 1) > type1.char_code.Length)
                    {
                        List <ushort> values = new List <ushort>();
                        values.AddRange(type1.char_code);
                        values.Add(Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[0].Value));
                        type1.char_code = values.ToArray();
                    }
                    else if (dataGridMapInfo.RowCount < type1.char_code.Length)
                    {
                        List <ushort> values = new List <ushort>();
                        values.AddRange(type1.char_code);
                        values.RemoveAt(e.RowIndex);
                        type1.char_code = values.ToArray();
                    }
                    else
                    {
                        type1.char_code[e.RowIndex] = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[0].Value);
                    }
                }

                map.info = type1;
            }
            else
            {
                sNFTR.PAMC.Type0 type0 = (sNFTR.PAMC.Type0)map.info;

                if (e.ColumnIndex == 0 && e.RowIndex == 0 && dataGridMapInfo.RowCount > 0)
                {
                    type0.fist_char_code = Convert.ToUInt16(dataGridMapInfo.Rows[e.RowIndex].Cells[0].Value);
                }

                map.info = type0;
            }

            maps[(int)numericSection.Value] = map;
        }