public void ExpotToExcel(DataGridView dataGridView1,string SaveFilePath)
        {
            xlApp = new Excel.Application();
               xlWorkBook = xlApp.Workbooks.Add(misValue);
               xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
               int i = 0;
               int j = 0;

               for (i = 0; i <= dataGridView1.RowCount - 1; i++)
               {
               for (j = 0; j <= dataGridView1.ColumnCount - 1; j++)
               {
                   DataGridViewCell cell = dataGridView1[j, i];
                   xlWorkSheet.Cells[i + 1, j + 1] = cell.Value;
               }
               }

               xlWorkBook.SaveAs(SaveFilePath, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
               xlWorkBook.Close(true, misValue, misValue);
               xlApp.Quit();

               releaseObject(xlWorkSheet);
               releaseObject(xlWorkBook);
               releaseObject(xlApp);

               MessageBox.Show("Your file is saved" + SaveFilePath);
        }
Example #2
5
 /// <summary>
 /// 打印信息的初始化
 /// </summary>
 /// <param datagrid="DataGridView">打印数据</param>
 /// <param PageS="int">纸张大小</param>
 /// <param lendscape="bool">是否横向打印</param>
 public PrintClass(DataGridView datagrid, int PageS, bool lendscape)
 {
     this.datagrid = datagrid;//获取打印数据
     this.PageSheet = PageS;//纸张大小
     printdocument = new PrintDocument();//实例化PrintDocument类
     pagesetupdialog = new PageSetupDialog();//实例化PageSetupDialog类
     pagesetupdialog.Document = printdocument;//获取当前页的设置
     printpreviewdialog = new PrintPreviewDialog();//实例化PrintPreviewDialog类
     printpreviewdialog.Document = printdocument;//获取预览文档的信息
     printpreviewdialog.FormBorderStyle = FormBorderStyle.Fixed3D;//设置窗体的边框样式
     //横向打印的设置
     if (PageSheet >= 0)
     {
         if (lendscape == true)
         {
             printdocument.DefaultPageSettings.Landscape = lendscape;//横向打印
         }
         else
         {
             printdocument.DefaultPageSettings.Landscape = lendscape;//纵向打印
         }
     }
     pagesetupdialog.Document = printdocument;
     printdocument.PrintPage += new PrintPageEventHandler(this.printdocument_printpage);//事件的重载
 }
        public BeneficioCadastro(
            ButtonBase botaoSalvar,
            ButtonBase botaoCancelar,
            Form tela,
            DataGridView beneficioGridView
            )
        {
            this.Botao_Salvar = botaoSalvar;
            this.Botao_Cancelar = botaoCancelar;
            this.Tela = tela;
            Beneficios = TiposBeneficio.ObterListaAssociada();
            beneficioGridView.AutoGenerateColumns = false;
            beneficioGridView.DataSource = Beneficios;
            Botao_Salvar.Click += new EventHandler(Botao_Salvar_Click);
            Botao_Cancelar.Click += new EventHandler(Botao_Cancelar_Click);

            Beneficios.AddingNew += (sender, args) =>
            {
                if (beneficioGridView.Rows.Count == Beneficios.Count)
                {
                    Beneficios.RemoveAt(Beneficios.Count - 1);
                    return;
                }
            };

            AoCancelar += () =>
            {
                beneficioGridView.DataSource = Beneficios;
            };
            AoSalvar += () =>
            {
                TiposBeneficio.DispararAtualizacao();
            };
        }
 public override string getMa(DataGridView grid)
 {
     DataGridViewRow row = grid.SelectedRows[0];
     string MaMAU = row.Cells["MaMauVaChePhamMau"].Value.ToString();
     return MaMAU;
     //return base.getMaThuoc(grid);
 }
 public NewAssDlg(MainForm f, DataGridView dv)
 {
     InitializeComponent();
     mf = f;
     mf.recvEvent += new MainForm.RecvEventHandler(this.RecvDataEvent);
     dataGridView1 = dv;
 }
Example #6
1
 private void ExportarDataGridViewExcel(DataGridView grd)
 {
     SaveFileDialog fichero = new SaveFileDialog();
     fichero.Filter = "Excel (*.xls)|*.xls";
     if (fichero.ShowDialog() == DialogResult.OK)
     {
         Microsoft.Office.Interop.Excel.Application aplicacion;
         Microsoft.Office.Interop.Excel.Workbook libros_trabajo;
         Microsoft.Office.Interop.Excel.Worksheet hoja_trabajo;
         aplicacion = new Microsoft.Office.Interop.Excel.Application();
         libros_trabajo = aplicacion.Workbooks.Add();
         hoja_trabajo =
             (Microsoft.Office.Interop.Excel.Worksheet)libros_trabajo.Worksheets.get_Item(1);
         //Recorremos el DataGridView rellenando la hoja de trabajo
         for (int i = 0; i < grd.Rows.Count ; i++)
         {
             for (int j = 0; j < grd.Columns.Count; j++)
             {
                 hoja_trabajo.Cells[i + 1, j + 1] = grd.Rows[i].Cells[j].Value.ToString();
             }
         }
         libros_trabajo.SaveAs(fichero.FileName,
             Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal);
         libros_trabajo.Close(true);
         aplicacion.Quit();
     }
 }
Example #7
1
File: UPT.cs Project: am1guma/PSSC
 private double medie(DataGridView dgv)
 {
     int sum = 0;
     for (int i = 0; i < dgv.Rows.Count; i++)
         sum += Convert.ToInt32(dgv.Rows[i].Cells[1].Value);
     return Math.Round((double)sum / (dgv.RowCount - 1),2);
 }
Example #8
1
        /// <summary>
        /// TuneList Constructor. 
        /// </summary>
        /// <param name="appForm">Main application form</param>
        /// <param name="dgv">DataGridView from main application form</param>
        public TuneList(DDTuneTrackForm appForm, DataGridView dgv)
        {
            mAppForm = appForm;
            mTuneListDGV = dgv;

            InitializeDataGridView();
        }
Example #9
1
 public FormulaireModif(int idServ,int pIdEtat,DataGridView pTableau)
 {
     idService = idServ;
     idEtat = pIdEtat;
     tableau = pTableau;
     InitializeComponent();
 }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider provider)
        {
            using (Form form1 = new Form())
            {
                form1.Text = "FormCollection Visualizer";
                form1.StartPosition = FormStartPosition.WindowsDefaultLocation;
                form1.SizeGripStyle = SizeGripStyle.Auto;
                form1.ShowInTaskbar = false;
                form1.ShowIcon = false;

                DataTable dt;

                using (Stream stream = provider.GetData())
                {
                    BinaryFormatter bformatter = new BinaryFormatter();

                    dt = (DataTable)bformatter.Deserialize(stream);

                    stream.Close();
                }

                DataGridView gridView = new DataGridView();
                gridView.Dock = DockStyle.Fill;

                form1.Controls.Add(gridView);

                gridView.DataSource = dt;

                windowService.ShowDialog(form1);
            }
        }
Example #11
1
		/// ------------------------------------------------------------------------------------
		public void InitializeGrid(DataGridView grid)
		{
			foreach (var col in Columns)
			{
				if (!grid.Columns.Contains(col.Id))
					continue;

				grid.Columns[col.Id].Visible = col.Visible;

				if (col.Width >= 0)
					grid.Columns[col.Id].Width = col.Width;

				if (col.DisplayIndex < 0)
					grid.Columns[col.Id].DisplayIndex = 0;
				else if (col.DisplayIndex >= grid.ColumnCount)
					grid.Columns[col.Id].DisplayIndex = grid.ColumnCount - 1;
				else
					grid.Columns[col.Id].DisplayIndex = col.DisplayIndex;
			}

			if (!string.IsNullOrEmpty(SortedColumn) && grid.Columns.Contains(SortedColumn))
				grid.Sort(grid.Columns[SortedColumn], SortOrder == SortOrder.Descending ? ListSortDirection.Descending : ListSortDirection.Ascending);

			// If the column header height or the former dpi settings are different,
			// then auto. calculate the height of the column headings.
			if (ColumnHeaderHeight <= 0 || DPI != m_currDpi)
				grid.AutoResizeColumnHeadersHeight();
			else
				grid.ColumnHeadersHeight = ColumnHeaderHeight;
		}
Example #12
1
        public static void listarMicros(DataGridView dgMicros, String patente, String patenteEstimada,
            String modelo, String modeloEstimado, DateTimePicker dtpFechaAlta, String marca, String tipoServicio,
            decimal numero, bool mostrarDeshabilitados, bool mostrarHabilitados)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(main.connString))
                using (SqlCommand cmd = new SqlCommand("BONDIOLA.listarMicros", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    SQL_Library.agregarParametro(cmd, "@patente", patente);
                    SQL_Library.agregarParametro(cmd, "@patenteEstimada", patenteEstimada);
                    SQL_Library.agregarParametro(cmd, "@modelo", modelo);
                    SQL_Library.agregarParametro(cmd, "@modeloEstimado", modeloEstimado);
                    SQL_Library.agregarParametroFecha(cmd, dtpFechaAlta, "@fecha_alta");
                    SQL_Library.agregarParametro(cmd, "@marca", marca);
                    SQL_Library.agregarParametro(cmd, "@tipoServicio", tipoServicio);
                    SQL_Library.agregarParametro(cmd, "@numero", numero);
                    SQL_Library.agregarParametro(cmd, "@mostrarDeshabilitados", mostrarDeshabilitados);
                    SQL_Library.agregarParametro(cmd, "@mostrarHabilitados", mostrarHabilitados);
                    SQL_Library.agregarParametro(cmd, "@fechaActual", Properties.Settings.Default.Fecha);

                    SQL_Library.llenarDataGrid(dgMicros, conn, cmd);
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public OptionsManager(IBClient ibClient, DataGridView callGrid, DataGridView putGrid, DataGridView optionPositionsGrid)
 {
     this.ibClient = ibClient;
     this.callGrid = callGrid;
     this.putGrid = putGrid;
     this.positionsGrid = optionPositionsGrid;
 }
Example #14
1
        private void Init()
        {
            DataGridView dgv = new DataGridView()
            {
                Width = 700,
                ReadOnly = true,
                AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells,
            };
            dgv.DataSource = _level.GetTotalWeightVect().Transpose().ToDataTable();
            //设置显示格式
            dgv.CellFormatting += (sender, e) =>
            {
                //不处理新建行
                if (e.RowIndex != dgv.NewRowIndex)
                {
                    double d = double.Parse(e.Value.ToString());
                    e.Value = d.ToString("N3");
                }
            };

            totalSortPanel.Controls.Add(dgv);

            ciLabel.Text = string.Format("CI={0:f4}", _level.LevelCI);
            riLabel.Text = string.Format("RI={0:f4}", _level.LevelRI);
            crLabel.Text = string.Format("CR={0:f4}", _level.LevelCR);
        }
        void CreateEmptyGrid()
        {
            m_Grid = new DataGridView();
            m_Grid.ReadOnly = true;
            m_Grid.Parent = this;
            m_Grid.Dock = DockStyle.Fill;
            m_Table = new DataTable();
            m_Grid.DataSource = m_Table;

            //Add base item attributes
            Type ItemType = typeof(GameplayItem);
            Type ItemAttrType = typeof(ItemAttributes);

            System.Reflection.FieldInfo[] ItemFields = ItemType.GetFields();
            System.Reflection.FieldInfo[] ItemAttrFields = ItemAttrType.GetFields();

            List<string> FieldNames = new List<string>();
            foreach (System.Reflection.FieldInfo Info in ItemFields)
            {
                FieldNames.Add(Info.Name);

                DataGridViewColumn Col = new DataGridViewColumn(CreateCellTemplate(Info));
                Col.Name = Info.Name;
                //m_Grid.Columns.Add(Col);
                m_Table.Columns.Add(Info.Name, Info.FieldType);
            }
            foreach (System.Reflection.FieldInfo Info in ItemAttrFields)
            {
                FieldNames.Add(Info.Name);
                DataGridViewColumn Col = new DataGridViewColumn(CreateCellTemplate(Info));
                Col.Name = Info.Name;
                //m_Grid.Columns.Add(Col);
                m_Table.Columns.Add(Info.Name, Info.FieldType);
            }
        }
    	public void buildGui()
    	{
    		var topPanel = this.add_Panel();
    		Path = topPanel.insert_Above<TextBox>(20);
			sourceCode = topPanel.add_SourceCodeEditor();
			dataGridView = sourceCode.insert_Above<Panel>(100).add_DataGridView();
			leftPanel = topPanel.insert_Left<Panel>(300);									
			
			Path.onEnter(loadFiles);
			Path.onDrop(
				(fileOrFolder)=>{
									Path.set_Text(fileOrFolder);
									loadFiles(fileOrFolder);
								}); 	   	   	   	   
			dataGridView.SelectionChanged+= 
				(sender,e) => {
						if (dataGridView.SelectedRows.size() == 1)
						{
							var selectedRow = dataGridView.SelectedRows[0]; 
							var filePath = selectedRow.Cells[0].Value.str();
							var filename = selectedRow.Cells[1].Value.str();
							var lineNumber = selectedRow.Cells[2].Value.str();
							"opening up source code: {0}".info(filePath);
							sourceCode.open(filePath.pathCombine(filename));  
							sourceCode.gotoLine(lineNumber.toInt() + 1);
							dataGridView.focus();
						}
				  };
								
		}
Example #17
1
        public void ExportToExcel(DataGridView grid,string r_id,string time)
        {
            ApplicationClass Excel = new ApplicationClass();
            XlReferenceStyle RefStyle = Excel.ReferenceStyle;
            Excel.Visible = true;
            Workbook wb = null;
            String TemplatePath = System.Windows.Forms.Application.StartupPath + @"\Отчет"+r_id+".xlt";
            try
            {
                wb = Excel.Workbooks.Add(TemplatePath); // !!!
            }
            catch (System.Exception ex)
            {
                throw new Exception("Не удалось загрузить шаблон для экспорта " + TemplatePath + "\n" + ex.Message);
            }
            Worksheet ws = wb.Worksheets.get_Item(1) as Worksheet;

            ws.Cells[20, 3] = time;

            for (int j = 0; j < grid.Columns.Count; ++j)
            {
                //(ws.Cells[1+20, j + 1+2] as Range).Value2 = grid.Columns[j].HeaderText;
                for (int i = 0; i < grid.Rows.Count; ++i)
                {
                    object Val = grid.Rows[i].Cells[j].Value;
                    if (Val != null)
                        (ws.Cells[i + 2+20, j + 1+2] as Range).Value2 = Val.ToString();
                }
            }
               // ws.Columns.EntireColumn.AutoFit();
            Excel.ReferenceStyle = RefStyle;
            ReleaseExcel(Excel as Object);
        }
Example #18
0
        public static void SaveTemporalGridData(ref object[] CurrentItems, DataGridView dgv)
        {
            int nFilledRows = dgv.Rows.Count - 1;

            for (int i = 0; i < nFilledRows; i++)
            {
                for (int j = 0; j < CurrentItems.Length; j++)
                {
                    if (CurrentItems[j] != null)
                    {
                        if (((MuDef.MUFile_Item)(CurrentItems[i])).Index == ushort.Parse(dgv.Rows[i].Cells[0].Value.ToString()))
                        {
                            /*
                            (MuDef.MUFile_Item)(CurrentItems[i]) = new MuDef.MUFile_Item()
                            {
                               

                            };
                             * */
                        }
                    }
                }
            }

        }
Example #19
0
		public ParamForm(BankLab parent, DataGridView dataTable)
		{
			InitializeComponent();
			Parent = parent;
			CurrentDataTable = dataTable;
			ShowParametrForm(CurrentDataTable);
		}
        public DeleteOrEditTaskForm(TaskDataGridItem taskDataGridItem, DataGridView tdg)
        {
            InitializeComponent();

            var nameList = from users in userData.QueryAll()
                           select users.USER_NAME;

            foreach(string name in nameList)
            {
                AssignedToComboBox.Items.Add(name);
            }

            TaskIDLabel.Text = taskDataGridItem.TASK_ID.ToString();
            AssignedByLabel.Text = taskDataGridItem.ASSIGNED_BY;
            AssignedToComboBox.Text = taskDataGridItem.ASSIGNED_TO;
            TaskTitleTextBox.Text = taskDataGridItem.TASK_TITLE;
            DetailsTextBox.Text = taskDataGridItem.TASK_DETAILS;
            IssueDatePicker.Value = taskDataGridItem.ISSUE_DATE;
            DueDatePicker.Value = taskDataGridItem.DUE_DATE;
            SendEmailCheckBox.Checked = taskDataGridItem.SEND_EMAIL;

            taskItem = taskDataGridItem;

            taskDataGridView = tdg;
        }
        public static void Initialize(DataGridView dataGridView)
        {
            if (dataGridView == null)
                throw new ArgumentNullException("dataGridView");

            m_DataGridView = dataGridView;
        }
Example #22
0
		/// ------------------------------------------------------------------------------------
		public void InitializeGrid(DataGridView grid)
		{
			foreach (var col in Columns)
			{
				if (!grid.Columns.Contains(col.Id))
					continue;

				grid.Columns[col.Id].Visible = col.Visible;

				if (col.Width >= 0 &&
					(grid.Columns[col.Id].AutoSizeMode == DataGridViewAutoSizeColumnMode.None ||
					grid.Columns[col.Id].AutoSizeMode == DataGridViewAutoSizeColumnMode.NotSet))
				{
					grid.Columns[col.Id].Width = col.Width;
				}
				else if (col.FillWeight > 0 && grid.Columns[col.Id].AutoSizeMode == DataGridViewAutoSizeColumnMode.Fill)
				{
					grid.Columns[col.Id].FillWeight = col.FillWeight;
				}

				if (col.DisplayIndex < 0)
					grid.Columns[col.Id].DisplayIndex = 0;
				else if (col.DisplayIndex >= grid.ColumnCount)
					grid.Columns[col.Id].DisplayIndex = grid.ColumnCount - 1;
				else
					grid.Columns[col.Id].DisplayIndex = col.DisplayIndex;
			}

			// If the column header height or the former dpi settings are different,
			// then auto. calculate the height of the column headings.
			if (ColumnHeaderHeight <= 0 || DPI != m_currDpi)
				grid.AutoResizeColumnHeadersHeight();
			else
				grid.ColumnHeadersHeight = ColumnHeaderHeight;
		}
Example #23
0
 public static void exportDataGridView(DataGridView dv, String fileName)
 {
     object missing = System.Reflection.Missing.Value;
     Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
     app.Visible = false;
     app.UserControl = false;
     Workbooks workbooks = app.Workbooks;
     _Workbook workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet);
     Sheets sheets = workbook.Worksheets;
     _Worksheet worksheet = (_Worksheet)sheets.get_Item(1);
     worksheet.Name = "Sheet1";
     Boolean bl = dv.AllowUserToAddRows;
     dv.AllowUserToAddRows = false;
     for (int i = 0; i < dv.Columns.Count; i++)
     {
         worksheet.Cells[1, i + 1] = dv.Columns[i].HeaderText;
     }
     for (int i = 0; i < dv.Rows.Count; i++)
     {
         for (int j = 0; j < dv.Columns.Count; j++)
         {
             worksheet.Cells[i + 2, j + 1] = dv.Rows[i].Cells[j].Value;
         }
     }
     dv.AllowUserToAddRows = bl;
     app.DisplayAlerts = false;
     app.AlertBeforeOverwriting = false;
     workbook.Save();
     workbook.SaveAs(fileName, missing, missing, missing, missing, missing, XlSaveAsAccessMode.xlNoChange, missing, missing, missing, missing, missing);
     app.Quit();
     app = null;
 }
Example #24
0
 public void hienthi(DataGridView data)
 {
     doc.Load(tentep);
     data.Rows.Clear();
     //Tạo nút gốc
     XmlElement goc = doc.DocumentElement;
     //Tạo đối tương ds chứa danh sách các nút
     XmlNodeList ds = doc.SelectNodes("/congty/nhanvien");
     int sd = 0;
     data.ColumnCount = 5;
     data.Rows.Add();//Hàm tự động add thêm dòng dữ liệu
     //Dùng vòng foreach để duyệt và chèn dữ liệu
     foreach (XmlNode node in ds) {
         //Chọn các phần tử và gán biến cho chúng
         XmlNode manv = node.SelectSingleNode("manv");
         XmlNode hoten = node.SelectSingleNode("hoten");
         XmlNode ngaysinh = node.SelectSingleNode("ngaysinh");
         XmlNode gioitinh = node.SelectSingleNode("gioitinh");
         XmlNode hsluong = node.SelectSingleNode("hsluong");
         //ADD nó vào các cột và hàng tương ứng
         data.Rows[sd].Cells[0].Value = manv.InnerText.ToString();
         data.Rows[sd].Cells[1].Value = hoten.InnerText.ToString();
         data.Rows[sd].Cells[2].Value = ngaysinh.InnerText.ToString();
         data.Rows[sd].Cells[3].Value = gioitinh.InnerText.ToString();
         data.Rows[sd].Cells[4].Value = hsluong.InnerText.ToString();
         data.Rows.Add();
         sd++;
     }
 }
Example #25
0
 private void PopulateDataGrid(DataGridView dgv)
 {
     FormHelper.PopulateDataGrid(dgv, gridTable);
     dgv.Columns["Id"].Visible = false;
     dgv.Columns["ProfileId"].Visible = false;
     dgv.Columns["FullName"].Visible = false;
 }
        public DeleteOrEditUserForm(int userIDParam, DataGridView dataGridView)
        {
            InitializeComponent();

            userID = userIDParam;
            userDataGridView = dataGridView;
        }
        public void DegiskenSil(DataGridView dgv,String degiskenler)
        {
            if (degiskenler.LastIndexOf(',') == 0)
               {
               degiskenler = degiskenler.Substring(0, degiskenler.Length - 1);
               }
               string[] degisken_deger = degiskenler.Split(',');

               for (int i = 0; i < degisken_deger.Length; i++)
               {
               try
               {
                   if (degisken_deger[i].IndexOf('=') != -1)
                   {
                       String[] dv = degisken_deger[i].Split('=');
                       ht.Remove(dv[0]);
                   }
                   else
                   {
                       ht.Remove(degisken_deger[i]);
                   }
               }
               catch (Exception) { }
               }
               DegiskenYazdir(dgv);
        }
Example #28
0
        public ResultTable(DataGridView dataView, string[] names)                                 // constructor.  Uses array of names for column/row header labels
        {
            m_dataView = dataView;
            m_results = new Result[m_numberOfSequences, m_numberOfSequences];

            for (int i = 0; i < m_numberOfSequences; ++i)
            {
                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
                column.HeaderText = "seq" + (i+1);
                column.MaxInputLength = 8;
                column.Width = 50;
                DataGridViewCell cell = new DataGridViewTextBoxCell();
                column.CellTemplate = cell;
                m_dataView.Columns.Add(column);
            }
            for (int j = 0; j < m_numberOfSequences; ++j)
            {
                DataGridViewRow row = new DataGridViewRow();                                    // how can I remove the dumb current cell pointer that makes the header cells so big/obfuscates the header text?
                row.HeaderCell.Value = "seq"+(j+1);
                row.Height = 20;
                for (int i = 0; i < m_numberOfSequences; ++i)
                {
                    DataGridViewCell cell = new DataGridViewTextBoxCell();
                    row.Cells.Add(cell);
                }
                dataView.RowHeadersWidthSizeMode=DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
                m_dataView.Rows.Add(row);
            }
            dataView.CurrentCell = null;
        }
Example #29
0
 public override void FormatearGrilla(DataGridView dgv)
 {
     base.FormatearGrilla(dgv);
     this.dgvLactancia.Columns["FechaDesdeStr"].Visible = true;
     this.dgvLactancia.Columns["FechaHastaStr"].Visible = true;
     this.dgvLactancia.Columns["HoraInicio"].Visible = true;
     this.dgvLactancia.Columns["LunesStr"].Visible = true;
     this.dgvLactancia.Columns["MartesStr"].Visible = true;
     this.dgvLactancia.Columns["MiercolesStr"].Visible = true;
     this.dgvLactancia.Columns["JuevesStr"].Visible = true;
     this.dgvLactancia.Columns["ViernesStr"].Visible = true;
     this.dgvLactancia.Columns["SabadoStr"].Visible = true;
     this.dgvLactancia.Columns["DomingoStr"].Visible = true;
     this.dgvLactancia.Columns["FechaActualizacionStr"].Visible = true;
     this.dgvLactancia.Columns["FechaDesdeStr"].HeaderText = "Fecha Desde";
     this.dgvLactancia.Columns["FechaHastaStr"].HeaderText = "Fecha Hasta";
     this.dgvLactancia.Columns["HoraInicio"].HeaderText = "Hora Inicio";
     this.dgvLactancia.Columns["LunesStr"].HeaderText = "Lunes";
     this.dgvLactancia.Columns["MartesStr"].HeaderText = "Martes";
     this.dgvLactancia.Columns["MiercolesStr"].HeaderText = "Miercoles";
     this.dgvLactancia.Columns["JuevesStr"].HeaderText = "Jueves";
     this.dgvLactancia.Columns["ViernesStr"].HeaderText = "Viernes";
     this.dgvLactancia.Columns["SabadoStr"].HeaderText = "Sabado";
     this.dgvLactancia.Columns["DomingoStr"].HeaderText = "Domingo";
 }
		public void TestDataSet ()
		{
			// Binding to a DataSet doesn't work unless you specify DataMember
			Form f = new Form ();
			f.ShowInTaskbar = false;
			
			DataSet ds = new DataSet ();
			
			DataTable dt = ds.Tables.Add ("Muppets");

			dt.Columns.Add ("ID");
			dt.Columns.Add ("Name");
			dt.Columns.Add ("Sex");

			dt.Rows.Add (1, "Kermit", "Male");
			dt.Rows.Add (2, "Miss Piggy", "Female");
			dt.Rows.Add (3, "Gonzo", "Male");
			
			DataGridView dgv = new DataGridView ();
			dgv.DataSource = ds;
	
			f.Controls.Add (dgv);
			f.Show ();
			
			Assert.AreEqual (0, dgv.Columns.Count, "A1");
			Assert.AreEqual (0, dgv.Rows.Count, "A2");
			
			dgv.DataMember = "Muppets";

			Assert.AreEqual (3, dgv.Columns.Count, "A3");
			Assert.AreEqual (4, dgv.Rows.Count, "A4");			
			
			f.Dispose ();
		}
Example #31
0
        /// <summary>
        /// 分类色带渲染
        /// </summary>
        /// <param name="classCount">分类数</param>
        /// <param name="colorRamp">色带</param>
        public void ClassifyColorRampRenderer(ILayer pLayerR, IColorRamp colorRamp, string classfield, System.Windows.Forms.DataGridView datagridview)
        {
            try
            {
                IRasterLayer    pRasterLayer    = pLayerR as IRasterLayer;
                IRaster         raster          = pRasterLayer.Raster;
                IRasterRenderer pRasterRenderer = new RasterClassifyColorRampRenderer() as IRasterRenderer;
                pRasterRenderer.Raster = raster;
                IRasterClassifyColorRampRenderer classifyRenderer = pRasterRenderer as IRasterClassifyColorRampRenderer;


                int classcount = datagridview.RowCount;
                classifyRenderer.ClassCount = classcount;
                classifyRenderer.ClassField = classfield;
                for (int i = 0; i < datagridview.RowCount; i++)
                {
                    classifyRenderer.set_Break(i, double.Parse(datagridview.Rows[i].Cells[0].Value.ToString()));
                }
                pRasterRenderer.Update();
                colorRamp.Size = 15;
                bool pOk;
                colorRamp.CreateRamp(out pOk);
                //create symbol for the classes
                IFillSymbol fillSymbol = new SimpleFillSymbol();
                for (int i = 0; i < classifyRenderer.ClassCount - 1; i++)
                {
                    fillSymbol.Color = colorRamp.get_Color(i);
                    classifyRenderer.set_Symbol(i, (ISymbol)fillSymbol);
                    classifyRenderer.set_Label(i, classifyRenderer.get_Break(i).ToString() + "—" + datagridview.Rows[i].Cells[1].Value.ToString());
                }
                pRasterLayer.Renderer = classifyRenderer as IRasterRenderer;
            }
            catch
            {
            }
        }
 public void DisableSelected(System.Windows.Forms.DataGridView dgv)
 {
     dgv.ClearSelection();
 }
Example #33
0
 public static void FormatarEstoque(System.Windows.Forms.DataGridView dgv)
 {
     dgv.Columns["CodEstoque"].Visible = false;
     dgv.Columns["Local"].Width        = 200;
     dgv.DefaultCellStyle.ForeColor    = System.Drawing.Color.Black;
 }
Example #34
0
 public DataGridViewColumnCollection(DataGridView dataGridView)
 {
     InvalidateCachedColumnCounts();
     InvalidateCachedColumnsWidths();
     this.dataGridView = dataGridView;
 }
Example #35
0
        public void LoadData()
        {
            this.tabControl.Controls.Clear();
            listDataGridView.Clear();

            DepartmentBLL         departmentBLL  = new DepartmentBLL();
            List <DAL.Department> listDepartment = departmentBLL.ListDepartment();

            for (int i = 0; i < listDepartment.Count; i++)
            {
                var t = new System.Windows.Forms.TabPage();
                t.Name     = listDepartment[i].Name;
                t.Text     = listDepartment[i].Name;
                t.Location = new System.Drawing.Point(4, 22);
                t.Padding  = new System.Windows.Forms.Padding(3);
                t.Size     = new System.Drawing.Size(597, 257);
                t.UseVisualStyleBackColor = true;
                t.AutoScroll = true;

                //add gridview
                var dataGridView  = new System.Windows.Forms.DataGridView();
                var bindingSource = new System.Windows.Forms.BindingSource();
                ((System.ComponentModel.ISupportInitialize)(dataGridView)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(bindingSource)).BeginInit();
                dataGridView.AutoGenerateColumns         = false;
                dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                dataGridView.DataSource = bindingSource;
                dataGridView.Location   = new System.Drawing.Point(0, 0);
                dataGridView.Size       = new System.Drawing.Size(567, 228);

                var col1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
                var col2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
                var col3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
                col1.DataPropertyName = "ID";
                col1.HeaderText       = "ID";
                col1.Width            = 174;
                col2.DataPropertyName = "Name";
                col2.HeaderText       = "Name";
                col2.Width            = 174;
                col3.DataPropertyName = "Username";
                col3.HeaderText       = "Username";
                col3.Width            = 176;
                dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { col1, col2, col3 });

                //add list data gridview

                listDataGridView.Add(dataGridView);

                // add addbutton
                Button button = new Button();
                button.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
                button.Location = new System.Drawing.Point(490, 7);
                button.Size     = new System.Drawing.Size(100, 20);
                button.Tag      = listDepartment[i];
                button.Text     = "Add emloyee";
                button.Click   += new EventHandler(this.btnAddEmloyee_Click);

                t.Controls.Add(button);

                // add button edit department

                Button btEditDepartment = new Button();
                btEditDepartment.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
                btEditDepartment.Location = new System.Drawing.Point(490, 30);
                btEditDepartment.Size     = new System.Drawing.Size(100, 20);
                btEditDepartment.Tag      = listDepartment[i];
                btEditDepartment.Text     = "Edit Department";
                btEditDepartment.Click   += new EventHandler(this.btEditDepartment_Click);

                t.Controls.Add(btEditDepartment);

                // add button delete department

                if (listDepartment[i].ID != 1 && listDepartment[i].ID != 2)
                {
                    Button btDeleteDepartment = new Button();
                    btDeleteDepartment.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
                    btDeleteDepartment.Location = new System.Drawing.Point(480, 55);
                    btDeleteDepartment.Size     = new System.Drawing.Size(120, 20);
                    btDeleteDepartment.Tag      = listDepartment[i];
                    btDeleteDepartment.Text     = "Delete Department";
                    btDeleteDepartment.Click   += new EventHandler(this.btDeleteDepartment_Click);

                    t.Controls.Add(btDeleteDepartment);
                }

                //get emloyees for department

                EmployeeBLL     employeeBLL  = new EmployeeBLL();
                List <Employee> listEmployee = employeeBLL.ListEmployeeByDepartment(listDepartment[i]);
                dataGridView.DataSource = listEmployee;

                t.Controls.Add(dataGridView);
                //var dmc = new DepartmentControl(listDepartment[i]);
                //dmc.OnDelete += new DepartmentControl.OnDeleteHandler(this.departmentControl_OnDelete);
                //int cols = (this.Width - minPadding) / (width + minPadding);
                //int rows = (this.Height - minPadding) / (height + minPadding);
                //dmc.Location = new System.Drawing.Point(minPadding + (width + minPadding) , minPadding + (height + minPadding) );
                //dmc.Size = new System.Drawing.Size(width, height);
                //t.Controls.Add(dmc);

                this.tabControl.Controls.Add(t);
            }
            this.UpdateControlPosition();
        }
Example #36
0
        /// <summary>
        /// Export file excel from datagridview
        /// </summary>
        /// <param name="dgv"></param>
        /// <param name="fileName"></param>
        public void ExportFileFromDataGridView(System.Windows.Forms.DataGridView dgv, string fileName)
        {
            //set properties for SaveFileDilog
            SaveFileDialog sfdSave = new SaveFileDialog();

            sfdSave.Filter   = "Excel file(*.xls)|*.xls";
            sfdSave.Title    = "Save to Excel file";
            sfdSave.FileName = fileName;

            //proccess save file excel
            if (sfdSave.ShowDialog() == DialogResult.OK)
            {
                //create file infomation
                FileInfo f = new FileInfo(sfdSave.FileName);
                //delete if file exists
                if (f.Exists == true)
                {
                    f.Delete();
                }
                //Create excel file
                ExcelCOM.Application exApp   = new ExcelCOM.Application();
                ExcelCOM.Workbook    exBook  = exApp.Workbooks.Add(ExcelCOM.XlWBATemplate.xlWBATWorksheet);
                ExcelCOM.Worksheet   exSheet = (ExcelCOM.Worksheet)exBook.Worksheets[1];
                //ExcelCOM.Range chartRange;
                exSheet.Name = fileName;
                //get data from datagridview import into excel file
                //exSheet.Cells.FormatConditions

                //exSheet.get_Range("b2", "e3").Merge(false);

                //chartRange = exSheet.get_Range("b2", "e9");
                //chartRange.BorderAround(ExcelCOM.XlLineStyle.xlContinuous, ExcelCOM.XlBorderWeight.xlMedium, ExcelCOM.XlColorIndex.xlColorIndexAutomatic, ExcelCOM.XlColorIndex.xlColorIndexAutomatic);

                //xlWorkBook.SaveAs("csharp.net-informations.xls", ExcelCOM.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, ExcelCOM.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);

                //import header
                int col = 1;
                for (int i = 1; i <= dgv.ColumnCount; i++)
                {
                    exSheet.Cells[1, col] = dgv.Columns[i - 1].HeaderText;
                    col++;
                    //chartRange = exSheet.Cells[1, col];
                    //Font.Bold = true;
                }

                //import data
                for (int i = 0; i < dgv.Rows.Count; i++)
                {
                    col = 1;
                    for (int j = 1; j < dgv.ColumnCount; j++)
                    {
                        exSheet.Cells[i + 2, col + 1] = dgv.Rows[i].Cells[j].Value.ToString();

                        col++;

                        //chartRange.Cells.Formula
                    }
                }

                //(ExcelCOM.XlLineStyle.xlContinuous, ExcelCOM.XlBorderWeight.xlMedium, ExcelCOM.XlColorIndex.xlColorIndexAutomatic, ExcelCOM.XlColorIndex.xlColorIndexAutomatic);
                //chartRange.BorderAround(ExcelCOM.XlLineStyle.xlContinuous, ExcelCOM.XlBorderWeight.xlMedium, ExcelCOM.XlColorIndex.xlColorIndexAutomatic, ExcelCOM.XlColorIndex.xlColorIndexAutomatic);
                exApp.Visible = false;
                //Save file excel into dictionary that you choose
                exBook.SaveAs(sfdSave.FileName, ExcelCOM.XlFileFormat.xlWorkbookNormal,
                              null, null, false, false,
                              ExcelCOM.XlSaveAsAccessMode.xlExclusive,
                              false, false, false, false, false);

                //close and release object
                exBook.Close(false, false, false);
                exApp.Quit();

                System.Runtime.InteropServices.Marshal.ReleaseComObject(exBook);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(exApp);

                CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM385"),
                                                                 Common.clsLanguages.GetResource("CRM11"),
                                                                 Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                 Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
            }
        }
Example #37
0
        public void tb_EmpInfoFind(string strObject, int intFalg, Object DataObject)
        {
            int    intCount = 0;
            string strSecar = null;

            try
            {
                switch (intFalg) //判断条件
                {
                case 1:          //"员工姓名":
                    strSecar = "select * from tb_EmpInfo where EmpName like  '%" + strObject + "%' and EmpFalg=0";
                    break;

                case 2:    //员工性别

                    strSecar = "select  * from  tb_EmpInfo  where  EmpSex  = '" + strObject + "' and EmpFalg=0";
                    break;

                case 3:    //所属部门"
                    strSecar = "select * from tb_EmpInfo where EmpDept like '%" + strObject + "%' and EmpFalg=0";
                    break;

                case 4:    //"员工职位":
                    strSecar = "select * from tb_EmpInfo where EmpPost like '%" + strObject + "%' and EmpFalg=0";
                    break;

                case 5:
                    strSecar = "select * from tb_EmpInfo where EmpFalg=0";
                    break;
                }
                _getSqlConnection getConnection = new _getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);
                int ii = 0;
                qlddr = cmd.ExecuteReader();
                while (qlddr.Read())
                {
                    ii++;
                }
                qlddr.Close();
                System.Windows.Forms.DataGridView dv = (DataGridView)DataObject;
                if (ii != 0)
                {
                    int i = 0;
                    dv.RowCount = ii;
                    qlddr       = cmd.ExecuteReader();
                    while (qlddr.Read())
                    {
                        dv[0, i].Value = qlddr[0].ToString();
                        dv[1, i].Value = qlddr[1].ToString();
                        dv[2, i].Value = qlddr[4].ToString();
                        dv[3, i].Value = qlddr[6].ToString();
                        dv[4, i].Value = qlddr[7].ToString();
                        dv[5, i].Value = qlddr[9].ToString();
                        i++;
                    }
                    qlddr.Close();
                }
                else
                {
                    for (int i = 0; i < dv.RowCount; i++)
                    {
                        dv[0, i].Value = "";
                        dv[1, i].Value = "";
                        dv[2, i].Value = "";
                        dv[3, i].Value = "";
                        dv[4, i].Value = "";
                        dv[5, i].Value = "";
                    }
                }
            }
            catch (Exception ee)
            {
            }
        }
Example #38
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CATTester));
     this.btnExit    = new System.Windows.Forms.Button();
     this.txtInput   = new System.Windows.Forms.TextBoxTS();
     this.txtResult  = new System.Windows.Forms.TextBoxTS();
     this.label1     = new System.Windows.Forms.LabelTS();
     this.label2     = new System.Windows.Forms.LabelTS();
     this.dataGrid1  = new System.Windows.Forms.DataGridView();
     this.btnExecute = new System.Windows.Forms.Button();
     ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
     this.SuspendLayout();
     //
     // btnExit
     //
     this.btnExit.Location = new System.Drawing.Point(440, 336);
     this.btnExit.Name     = "btnExit";
     this.btnExit.Size     = new System.Drawing.Size(75, 23);
     this.btnExit.TabIndex = 2;
     this.btnExit.Text     = "Exit";
     this.btnExit.Click   += new System.EventHandler(this.btnExit_Click);
     //
     // txtInput
     //
     this.txtInput.Location = new System.Drawing.Point(120, 240);
     this.txtInput.Name     = "txtInput";
     this.txtInput.Size     = new System.Drawing.Size(168, 20);
     this.txtInput.TabIndex = 0;
     this.txtInput.KeyUp   += new System.Windows.Forms.KeyEventHandler(this.txtInput_KeyUp);
     //
     // txtResult
     //
     this.txtResult.Location = new System.Drawing.Point(120, 280);
     this.txtResult.Name     = "txtResult";
     this.txtResult.Size     = new System.Drawing.Size(392, 20);
     this.txtResult.TabIndex = 3;
     //
     // label1
     //
     this.label1.Image     = null;
     this.label1.Location  = new System.Drawing.Point(16, 240);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(88, 23);
     this.label1.TabIndex  = 4;
     this.label1.Text      = "CAT Command";
     this.label1.TextAlign = System.Drawing.ContentAlignment.BottomRight;
     //
     // label2
     //
     this.label2.Image     = null;
     this.label2.Location  = new System.Drawing.Point(16, 280);
     this.label2.Name      = "label2";
     this.label2.Size      = new System.Drawing.Size(88, 23);
     this.label2.TabIndex  = 5;
     this.label2.Text      = "CAT Response";
     this.label2.TextAlign = System.Drawing.ContentAlignment.BottomRight;
     //
     // dataGrid1
     //
     this.dataGrid1.Location = new System.Drawing.Point(8, 0);
     this.dataGrid1.Name     = "dataGrid1";
     this.dataGrid1.Size     = new System.Drawing.Size(512, 224);
     this.dataGrid1.TabIndex = 6;
     //
     // btnExecute
     //
     this.btnExecute.Location = new System.Drawing.Point(312, 240);
     this.btnExecute.Name     = "btnExecute";
     this.btnExecute.Size     = new System.Drawing.Size(75, 23);
     this.btnExecute.TabIndex = 7;
     this.btnExecute.Text     = "Execute";
     this.btnExecute.Click   += new System.EventHandler(this.btnExecute_Click);
     //
     // CATTester
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(536, 382);
     this.Controls.Add(this.btnExecute);
     this.Controls.Add(this.dataGrid1);
     this.Controls.Add(this.label2);
     this.Controls.Add(this.label1);
     this.Controls.Add(this.txtResult);
     this.Controls.Add(this.txtInput);
     this.Controls.Add(this.btnExit);
     this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name = "CATTester";
     this.Text = "CAT Command Tester";
     ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Example #39
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(QuestionSetEditor));
     this.groupBox2                                  = new System.Windows.Forms.GroupBox();
     this.questionSetsDataGrid                       = new System.Windows.Forms.DataGridView();
     this.idDataGridViewTextBoxColumn                = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.typeIdDataGridViewTextBoxColumn            = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.subtypeIdDataGridViewTextBoxColumn         = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.difficultyLevelIdDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.dataGridViewTextBoxColumn1                 = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.pictureDataGridViewImageColumn             = new System.Windows.Forms.DataGridViewImageColumn();
     this.difficultyLevel                            = new System.Windows.Forms.DataGridViewComboBoxColumn();
     this.TypeId    = new System.Windows.Forms.DataGridViewComboBoxColumn();
     this.SubtypeId = new System.Windows.Forms.DataGridViewComboBoxColumn();
     this.Idpas     = new System.Windows.Forms.DataGridViewComboBoxColumn();
     this.setIdDataGridViewTextBoxColumn         = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.questionOrderDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.questionZoneDataGridViewTextBoxColumn  = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.questionIdDataGridViewTextBoxColumn    = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.buttonUp               = new System.Windows.Forms.Button();
     this.imageList              = new System.Windows.Forms.ImageList(this.components);
     this.addExistingButton      = new System.Windows.Forms.Button();
     this.addNewButton           = new System.Windows.Forms.Button();
     this.removeButton           = new System.Windows.Forms.Button();
     this.buttonDown             = new System.Windows.Forms.Button();
     this.groupBox1              = new System.Windows.Forms.GroupBox();
     this.inZone3                = new System.Windows.Forms.Label();
     this.inZone2                = new System.Windows.Forms.Label();
     this.inZone1                = new System.Windows.Forms.Label();
     this.label8                 = new System.Windows.Forms.Label();
     this.label6                 = new System.Windows.Forms.Label();
     this.label4                 = new System.Windows.Forms.Label();
     this.typeLable              = new System.Windows.Forms.Label();
     this.timeLable              = new System.Windows.Forms.Label();
     this.numberOfQuestionsLable = new System.Windows.Forms.Label();
     this.label1                 = new System.Windows.Forms.Label();
     this.label5                 = new System.Windows.Forms.Label();
     this.label7                 = new System.Windows.Forms.Label();
     this.groupBox3              = new System.Windows.Forms.GroupBox();
     this.descriptionTextBox     = new System.Windows.Forms.TextBox();
     this.nameTextBox            = new System.Windows.Forms.TextBox();
     this.label2                 = new System.Windows.Forms.Label();
     this.label3                 = new System.Windows.Forms.Label();
     ((System.ComponentModel.ISupportInitialize)(this.data)).BeginInit();
     this.groupBox2.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.questionSetsDataGrid)).BeginInit();
     this.groupBox1.SuspendLayout();
     this.groupBox3.SuspendLayout();
     this.SuspendLayout();
     //
     // groupBox2
     //
     this.groupBox2.Controls.Add(this.questionSetsDataGrid);
     this.groupBox2.Controls.Add(this.buttonUp);
     this.groupBox2.Controls.Add(this.addExistingButton);
     this.groupBox2.Controls.Add(this.addNewButton);
     this.groupBox2.Controls.Add(this.removeButton);
     this.groupBox2.Controls.Add(this.buttonDown);
     this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.groupBox2.Location  = new System.Drawing.Point(3, 248);
     this.groupBox2.Name      = "groupBox2";
     this.groupBox2.Size      = new System.Drawing.Size(774, 381);
     this.groupBox2.TabIndex  = 9;
     this.groupBox2.TabStop   = false;
     this.groupBox2.Text      = "Questions";
     //
     // questionSetsDataGrid
     //
     this.questionSetsDataGrid.AllowUserToAddRows          = false;
     this.questionSetsDataGrid.AllowUserToDeleteRows       = false;
     this.questionSetsDataGrid.AllowUserToOrderColumns     = true;
     this.questionSetsDataGrid.AutoGenerateColumns         = false;
     this.questionSetsDataGrid.ColumnHeadersBorderStyle    = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
     this.questionSetsDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     this.questionSetsDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
         this.idDataGridViewTextBoxColumn,
         this.typeIdDataGridViewTextBoxColumn,
         this.subtypeIdDataGridViewTextBoxColumn,
         this.difficultyLevelIdDataGridViewTextBoxColumn,
         this.dataGridViewTextBoxColumn1,
         this.pictureDataGridViewImageColumn,
         this.difficultyLevel,
         this.TypeId,
         this.SubtypeId,
         this.Idpas,
         this.setIdDataGridViewTextBoxColumn,
         this.questionOrderDataGridViewTextBoxColumn,
         this.questionZoneDataGridViewTextBoxColumn,
         this.questionIdDataGridViewTextBoxColumn
     });
     this.questionSetsDataGrid.DataMember       = "QuestionsEx";
     this.questionSetsDataGrid.DataSource       = this.data;
     this.questionSetsDataGrid.Location         = new System.Drawing.Point(5, 46);
     this.questionSetsDataGrid.MultiSelect      = false;
     this.questionSetsDataGrid.Name             = "questionSetsDataGrid";
     this.questionSetsDataGrid.ReadOnly         = true;
     this.questionSetsDataGrid.SelectionMode    = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
     this.questionSetsDataGrid.Size             = new System.Drawing.Size(759, 329);
     this.questionSetsDataGrid.TabIndex         = 11;
     this.questionSetsDataGrid.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.questionSetsDataGrid_CellDoubleClick);
     this.questionSetsDataGrid.DataError       += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.questionSetsDataGrid_DataError);
     //
     // idDataGridViewTextBoxColumn
     //
     this.idDataGridViewTextBoxColumn.DataPropertyName = "Id";
     this.idDataGridViewTextBoxColumn.HeaderText       = "Id";
     this.idDataGridViewTextBoxColumn.Name             = "idDataGridViewTextBoxColumn";
     this.idDataGridViewTextBoxColumn.ReadOnly         = true;
     this.idDataGridViewTextBoxColumn.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
     this.idDataGridViewTextBoxColumn.Visible          = false;
     //
     // typeIdDataGridViewTextBoxColumn
     //
     this.typeIdDataGridViewTextBoxColumn.DataPropertyName = "TypeId";
     this.typeIdDataGridViewTextBoxColumn.HeaderText       = "TypeId";
     this.typeIdDataGridViewTextBoxColumn.Name             = "typeIdDataGridViewTextBoxColumn";
     this.typeIdDataGridViewTextBoxColumn.ReadOnly         = true;
     this.typeIdDataGridViewTextBoxColumn.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
     this.typeIdDataGridViewTextBoxColumn.Visible          = false;
     //
     // subtypeIdDataGridViewTextBoxColumn
     //
     this.subtypeIdDataGridViewTextBoxColumn.DataPropertyName = "SubtypeId";
     this.subtypeIdDataGridViewTextBoxColumn.HeaderText       = "SubtypeId";
     this.subtypeIdDataGridViewTextBoxColumn.Name             = "subtypeIdDataGridViewTextBoxColumn";
     this.subtypeIdDataGridViewTextBoxColumn.ReadOnly         = true;
     this.subtypeIdDataGridViewTextBoxColumn.Visible          = false;
     //
     // difficultyLevelIdDataGridViewTextBoxColumn
     //
     this.difficultyLevelIdDataGridViewTextBoxColumn.DataPropertyName = "DifficultyLevelId";
     this.difficultyLevelIdDataGridViewTextBoxColumn.HeaderText       = "DifficultyLevelId";
     this.difficultyLevelIdDataGridViewTextBoxColumn.Name             = "difficultyLevelIdDataGridViewTextBoxColumn";
     this.difficultyLevelIdDataGridViewTextBoxColumn.ReadOnly         = true;
     this.difficultyLevelIdDataGridViewTextBoxColumn.Visible          = false;
     //
     // dataGridViewTextBoxColumn1
     //
     this.dataGridViewTextBoxColumn1.DataPropertyName = "Text";
     this.dataGridViewTextBoxColumn1.HeaderText       = "Text";
     this.dataGridViewTextBoxColumn1.Name             = "dataGridViewTextBoxColumn1";
     this.dataGridViewTextBoxColumn1.ReadOnly         = true;
     this.dataGridViewTextBoxColumn1.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
     //
     // pictureDataGridViewImageColumn
     //
     this.pictureDataGridViewImageColumn.DataPropertyName = "Picture";
     this.pictureDataGridViewImageColumn.HeaderText       = "Picture";
     this.pictureDataGridViewImageColumn.ImageLayout      = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
     this.pictureDataGridViewImageColumn.Name             = "pictureDataGridViewImageColumn";
     this.pictureDataGridViewImageColumn.ReadOnly         = true;
     //
     // difficultyLevel
     //
     this.difficultyLevel.DataPropertyName = "DifficultyLevelId";
     this.difficultyLevel.DataSource       = this.data;
     this.difficultyLevel.DisplayMember    = "DifficultyLevel.Name";
     this.difficultyLevel.DisplayStyle     = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.Nothing;
     this.difficultyLevel.HeaderText       = "Difficulty level";
     this.difficultyLevel.Name             = "difficultyLevel";
     this.difficultyLevel.ReadOnly         = true;
     this.difficultyLevel.ValueMember      = "DifficultyLevel.Id";
     //
     // TypeId
     //
     this.TypeId.DataPropertyName = "TypeId";
     this.TypeId.DataSource       = this.data;
     this.TypeId.DisplayMember    = "QuestionTypes.Name";
     this.TypeId.DisplayStyle     = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.Nothing;
     this.TypeId.HeaderText       = "Type";
     this.TypeId.Name             = "TypeId";
     this.TypeId.ReadOnly         = true;
     this.TypeId.ValueMember      = "QuestionTypes.Id";
     //
     // SubtypeId
     //
     this.SubtypeId.DataPropertyName = "SubtypeId";
     this.SubtypeId.DataSource       = this.data;
     this.SubtypeId.DisplayMember    = "QuestionSubtypes.Name";
     this.SubtypeId.DisplayStyle     = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.Nothing;
     this.SubtypeId.HeaderText       = "Subtype";
     this.SubtypeId.Name             = "SubtypeId";
     this.SubtypeId.ReadOnly         = true;
     this.SubtypeId.ValueMember      = "QuestionSubtypes.Id";
     this.SubtypeId.Width            = 250;
     //
     // Idpas
     //
     this.Idpas.AutoComplete     = false;
     this.Idpas.DataPropertyName = "QuestionId";
     this.Idpas.DataSource       = this.data;
     this.Idpas.DisplayMember    = "PassagesToQuestionsEx.Text";
     this.Idpas.DisplayStyle     = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.Nothing;
     this.Idpas.HeaderText       = "Passage";
     this.Idpas.Name             = "Idpas";
     this.Idpas.ReadOnly         = true;
     this.Idpas.ValueMember      = "PassagesToQuestionsEx.Id";
     this.Idpas.Visible          = false;
     this.Idpas.Width            = 200;
     //
     // setIdDataGridViewTextBoxColumn
     //
     this.setIdDataGridViewTextBoxColumn.DataPropertyName = "SetId";
     this.setIdDataGridViewTextBoxColumn.HeaderText       = "SetId";
     this.setIdDataGridViewTextBoxColumn.Name             = "setIdDataGridViewTextBoxColumn";
     this.setIdDataGridViewTextBoxColumn.ReadOnly         = true;
     this.setIdDataGridViewTextBoxColumn.Visible          = false;
     //
     // questionOrderDataGridViewTextBoxColumn
     //
     this.questionOrderDataGridViewTextBoxColumn.DataPropertyName = "QuestionOrder";
     this.questionOrderDataGridViewTextBoxColumn.HeaderText       = "QuestionOrder";
     this.questionOrderDataGridViewTextBoxColumn.Name             = "questionOrderDataGridViewTextBoxColumn";
     this.questionOrderDataGridViewTextBoxColumn.ReadOnly         = true;
     this.questionOrderDataGridViewTextBoxColumn.Visible          = false;
     //
     // questionZoneDataGridViewTextBoxColumn
     //
     this.questionZoneDataGridViewTextBoxColumn.DataPropertyName = "QuestionZone";
     this.questionZoneDataGridViewTextBoxColumn.HeaderText       = "QuestionZone";
     this.questionZoneDataGridViewTextBoxColumn.Name             = "questionZoneDataGridViewTextBoxColumn";
     this.questionZoneDataGridViewTextBoxColumn.ReadOnly         = true;
     this.questionZoneDataGridViewTextBoxColumn.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
     this.questionZoneDataGridViewTextBoxColumn.Visible          = false;
     //
     // questionIdDataGridViewTextBoxColumn
     //
     this.questionIdDataGridViewTextBoxColumn.DataPropertyName = "QuestionId";
     this.questionIdDataGridViewTextBoxColumn.HeaderText       = "QuestionId";
     this.questionIdDataGridViewTextBoxColumn.Name             = "questionIdDataGridViewTextBoxColumn";
     this.questionIdDataGridViewTextBoxColumn.ReadOnly         = true;
     this.questionIdDataGridViewTextBoxColumn.Visible          = false;
     //
     // buttonUp
     //
     this.buttonUp.FlatStyle  = System.Windows.Forms.FlatStyle.Popup;
     this.buttonUp.ImageIndex = 0;
     this.buttonUp.ImageList  = this.imageList;
     this.buttonUp.Location   = new System.Drawing.Point(8, 16);
     this.buttonUp.Name       = "buttonUp";
     this.buttonUp.Size       = new System.Drawing.Size(17, 24);
     this.buttonUp.TabIndex   = 10;
     this.buttonUp.Click     += new System.EventHandler(this.buttonUp_Click);
     //
     // imageList
     //
     this.imageList.ImageStream      = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
     this.imageList.TransparentColor = System.Drawing.Color.Fuchsia;
     this.imageList.Images.SetKeyName(0, "");
     this.imageList.Images.SetKeyName(1, "");
     //
     // addExistingButton
     //
     this.addExistingButton.Anchor     = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.addExistingButton.FlatStyle  = System.Windows.Forms.FlatStyle.System;
     this.addExistingButton.ImageIndex = 1;
     this.addExistingButton.Location   = new System.Drawing.Point(488, 16);
     this.addExistingButton.Name       = "addExistingButton";
     this.addExistingButton.Size       = new System.Drawing.Size(88, 24);
     this.addExistingButton.TabIndex   = 7;
     this.addExistingButton.Text       = "Add &Existing...";
     this.addExistingButton.Click     += new System.EventHandler(this.addExistingButton_Click);
     //
     // addNewButton
     //
     this.addNewButton.Anchor     = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.addNewButton.FlatStyle  = System.Windows.Forms.FlatStyle.System;
     this.addNewButton.ImageIndex = 0;
     this.addNewButton.Location   = new System.Drawing.Point(582, 16);
     this.addNewButton.Name       = "addNewButton";
     this.addNewButton.Size       = new System.Drawing.Size(88, 24);
     this.addNewButton.TabIndex   = 8;
     this.addNewButton.Text       = "Add &New...";
     this.addNewButton.Click     += new System.EventHandler(this.addNewButton_Click);
     //
     // removeButton
     //
     this.removeButton.Anchor     = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.removeButton.FlatStyle  = System.Windows.Forms.FlatStyle.System;
     this.removeButton.ImageIndex = 2;
     this.removeButton.Location   = new System.Drawing.Point(676, 16);
     this.removeButton.Name       = "removeButton";
     this.removeButton.Size       = new System.Drawing.Size(88, 24);
     this.removeButton.TabIndex   = 9;
     this.removeButton.Text       = "&Remove";
     this.removeButton.Click     += new System.EventHandler(this.removeButton_Click);
     //
     // buttonDown
     //
     this.buttonDown.FlatStyle  = System.Windows.Forms.FlatStyle.Popup;
     this.buttonDown.ImageIndex = 1;
     this.buttonDown.ImageList  = this.imageList;
     this.buttonDown.Location   = new System.Drawing.Point(27, 16);
     this.buttonDown.Name       = "buttonDown";
     this.buttonDown.Size       = new System.Drawing.Size(17, 24);
     this.buttonDown.TabIndex   = 10;
     this.buttonDown.Click     += new System.EventHandler(this.buttonDown_Click);
     //
     // groupBox1
     //
     this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.groupBox1.Controls.Add(this.inZone3);
     this.groupBox1.Controls.Add(this.inZone2);
     this.groupBox1.Controls.Add(this.inZone1);
     this.groupBox1.Controls.Add(this.label8);
     this.groupBox1.Controls.Add(this.label6);
     this.groupBox1.Controls.Add(this.label4);
     this.groupBox1.Controls.Add(this.typeLable);
     this.groupBox1.Controls.Add(this.timeLable);
     this.groupBox1.Controls.Add(this.numberOfQuestionsLable);
     this.groupBox1.Controls.Add(this.label1);
     this.groupBox1.Controls.Add(this.label5);
     this.groupBox1.Controls.Add(this.label7);
     this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.groupBox1.Location  = new System.Drawing.Point(542, 5);
     this.groupBox1.Name      = "groupBox1";
     this.groupBox1.Size      = new System.Drawing.Size(237, 126);
     this.groupBox1.TabIndex  = 11;
     this.groupBox1.TabStop   = false;
     this.groupBox1.Text      = "Information";
     //
     // inZone3
     //
     this.inZone3.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.inZone3.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.inZone3.Location  = new System.Drawing.Point(147, 93);
     this.inZone3.Name      = "inZone3";
     this.inZone3.Size      = new System.Drawing.Size(80, 16);
     this.inZone3.TabIndex  = 22;
     this.inZone3.Text      = "999";
     this.inZone3.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // inZone2
     //
     this.inZone2.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.inZone2.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.inZone2.Location  = new System.Drawing.Point(147, 78);
     this.inZone2.Name      = "inZone2";
     this.inZone2.Size      = new System.Drawing.Size(80, 16);
     this.inZone2.TabIndex  = 21;
     this.inZone2.Text      = "999";
     this.inZone2.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // inZone1
     //
     this.inZone1.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.inZone1.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.inZone1.Location  = new System.Drawing.Point(147, 63);
     this.inZone1.Name      = "inZone1";
     this.inZone1.Size      = new System.Drawing.Size(80, 16);
     this.inZone1.TabIndex  = 20;
     this.inZone1.Text      = "999";
     this.inZone1.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // label8
     //
     this.label8.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label8.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.label8.Location  = new System.Drawing.Point(11, 78);
     this.label8.Name      = "label8";
     this.label8.Size      = new System.Drawing.Size(104, 16);
     this.label8.TabIndex  = 19;
     this.label8.Text      = "Questions in zone 2";
     //
     // label6
     //
     this.label6.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label6.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.label6.Location  = new System.Drawing.Point(11, 94);
     this.label6.Name      = "label6";
     this.label6.Size      = new System.Drawing.Size(104, 15);
     this.label6.TabIndex  = 18;
     this.label6.Text      = "Questions in zone 3";
     //
     // label4
     //
     this.label4.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label4.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.label4.Location  = new System.Drawing.Point(11, 62);
     this.label4.Name      = "label4";
     this.label4.Size      = new System.Drawing.Size(104, 16);
     this.label4.TabIndex  = 17;
     this.label4.Text      = "Questions in zone 1";
     //
     // typeLable
     //
     this.typeLable.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.typeLable.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.typeLable.Location  = new System.Drawing.Point(107, 16);
     this.typeLable.Name      = "typeLable";
     this.typeLable.Size      = new System.Drawing.Size(120, 16);
     this.typeLable.TabIndex  = 12;
     this.typeLable.Text      = "Reading Comprehension";
     this.typeLable.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // timeLable
     //
     this.timeLable.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.timeLable.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.timeLable.Location  = new System.Drawing.Point(147, 32);
     this.timeLable.Name      = "timeLable";
     this.timeLable.Size      = new System.Drawing.Size(80, 16);
     this.timeLable.TabIndex  = 16;
     this.timeLable.Text      = "Unlimited";
     this.timeLable.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // numberOfQuestionsLable
     //
     this.numberOfQuestionsLable.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.numberOfQuestionsLable.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.numberOfQuestionsLable.Location  = new System.Drawing.Point(147, 47);
     this.numberOfQuestionsLable.Name      = "numberOfQuestionsLable";
     this.numberOfQuestionsLable.Size      = new System.Drawing.Size(80, 16);
     this.numberOfQuestionsLable.TabIndex  = 15;
     this.numberOfQuestionsLable.Text      = "999";
     this.numberOfQuestionsLable.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // label1
     //
     this.label1.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.label1.Location  = new System.Drawing.Point(11, 15);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(32, 16);
     this.label1.TabIndex  = 8;
     this.label1.Text      = "Type:";
     this.label1.Click    += new System.EventHandler(this.label1_Click);
     //
     // label5
     //
     this.label5.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label5.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.label5.Location  = new System.Drawing.Point(11, 30);
     this.label5.Name      = "label5";
     this.label5.Size      = new System.Drawing.Size(80, 16);
     this.label5.TabIndex  = 9;
     this.label5.Text      = "Time Limit:";
     //
     // label7
     //
     this.label7.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label7.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.label7.Location  = new System.Drawing.Point(11, 46);
     this.label7.Name      = "label7";
     this.label7.Size      = new System.Drawing.Size(104, 16);
     this.label7.TabIndex  = 10;
     this.label7.Text      = "# of Questions:";
     //
     // groupBox3
     //
     this.groupBox3.Controls.Add(this.descriptionTextBox);
     this.groupBox3.Controls.Add(this.nameTextBox);
     this.groupBox3.Controls.Add(this.label2);
     this.groupBox3.Controls.Add(this.label3);
     this.groupBox3.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.groupBox3.Location  = new System.Drawing.Point(3, 3);
     this.groupBox3.Name      = "groupBox3";
     this.groupBox3.Size      = new System.Drawing.Size(531, 239);
     this.groupBox3.TabIndex  = 12;
     this.groupBox3.TabStop   = false;
     //
     // descriptionTextBox
     //
     this.descriptionTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.data, "Tests.Description", true));
     this.descriptionTextBox.Location  = new System.Drawing.Point(5, 56);
     this.descriptionTextBox.Multiline = true;
     this.descriptionTextBox.Name      = "descriptionTextBox";
     this.descriptionTextBox.Size      = new System.Drawing.Size(520, 177);
     this.descriptionTextBox.TabIndex  = 5;
     //
     // nameTextBox
     //
     this.nameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.data, "Tests.Name", true));
     this.nameTextBox.Location = new System.Drawing.Point(42, 14);
     this.nameTextBox.Name     = "nameTextBox";
     this.nameTextBox.Size     = new System.Drawing.Size(483, 20);
     this.nameTextBox.TabIndex = 2;
     //
     // label2
     //
     this.label2.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.label2.Location  = new System.Drawing.Point(6, 17);
     this.label2.Name      = "label2";
     this.label2.Size      = new System.Drawing.Size(48, 17);
     this.label2.TabIndex  = 4;
     this.label2.Text      = "Name";
     //
     // label3
     //
     this.label3.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.label3.Location  = new System.Drawing.Point(6, 37);
     this.label3.Name      = "label3";
     this.label3.Size      = new System.Drawing.Size(64, 16);
     this.label3.TabIndex  = 3;
     this.label3.Text      = "Description";
     //
     // QuestionSetEditor
     //
     this.Controls.Add(this.groupBox3);
     this.Controls.Add(this.groupBox1);
     this.Controls.Add(this.groupBox2);
     this.Name   = "QuestionSetEditor";
     this.Size   = new System.Drawing.Size(782, 632);
     this.Enter += new System.EventHandler(this.QuestionSetEditor_Enter);
     this.Load  += new System.EventHandler(this.QuestionSetEditor_Load);
     ((System.ComponentModel.ISupportInitialize)(this.data)).EndInit();
     this.groupBox2.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.questionSetsDataGrid)).EndInit();
     this.groupBox1.ResumeLayout(false);
     this.groupBox3.ResumeLayout(false);
     this.groupBox3.PerformLayout();
     this.ResumeLayout(false);
 }
Example #40
0
        public void crearPantalla()
        {
            form = new Form();
            form.SuspendLayout();
            form.Size    = new Size(851, 508);
            form.Name    = "Form1";
            form.Text    = "Form1";
            form.Visible = true;

            this.lbTituloEncuesta    = new System.Windows.Forms.Label();
            this.listaEncuestas      = new System.Windows.Forms.DataGridView();
            this.btnTrabajarEncuesta = new System.Windows.Forms.Button();
            this.RBeditar            = new System.Windows.Forms.RadioButton();
            this.RBeliminar          = new System.Windows.Forms.RadioButton();
            this.btnAgregarEncuesta  = new System.Windows.Forms.Button();
            this.btnCerrarSession    = new System.Windows.Forms.Button();

            //
            // lbTituloEncuesta
            //
            this.lbTituloEncuesta.Font     = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold);
            this.lbTituloEncuesta.Location = new System.Drawing.Point(236, 18);
            this.lbTituloEncuesta.Name     = "lbTituloEncuesta";
            this.lbTituloEncuesta.Size     = new System.Drawing.Size(390, 36);
            this.lbTituloEncuesta.TabIndex = 0;
            this.lbTituloEncuesta.Text     = "Selecciona una Encuestas";
            //
            // listaEncuestas
            //
            this.listaEncuestas.Location           = new System.Drawing.Point(58, 151);
            this.listaEncuestas.Name               = "listaEncuestas";
            this.listaEncuestas.RowHeadersWidth    = 51;
            this.listaEncuestas.RowTemplate.Height = 24;
            this.listaEncuestas.Size               = new System.Drawing.Size(464, 309);
            this.listaEncuestas.TabIndex           = 2;
            listaEncuestas.CellClick              += new DataGridViewCellEventHandler(DataGridView1_CellDoubleClick);
            //
            // btnTrabajarEncuesta
            //
            this.btnTrabajarEncuesta.Font     = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Bold);
            this.btnTrabajarEncuesta.Location = new System.Drawing.Point(548, 292);
            this.btnTrabajarEncuesta.Name     = "btnTrabajarEncuesta";
            this.btnTrabajarEncuesta.Size     = new System.Drawing.Size(240, 78);
            this.btnTrabajarEncuesta.TabIndex = 3;
            this.btnTrabajarEncuesta.Text     = "Trabajar en Encuesta";
            this.btnTrabajarEncuesta.UseVisualStyleBackColor = true;
            btnTrabajarEncuesta.Click += new EventHandler(TrabajarConEncuesta);
            //
            // RBeditar
            //
            this.RBeditar.Font     = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Bold);
            this.RBeditar.Location = new System.Drawing.Point(566, 151);
            this.RBeditar.Name     = "RBeditar";
            this.RBeditar.Size     = new System.Drawing.Size(103, 33);
            this.RBeditar.TabIndex = 4;
            this.RBeditar.TabStop  = true;
            this.RBeditar.Text     = "Editar";
            this.RBeditar.UseVisualStyleBackColor = true;
            //
            // RBeliminar
            //
            this.RBeliminar.Font     = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Bold);
            this.RBeliminar.Location = new System.Drawing.Point(566, 216);
            this.RBeliminar.Name     = "RBeliminar";
            this.RBeliminar.Size     = new System.Drawing.Size(130, 33);
            this.RBeliminar.TabIndex = 5;
            this.RBeliminar.TabStop  = true;
            this.RBeliminar.Text     = "Eliminar";
            this.RBeliminar.UseVisualStyleBackColor = true;
            //
            // btnAgregarEncuesta
            //
            this.btnAgregarEncuesta.Font     = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Bold);
            this.btnAgregarEncuesta.Location = new System.Drawing.Point(160, 79);
            this.btnAgregarEncuesta.Name     = "btnAgregarEncuesta";
            this.btnAgregarEncuesta.Size     = new System.Drawing.Size(242, 51);
            this.btnAgregarEncuesta.TabIndex = 6;
            this.btnAgregarEncuesta.Text     = "Agregar Encuesta";
            this.btnAgregarEncuesta.UseVisualStyleBackColor = true;
            btnAgregarEncuesta.Click += new EventHandler(CrearEncuesta);

            //
            // btnCerrarSession
            //
            this.btnCerrarSession.Font     = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btnCerrarSession.Location = new System.Drawing.Point(548, 389);
            this.btnCerrarSession.Name     = "btnCerrarSession";
            this.btnCerrarSession.Size     = new System.Drawing.Size(242, 71);
            this.btnCerrarSession.TabIndex = 7;
            this.btnCerrarSession.Text     = "Cerrar Session";
            this.btnCerrarSession.UseVisualStyleBackColor = true;
            btnCerrarSession.Click += new EventHandler(CerrarSession);

            //
            // Form2
            //
            form.Controls.Add(btnAgregarEncuesta);
            form.Controls.Add(RBeliminar);
            form.Controls.Add(RBeditar);
            form.Controls.Add(btnTrabajarEncuesta);
            form.Controls.Add(listaEncuestas);
            form.Controls.Add(lbTituloEncuesta);
            form.Controls.Add(btnCerrarSession);

            CargarEncuesta();
        }
Example #41
0
        /// <summary>
        /// Рекурсивно перевести элементы управления Windows-формы
        /// </summary>
        private static void TranslateWinControls(IList controls, WinForms.ToolTip toolTip,
                                                 Dictionary <string, ControlInfo> controlInfoDict)
        {
            if (controls == null)
            {
                return;
            }

            foreach (object elem in controls)
            {
                ControlInfo controlInfo;

                if (elem is WinForms.Control)
                {
                    // обработка обычного элемента управления
                    WinForms.Control control = (WinForms.Control)elem;
                    if (!string.IsNullOrEmpty(control.Name) /*например, поле ввода и кнопки NumericUpDown*/ &&
                        controlInfoDict.TryGetValue(control.Name, out controlInfo))
                    {
                        if (controlInfo.Text != null)
                        {
                            control.Text = controlInfo.Text;
                        }

                        if (controlInfo.ToolTip != null && toolTip != null)
                        {
                            toolTip.SetToolTip(control, controlInfo.ToolTip);
                        }

                        if (controlInfo.Items != null && elem is WinForms.ComboBox)
                        {
                            WinForms.ComboBox comboBox = (WinForms.ComboBox)elem;
                            int cnt = Math.Min(comboBox.Items.Count, controlInfo.Items.Count);
                            for (int i = 0; i < cnt; i++)
                            {
                                string itemText = controlInfo.Items[i];
                                if (itemText != null)
                                {
                                    comboBox.Items[i] = itemText;
                                }
                            }
                        }
                    }

                    if (elem is WinForms.MenuStrip)
                    {
                        // запуск обработки элементов меню
                        WinForms.MenuStrip menuStrip = (WinForms.MenuStrip)elem;
                        TranslateWinControls(menuStrip.Items, toolTip, controlInfoDict);
                    }
                    else if (elem is WinForms.ToolStrip)
                    {
                        // запуск обработки элементов панели инструментов
                        WinForms.ToolStrip toolStrip = (WinForms.ToolStrip)elem;
                        TranslateWinControls(toolStrip.Items, toolTip, controlInfoDict);
                    }
                    else if (elem is WinForms.DataGridView)
                    {
                        // запуск обработки столбцов таблицы
                        WinForms.DataGridView dataGridView = (WinForms.DataGridView)elem;
                        TranslateWinControls(dataGridView.Columns, toolTip, controlInfoDict);
                    }
                    else if (elem is WinForms.ListView)
                    {
                        // запуск обработки столбцов списка
                        WinForms.ListView listView = (WinForms.ListView)elem;
                        TranslateWinControls(listView.Columns, toolTip, controlInfoDict);
                    }

                    // запуск обработки дочерних элементов
                    if (control.HasChildren)
                    {
                        TranslateWinControls(control.Controls, toolTip, controlInfoDict);
                    }
                }
                else if (elem is WinForms.ToolStripItem)
                {
                    // обработка элемента меню или элемента панели инструментов
                    WinForms.ToolStripItem item = (WinForms.ToolStripItem)elem;
                    if (controlInfoDict.TryGetValue(item.Name, out controlInfo))
                    {
                        if (controlInfo.Text != null)
                        {
                            item.Text = controlInfo.Text;
                        }
                        if (controlInfo.ToolTip != null)
                        {
                            item.ToolTipText = controlInfo.ToolTip;
                        }
                    }

                    if (elem is WinForms.ToolStripMenuItem)
                    {
                        // запуск обработки элементов подменю
                        WinForms.ToolStripMenuItem menuItem = (WinForms.ToolStripMenuItem)elem;
                        if (menuItem.HasDropDownItems)
                        {
                            TranslateWinControls(menuItem.DropDownItems, toolTip, controlInfoDict);
                        }
                    }
                }
                else if (elem is WinForms.DataGridViewColumn)
                {
                    // обработка столбца таблицы
                    WinForms.DataGridViewColumn column = (WinForms.DataGridViewColumn)elem;
                    if (controlInfoDict.TryGetValue(column.Name, out controlInfo) && controlInfo.Text != null)
                    {
                        column.HeaderText = controlInfo.Text;
                    }
                }
                else if (elem is WinForms.ColumnHeader)
                {
                    // обработка столбца списка
                    WinForms.ColumnHeader columnHeader = (WinForms.ColumnHeader)elem;
                    if (controlInfoDict.TryGetValue(columnHeader.Name, out controlInfo) && controlInfo.Text != null)
                    {
                        columnHeader.Text = controlInfo.Text;
                    }
                }
            }
        }
 internal DataGridViewSelectedRowCollection(DataGridView dataGridView)
 {
     this.dataGridView = dataGridView;
 }
 internal void AddScope(DataGridView dataGridView, DataGridViewCellStyleScopes scope)
 {
     this.scope       |= scope;
     this.dataGridView = dataGridView;
 }
Example #44
0
        public void Read(System.Windows.Forms.DataGridView dgvdb, System.Windows.Forms.DataGridView dgvsrc, System.Windows.Forms.DataGridView dgvdst)
        {
            XmlDocument XmlDb  = DataGridToXml(dgvdb, "DbSet");
            XmlDocument XmlSrc = DataGridToXml(dgvsrc, "Src");
            XmlDocument XmlDst = DataGridToXml(dgvdst, "Dst");

            xedbroot = XmlDb.DocumentElement;
            xesrc    = (XmlElement)XmlSrc.DocumentElement.FirstChild;
            if (XmlDst != null)
            {
                xedst = (XmlElement)XmlDst.DocumentElement.FirstChild;
            }
            ;
        }
Example #45
0
        private void InitializeComponent()
        {
            components         = new System.ComponentModel.Container();
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            _cellTemplateAlignRight           = new DataGridViewCellStyle();
            _cellTemplateAlignRight.Alignment = DataGridViewContentAlignment.MiddleRight;

            _cellTemplateAlignCenter           = new DataGridViewCellStyle();
            _cellTemplateAlignCenter.Alignment = DataGridViewContentAlignment.MiddleCenter;

            this._dataGridViewRefund   = new DataGridView();
            this.ColumnRfdAvatar       = new DataGridViewImageColumn();
            this.ColumnRfdAmount       = new DataGridViewTextBoxColumn();
            this.ColumnRfdUserGiver    = new DataGridViewTextBoxColumn();
            this.ColumnRfdUserReceiver = new DataGridViewTextBoxColumn();
            this.ColumnRfdCurrency     = new DataGridViewTextBoxColumn();
            this.ColumnRfdCurrencyPict = new DataGridViewImageColumn();
            this.ColumnRfdExchangeDone = new DataGridViewImageColumn();
            this.ColumnRfdGift         = new DataGridViewImageColumn();
            this.ColumnRfdCanceled     = new DataGridViewImageColumn();
            this.ColumnRfdStatus       = new DataGridViewTextBoxColumn();
            this.ColumnRfdId           = new DataGridViewTextBoxColumn();
            //
            // dataGridViewRefund
            //
            this._dataGridViewRefund.AllowUserToAddRows          = false;
            this._dataGridViewRefund.AllowUserToDeleteRows       = false;
            this._dataGridViewRefund.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this._dataGridViewRefund.ColumnHeadersVisible        = true;
            this._dataGridViewRefund.ScrollBars = ScrollBars.Both;
            this._dataGridViewRefund.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                this.ColumnRfdId,
                this.ColumnRfdAmount,
                this.ColumnRfdCurrency,
                this.ColumnRfdCurrencyPict,
                this.ColumnRfdUserGiver,
                this.ColumnRfdAvatar,
                this.ColumnRfdUserReceiver,
                this.ColumnRfdExchangeDone,
                this.ColumnRfdGift,
                this.ColumnRfdCanceled,
                this.ColumnRfdStatus
            });
            this._dataGridViewRefund.Dock                                = System.Windows.Forms.DockStyle.Top;
            this._dataGridViewRefund.Location                            = new System.Drawing.Point(0, 0);
            this._dataGridViewRefund.MultiSelect                         = false;
            this._dataGridViewRefund.Name                                = "dataGridViewRefund";
            this._dataGridViewRefund.RowHeadersVisible                   = false;
            this._dataGridViewRefund.AutoSize                            = false;
            this._dataGridViewRefund.TabIndex                            = 0;
            this._dataGridViewRefund.BackgroundColor                     = Color.FromArgb(255, 85, 85, 85);
            this._dataGridViewRefund.ForeColor                           = Color.Silver;
            this._dataGridViewRefund.DefaultCellStyle.BackColor          = Color.FromArgb(255, 85, 85, 85);
            this._dataGridViewRefund.CellBorderStyle                     = DataGridViewCellBorderStyle.SingleHorizontal;
            this._dataGridViewRefund.DefaultCellStyle.SelectionBackColor = this._dataGridViewRefund.DefaultCellStyle.BackColor;
            this._dataGridViewRefund.CellClick                          += _dataGridViewRefund_CellClick;
            ((System.ComponentModel.ISupportInitialize)(this._dataGridViewRefund)).BeginInit();
            //
            // ColumnRfdAvatar
            //
            this.ColumnRfdAvatar.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
            this.ColumnRfdAvatar.HeaderText   = string.Empty;
            this.ColumnRfdAvatar.Image        = ((System.Drawing.Image)(ResourceIconSet16Default.user_gray));
            this.ColumnRfdAvatar.Name         = "ColumnRfdAvatar";
            this.ColumnRfdAvatar.Resizable    = System.Windows.Forms.DataGridViewTriState.True;
            this.ColumnRfdAvatar.SortMode     = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.ColumnRfdAvatar.Width        = 5;
            //
            // ColumnRfdId
            //
            this.ColumnRfdId.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
            this.ColumnRfdId.HeaderText   = string.Empty;
            this.ColumnRfdId.Name         = "ColumnRfdId";
            this.ColumnRfdId.Width        = 5;
            this.ColumnRfdId.Visible      = false;
            //
            // ColumnRfdUserGiver
            //
            this.ColumnRfdUserGiver.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            this.ColumnRfdUserGiver.HeaderText   = "Giver";
            this.ColumnRfdUserGiver.Name         = "ColumnRfdUserGiver";
            this.ColumnRfdUserGiver.Width        = 5;
            //
            // ColumnRfdUserReceiver
            //
            this.ColumnRfdUserReceiver.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            this.ColumnRfdUserReceiver.HeaderText   = "Receiver";
            this.ColumnRfdUserReceiver.Name         = "ColumnRfdUserReceiver";
            this.ColumnRfdUserReceiver.Width        = 5;
            //
            // ColumnRfdAmount
            //
            this.ColumnRfdAmount.AutoSizeMode     = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
            this.ColumnRfdAmount.HeaderText       = "Amount";
            this.ColumnRfdAmount.Name             = "ColumnRfdAmount";
            this.ColumnRfdAmount.Width            = 5;
            this.ColumnRfdAmount.DefaultCellStyle = _cellTemplateAlignRight;
            //
            // ColumnRfdCurrency
            //
            this.ColumnRfdCurrency.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
            this.ColumnRfdCurrency.HeaderText   = string.Empty;
            this.ColumnRfdCurrency.Name         = "ColumnRfdCurrency";
            this.ColumnRfdCurrency.Width        = 5;
            this.ColumnRfdCurrency.ToolTipText  = "Used currency";
            //
            // ColumnRfdCurrencyPict
            //
            this.ColumnRfdCurrencyPict.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
            this.ColumnRfdCurrencyPict.HeaderText   = string.Empty;
            this.ColumnRfdCurrencyPict.Name         = "ColumnRfdCurrencyPict";
            this.ColumnRfdCurrencyPict.Resizable    = System.Windows.Forms.DataGridViewTriState.True;
            this.ColumnRfdCurrencyPict.SortMode     = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.ColumnRfdCurrencyPict.Width        = 5;
            //
            // ColumnRfdStatus
            //
            this.ColumnRfdStatus.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
            this.ColumnRfdStatus.HeaderText   = "Status";
            this.ColumnRfdStatus.Name         = "ColumnRfdStatus";
            this.ColumnRfdStatus.Width        = 5;
            //
            // ColumnRfdExchangeDone
            //
            this.ColumnRfdExchangeDone.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
            this.ColumnRfdExchangeDone.HeaderText   = string.Empty;
            this.ColumnRfdExchangeDone.Name         = "ColumnRfdExchangeDone";
            this.ColumnRfdExchangeDone.Resizable    = System.Windows.Forms.DataGridViewTriState.True;
            this.ColumnRfdExchangeDone.SortMode     = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.ColumnRfdExchangeDone.Width        = 5;
            //
            // ColumnRfdGift
            //
            this.ColumnRfdGift.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
            this.ColumnRfdGift.HeaderText   = string.Empty;
            this.ColumnRfdGift.Name         = "ColumnRfdGift";
            this.ColumnRfdGift.Resizable    = System.Windows.Forms.DataGridViewTriState.True;
            this.ColumnRfdGift.SortMode     = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.ColumnRfdGift.Width        = 5;
            //
            // ColumnRfdCanceled
            //
            this.ColumnRfdCanceled.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
            this.ColumnRfdCanceled.HeaderText   = string.Empty;
            this.ColumnRfdCanceled.Name         = "ColumnRfdCanceled";
            this.ColumnRfdCanceled.Resizable    = System.Windows.Forms.DataGridViewTriState.True;
            this.ColumnRfdCanceled.SortMode     = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.ColumnRfdCanceled.Width        = 5;
            this.Controls.Add(_dataGridViewRefund);
            ((System.ComponentModel.ISupportInitialize)(this._dataGridViewRefund)).EndInit();
        }
Example #46
0
        internal override void Initialize(List <GPXLoader.Cache> allgc, System.Windows.Forms.DataGridView grid)
        {
            grid.ColumnCount   = 3;
            grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            var byOwner = allgc.GroupBy(c => c.Owner).OrderByDescending(g => g.Count());

            //initialization for columns
            var iCol = 0;
            var col  = grid.Columns[iCol++];

            col.Name = "Owner";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft;

            col                  = grid.Columns[iCol++];
            col.Name             = "Count";
            col.DataPropertyName = "count";

            col                            = grid.Columns[iCol++];
            col.Name                       = "Percent";
            col.DataPropertyName           = "percent";
            col.SortMode                   = DataGridViewColumnSortMode.NotSortable;
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

            int       totCache = allgc.Count;
            int       count    = 0;
            const int MAX      = 500;

            foreach (var o in byOwner)
            {
                var       cacheList = o.ToList();
                OwnerData od        = new OwnerData()
                {
                    Owner = o.First().Owner,
                    Count = o.Count()
                };
                od.Percent = string.Format("{0:#.##}%", 100.0 * (float)od.Count / (float)totCache);

                var row = new DataGridViewRow();
                row.Cells.Add(new DataGridViewTextBoxCell()
                {
                    Value = od.Owner,
                    Tag   = cacheList
                });
                row.Cells.Add(new DataGridViewTextBoxCell()
                {
                    Value = od.Count,
                    Tag   = cacheList
                });
                row.Cells.Add(new DataGridViewTextBoxCell()
                {
                    Value = od.Percent,
                    Tag   = cacheList
                });

                ++count;
                row.HeaderCell.Value = (count).ToString();
                grid.Rows.Add(row);

                if (count == MAX)
                {
                    break;
                }
            }
        }
Example #47
0
        /// <summary>
        /// считываем из экселя в грид
        /// </summary>
        /// <param name="dataGridView1">куда считываем</param>
        public void ReadFromExcell(System.Windows.Forms.DataGridView dataGridView1)
        {
            Microsoft.Office.Interop.Excel.Application ObjExcel;
            Microsoft.Office.Interop.Excel.Workbook    ObjWorkBook;
            Microsoft.Office.Interop.Excel.Worksheet   ObjWorkSheet;


            //Диалоговое окно выбора файла с фильтром
            OpenFileDialog openDialog = new OpenFileDialog();

            openDialog.Filter = "Файл Excel|*.XLSX;*.XLS";
            openDialog.ShowDialog();
            try
            {
                //Приложение самого Excel
                ObjExcel = new Microsoft.Office.Interop.Excel.Application();
                //Книга.
                ObjWorkBook = ObjExcel.Workbooks.Open(openDialog.FileName);
                //Таблица.
                ObjWorkSheet = ObjExcel.ActiveSheet as Microsoft.Office.Interop.Excel.Worksheet;
                //Ячейка
                //Microsoft.Office.Interop.Excel.Range rg = null;
                bool flag = true; //флаг на добавление строчек row в стринггрид только один раз много штучек)
                //Int32 row = 1;
                dataGridView1.Rows.Clear();



                List <double> arr = new List <double>();

                var lastCell = ObjWorkSheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell); //1 ячейку
                string[,] list = new string[lastCell.Column, lastCell.Row];                    // все данные.
                // массив значений с листа равен по размеру листу

                countObj    = lastCell.Column;
                countAttrib = lastCell.Row;

                for (int i = 0; i < lastCell.Column; i++) // цикл по всем колонкам
                {
                    dataGridView1.Columns.Add(i.ToString(), ObjWorkSheet.Cells[1, i + 1].Text.ToString());
                    dataGridView1.Columns[i].Name = ObjWorkSheet.Cells[1, i + 1].Text.ToString();   //&&&&&&&??????


                    if (flag) //создаю строки.
                    {
                        dataGridView1.Rows.Add(lastCell.Row - 1);
                        flag = false;
                    }


                    for (int j = 0; j < lastCell.Row; j++)                             // по всем строкам   /// 1
                    {
                        list[i, j] = ObjWorkSheet.Cells[j + 2, i + 1].Text.ToString(); //считываем текст в строку
                        dataGridView1.Rows[j].Cells[i].Value = list[i, j];             /// -1
                    }
                }

                for (int j = 0; j < countAttrib - 1; j++)
                {
                    ArrayList attribs = new ArrayList();
                    for (int i = 0; i < countObj; i++)
                    {
                        attribs.Add(double.Parse(list[i, j]));
                    }
                    allObjects.Add(new MyObject(attribs)); // здесь наши объекты.
                }


                ObjWorkBook.Close(false, Type.Missing, Type.Missing); //закрыть не сохраняя

                //Закрытие книгу Excel.


                //Закрытие приложения Excel.

                ObjExcel.Quit();

                //Обнуляем созданые объекты

                ObjWorkBook = null;

                ObjWorkSheet = null;

                ObjExcel = null;

                //Вызываем сборщик мусора для их уничтожения и освобождения памяти

                GC.Collect();

                MessageBox.Show("Файл успешно считан!", "Считывания excel файла");
            }
            catch (Exception ex) { MessageBox.Show("Ошибка: " + ex.Message, "Ошибка при считывании excel файла"); }
        }
Example #48
0
 private void InitializeComponent()
 {
     System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
     System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
     this._label        = new System.Windows.Forms.Label();
     this._addButton    = new System.Windows.Forms.Button();
     this._deleteButton = new System.Windows.Forms.Button();
     this._dataGridView = new System.Windows.Forms.DataGridView();
     this.Column1       = new System.Windows.Forms.DataGridViewComboBoxColumn();
     this.Column2       = new System.Windows.Forms.DataGridViewTextBoxColumn();
     ((System.ComponentModel.ISupportInitialize)(this._dataGridView)).BeginInit();
     this.SuspendLayout();
     //
     // _label
     //
     this._label.AutoSize = true;
     this._label.Location = new System.Drawing.Point(0, 9);
     this._label.Margin   = new System.Windows.Forms.Padding(4, 0, 4, 0);
     this._label.Name     = "_label";
     this._label.Size     = new System.Drawing.Size(110, 13);
     this._label.TabIndex = 0;
     this._label.Text     = "[Enter label text here]:";
     //
     // _addButton
     //
     this._addButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this._addButton.Cursor = System.Windows.Forms.Cursors.Hand;
     this._addButton.FlatAppearance.BorderSize = 0;
     this._addButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     this._addButton.Font      = new System.Drawing.Font("Microsoft Sans Serif", 12.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this._addButton.Location  = new System.Drawing.Point(186, 7);
     this._addButton.Margin    = new System.Windows.Forms.Padding(4);
     this._addButton.Name      = "_addButton";
     this._addButton.Size      = new System.Drawing.Size(32, 28);
     this._addButton.TabIndex  = 1;
     this._addButton.Text      = "+";
     this._addButton.UseVisualStyleBackColor = true;
     this._addButton.Click += new System.EventHandler(this.AddButtonClick);
     //
     // _deleteButton
     //
     this._deleteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this._deleteButton.Cursor = System.Windows.Forms.Cursors.Hand;
     this._deleteButton.FlatAppearance.BorderSize = 0;
     this._deleteButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     this._deleteButton.Font      = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this._deleteButton.Location  = new System.Drawing.Point(218, 1);
     this._deleteButton.Margin    = new System.Windows.Forms.Padding(4);
     this._deleteButton.Name      = "_deleteButton";
     this._deleteButton.Size      = new System.Drawing.Size(30, 35);
     this._deleteButton.TabIndex  = 2;
     this._deleteButton.Text      = "-";
     this._deleteButton.UseVisualStyleBackColor = true;
     this._deleteButton.Click += new System.EventHandler(this.DeleteButtonClick);
     //
     // _dataGridView
     //
     this._dataGridView.AllowUserToAddRows    = false;
     this._dataGridView.AllowUserToDeleteRows = false;
     this._dataGridView.AllowUserToResizeRows = false;
     this._dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                        | System.Windows.Forms.AnchorStyles.Left)
                                                                       | System.Windows.Forms.AnchorStyles.Right)));
     this._dataGridView.AutoSizeColumnsMode           = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
     this._dataGridView.BackgroundColor               = System.Drawing.SystemColors.ControlLight;
     this._dataGridView.BorderStyle                   = System.Windows.Forms.BorderStyle.Fixed3D;
     this._dataGridView.ClipboardCopyMode             = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable;
     dataGridViewCellStyle3.Alignment                 = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
     dataGridViewCellStyle3.BackColor                 = System.Drawing.SystemColors.Control;
     dataGridViewCellStyle3.Font                      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     dataGridViewCellStyle3.ForeColor                 = System.Drawing.SystemColors.WindowText;
     dataGridViewCellStyle3.SelectionBackColor        = System.Drawing.SystemColors.Highlight;
     dataGridViewCellStyle3.SelectionForeColor        = System.Drawing.SystemColors.HighlightText;
     dataGridViewCellStyle3.WrapMode                  = System.Windows.Forms.DataGridViewTriState.False;
     this._dataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3;
     this._dataGridView.ColumnHeadersHeightSizeMode   = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     this._dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
         this.Column1,
         this.Column2
     });
     dataGridViewCellStyle4.Alignment          = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
     dataGridViewCellStyle4.BackColor          = System.Drawing.SystemColors.Window;
     dataGridViewCellStyle4.Font               = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     dataGridViewCellStyle4.ForeColor          = System.Drawing.SystemColors.ControlText;
     dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
     dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
     dataGridViewCellStyle4.WrapMode           = System.Windows.Forms.DataGridViewTriState.False;
     this._dataGridView.DefaultCellStyle       = dataGridViewCellStyle4;
     this._dataGridView.EditMode               = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
     this._dataGridView.Location               = new System.Drawing.Point(4, 40);
     this._dataGridView.Margin            = new System.Windows.Forms.Padding(4);
     this._dataGridView.Name              = "_dataGridView";
     this._dataGridView.RowHeadersVisible = false;
     this._dataGridView.RowTemplate.DefaultCellStyle.ForeColor = System.Drawing.Color.Black;
     this._dataGridView.RowTemplate.Height    = 20;
     this._dataGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
     this._dataGridView.SelectionMode         = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
     this._dataGridView.Size        = new System.Drawing.Size(244, 137);
     this._dataGridView.TabIndex    = 3;
     this._dataGridView.MouseLeave += new System.EventHandler(this._dataGridView_Leave);
     //
     // Column1
     //
     this.Column1.HeaderText = "Column1";
     this.Column1.Items.AddRange(new object[] {
         "Value1",
         "Value2"
     });
     this.Column1.Name = "Column1";
     //
     // Column2
     //
     this.Column2.HeaderText = "Column2";
     this.Column2.Name       = "Column2";
     //
     // OptionsGrid
     //
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     this.BackColor     = System.Drawing.Color.Transparent;
     this.Controls.Add(this._dataGridView);
     this.Controls.Add(this._deleteButton);
     this.Controls.Add(this._addButton);
     this.Controls.Add(this._label);
     this.Margin = new System.Windows.Forms.Padding(4);
     this.Name   = "OptionsGrid";
     this.Size   = new System.Drawing.Size(251, 188);
     ((System.ComponentModel.ISupportInitialize)(this._dataGridView)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Example #49
0
        protected internal virtual void PaintCells(Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow, DataGridViewPaintParts paintParts)
        {
            List <DataGridViewColumn> sortedColumns = DataGridView.Columns.ColumnDisplayIndexSortedArrayList;

            Rectangle bounds = rowBounds;

            // If row headers are visible, adjust our starting point
            if (DataGridView.RowHeadersVisible)
            {
                bounds.X     += DataGridView.RowHeadersWidth;
                bounds.Width -= DataGridView.RowHeadersWidth;
            }

            for (int i = DataGridView.first_col_index; i < sortedColumns.Count; i++)
            {
                DataGridViewColumn col = sortedColumns[i];

                if (!col.Visible)
                {
                    continue;
                }

                if (!col.Displayed)
                {
                    break;
                }

                bounds.Width = col.Width;
                DataGridViewCell cell = Cells[col.Index];

                if ((paintParts & DataGridViewPaintParts.Background) == DataGridViewPaintParts.Background)
                {
                    graphics.FillRectangle(Brushes.White, bounds);
                }

                DataGridViewCellStyle style;

                if (cell.RowIndex == -1)
                {
                    style = DefaultCellStyle;
                }
                else
                {
                    style = cell.InheritedStyle;
                }

                object value;
                object formattedValue;
                string errorText;
                DataGridViewElementStates cellState;

                if (cell.RowIndex == -1)
                {
                    // TODO: Look up value if databound.
                    value          = null;
                    formattedValue = null;
                    errorText      = null;
                    cellState      = cell.State;
                }
                else
                {
                    value          = cell.Value;
                    formattedValue = cell.FormattedValue;
                    errorText      = cell.ErrorText;
                    cellState      = cell.InheritedState;
                }

                DataGridViewAdvancedBorderStyle intermediateBorderStyle = (DataGridViewAdvancedBorderStyle)((ICloneable)DataGridView.AdvancedCellBorderStyle).Clone();
                DataGridViewAdvancedBorderStyle borderStyle             = cell.AdjustCellBorderStyle(DataGridView.AdvancedCellBorderStyle, intermediateBorderStyle, true, true, cell.ColumnIndex == 0, cell.RowIndex == 0);
                DataGridView.OnCellFormattingInternal(new DataGridViewCellFormattingEventArgs(cell.ColumnIndex, cell.RowIndex, value, cell.FormattedValueType, style));


                cell.PaintWork(graphics, clipBounds, bounds, rowIndex, cellState, style, borderStyle, paintParts);
                bounds.X += bounds.Width;
            }
        }
Example #50
0
 /// <summary>
 /// Required method for Designer support; do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.label1  = new System.Windows.Forms.Label();
     this.label2  = new System.Windows.Forms.Label();
     this.label3  = new System.Windows.Forms.Label();
     this.button1 = new System.Windows.Forms.Button();
     this.button2 = new System.Windows.Forms.Button();
     this.label4  = new System.Windows.Forms.Label();
     this.tabBarSplitterControl1 = new Syncfusion.Windows.Forms.TabBarSplitterControl();
     this.tabBarPage1            = new Syncfusion.Windows.Forms.TabBarPage();
     this.dataGridView1          = new System.Windows.Forms.DataGridView();
     this.tabBarPage2            = new Syncfusion.Windows.Forms.TabBarPage();
     this.dataGridView2          = new System.Windows.Forms.DataGridView();
     this.pictureBox3            = new System.Windows.Forms.PictureBox();
     this.panel2 = new System.Windows.Forms.Panel();
     this.tabBarSplitterControl1.SuspendLayout();
     this.tabBarPage1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
     this.tabBarPage2.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
     this.SuspendLayout();
     //
     // label1
     //
     this.label1.Anchor      = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this.label1.BackColor   = System.Drawing.Color.White;
     this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.label1.Location    = new System.Drawing.Point(150, 596);
     this.label1.Name        = "label1";
     this.label1.Size        = new System.Drawing.Size(238, 26);
     this.label1.TabIndex    = 3;
     this.label1.TextAlign   = System.Drawing.ContentAlignment.MiddleLeft;
     //
     // label2
     //
     this.label2.Font     = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label2.Location = new System.Drawing.Point(12, 106);
     this.label2.Name     = "label2";
     this.label2.Size     = new System.Drawing.Size(368, 22);
     this.label2.TabIndex = 6;
     this.label2.Text     = "Click on any formula cell to get the calculated result.";
     //
     // label3
     //
     this.label3.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this.label3.AutoSize = true;
     this.label3.Font     = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label3.Location = new System.Drawing.Point(30, 604);
     this.label3.Name     = "label3";
     this.label3.Size     = new System.Drawing.Size(116, 13);
     this.label3.TabIndex = 9;
     this.label3.Text     = "Computed Value:";
     //
     // button1
     //
     this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.button1.Font      = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.button1.Location  = new System.Drawing.Point(15, 131);
     this.button1.Name      = "button1";
     this.button1.Size      = new System.Drawing.Size(152, 23);
     this.button1.TabIndex  = 10;
     this.button1.Text      = "Import Data From Excel";
     this.button1.UseVisualStyleBackColor = true;
     this.button1.Click += new System.EventHandler(this.button1_Click);
     //
     // button2
     //
     this.button2.Font     = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.button2.Location = new System.Drawing.Point(187, 131);
     this.button2.Name     = "button2";
     this.button2.Size     = new System.Drawing.Size(201, 23);
     this.button2.TabIndex = 11;
     this.button2.Text     = "Open sample workbook in Excel";
     this.button2.UseVisualStyleBackColor = true;
     this.button2.Click += new System.EventHandler(this.button2_Click);
     //
     // label4
     //
     this.label4.AutoSize = true;
     this.label4.Font     = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.label4.Location = new System.Drawing.Point(15, 166);
     this.label4.Name     = "label4";
     this.label4.Size     = new System.Drawing.Size(243, 13);
     this.label4.TabIndex = 12;
     this.label4.Text     = "View of Imported Excel Worksheets:";
     //
     // tabBarSplitterControl1
     //
     this.tabBarSplitterControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                                 | System.Windows.Forms.AnchorStyles.Left)
                                                                                | System.Windows.Forms.AnchorStyles.Right)));
     this.tabBarSplitterControl1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.tabBarSplitterControl1.Controls.Add(this.tabBarPage1);
     this.tabBarSplitterControl1.Controls.Add(this.tabBarPage2);
     this.tabBarSplitterControl1.EnabledColor         = System.Drawing.SystemColors.WindowText;
     this.tabBarSplitterControl1.Font                 = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.tabBarSplitterControl1.Location             = new System.Drawing.Point(18, 200);
     this.tabBarSplitterControl1.Name                 = "tabBarSplitterControl1";
     this.tabBarSplitterControl1.Office2007ScrollBars = true;
     this.tabBarSplitterControl1.RelativeWidth        = 24;
     this.tabBarSplitterControl1.Size                 = new System.Drawing.Size(567, 386);
     this.tabBarSplitterControl1.SplitBars            = Syncfusion.Windows.Forms.DynamicSplitBars.None;
     this.tabBarSplitterControl1.Style                = Syncfusion.Windows.Forms.TabBarSplitterStyle.Office2007;
     this.tabBarSplitterControl1.TabFolderDelta       = 11;
     this.tabBarSplitterControl1.TabIndex             = 13;
     this.tabBarSplitterControl1.Text                 = "tabBarSplitterControl1";
     this.tabBarSplitterControl1.ThemesEnabled        = true;
     //
     // tabBarPage1
     //
     this.tabBarPage1.Controls.Add(this.dataGridView1);
     this.tabBarPage1.Location      = new System.Drawing.Point(0, 0);
     this.tabBarPage1.Name          = "tabBarPage1";
     this.tabBarPage1.SplitBars     = Syncfusion.Windows.Forms.DynamicSplitBars.None;
     this.tabBarPage1.TabBackColor  = System.Drawing.SystemColors.Control;
     this.tabBarPage1.Text          = "Sheet1";
     this.tabBarPage1.ThemesEnabled = true;
     //
     // dataGrid1
     //
     this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                        | System.Windows.Forms.AnchorStyles.Left)
                                                                       | System.Windows.Forms.AnchorStyles.Right)));
     this.dataGridView1.DataMember         = "";
     this.dataGridView1.AllowUserToAddRows = false;
     this.dataGridView1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.dataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
     this.dataGridView1.RowHeadersBorderStyle    = DataGridViewHeaderBorderStyle.None;
     this.dataGridView1.GridColor     = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(218)))), ((int)(((byte)(229)))));
     dataGridViewCellStyle1           = new DataGridViewCellStyle();
     dataGridViewCellStyle1.BackColor = System.Drawing.Color.LightSteelBlue;
     dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText;
     dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.TopLeft;
     this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
     this.dataGridView1.RowHeadersDefaultCellStyle    = dataGridViewCellStyle1;
     this.dataGridView1.Location           = new System.Drawing.Point(0, 0);
     this.dataGridView1.Name               = "dataGrid1";
     this.dataGridView1.RowTemplate.Height = 18;
     this.dataGridView1.ReadOnly           = true;
     this.dataGridView1.Size               = new System.Drawing.Size(17506, 8487);
     this.dataGridView1.TabIndex           = 8;
     this.dataGridView1.MouseUp           += new System.Windows.Forms.MouseEventHandler(this.dataGrid1_MouseClick);
     //
     // tabBarPage2
     //
     this.tabBarPage2.Controls.Add(this.dataGridView2);
     this.tabBarPage2.Location      = new System.Drawing.Point(0, 0);
     this.tabBarPage2.Name          = "tabBarPage2";
     this.tabBarPage2.SplitBars     = ((Syncfusion.Windows.Forms.DynamicSplitBars)((Syncfusion.Windows.Forms.DynamicSplitBars.SplitRows | Syncfusion.Windows.Forms.DynamicSplitBars.SplitColumns)));
     this.tabBarPage2.TabBackColor  = System.Drawing.SystemColors.Control;
     this.tabBarPage2.Text          = "Sheet2";
     this.tabBarPage2.ThemesEnabled = true;
     //
     // dataGrid2
     //
     this.dataGridView2.DataMember         = "";
     this.dataGridView2.AllowUserToAddRows = false;
     this.dataGridView2.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.dataGridView2.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
     this.dataGridView2.RowHeadersBorderStyle    = DataGridViewHeaderBorderStyle.None;
     this.dataGridView2.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(218)))), ((int)(((byte)(229)))));
     this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
     this.dataGridView2.RowHeadersDefaultCellStyle    = dataGridViewCellStyle1;
     this.dataGridView2.Location           = new System.Drawing.Point(0, 0);
     this.dataGridView2.Name               = "dataGrid2";
     this.dataGridView2.RowTemplate.Height = 18;
     this.dataGridView2.ReadOnly           = true;
     this.dataGridView2.Size               = new System.Drawing.Size(575, 338);
     this.dataGridView2.TabIndex           = 4;
     this.dataGridView2.MouseUp           += new System.Windows.Forms.MouseEventHandler(this.dataGrid2_MouseClick);
     //
     // pictureBox3
     //
     this.pictureBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                      | System.Windows.Forms.AnchorStyles.Left)
                                                                     | System.Windows.Forms.AnchorStyles.Right)));
     this.pictureBox3.BackColor = System.Drawing.Color.Transparent;
     this.pictureBox3.Image     = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
     this.pictureBox3.Location  = new System.Drawing.Point(0, 0);
     this.pictureBox3.Name      = "pictureBox3";
     this.pictureBox3.Size      = new System.Drawing.Size(639, 71);
     this.pictureBox3.SizeMode  = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
     this.pictureBox3.TabIndex  = 17;
     this.pictureBox3.TabStop   = false;
     //
     // panel2
     //
     this.panel2.Location = new System.Drawing.Point(-3, 0);
     this.panel2.Name     = "panel2";
     this.panel2.Size     = new System.Drawing.Size(486, 71);
     this.panel2.TabIndex = 22;
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.AutoScaleMode     = System.Windows.Forms.AutoScaleMode.Inherit;
     this.BackColor         = System.Drawing.Color.White;
     this.ClientSize        = new System.Drawing.Size(603, 631);
     this.Controls.Add(this.tabBarSplitterControl1);
     this.Controls.Add(this.label4);
     this.Controls.Add(this.button2);
     this.Controls.Add(this.button1);
     this.Controls.Add(this.label3);
     this.Controls.Add(this.label2);
     this.Controls.Add(this.label1);
     this.Controls.Add(this.pictureBox3);
     this.Controls.Add(this.panel2);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox     = false;
     this.Name            = "Form1";
     this.Text            = "Compute Specific Formula";
     this.FormClosing    += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
     this.tabBarSplitterControl1.ResumeLayout(false);
     this.tabBarPage1.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
     this.tabBarPage2.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Example #51
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.dgFilters  = new System.Windows.Forms.DataGridView();
     this.bDelete    = new System.Windows.Forms.Button();
     this.bUp        = new System.Windows.Forms.Button();
     this.bDown      = new System.Windows.Forms.Button();
     this.bValueExpr = new System.Windows.Forms.Button();
     ((System.ComponentModel.ISupportInitialize)(this.dgFilters)).BeginInit();
     this.SuspendLayout();
     //
     // dgFilters
     //
     this.dgFilters.Location = new System.Drawing.Point(8, 8);
     this.dgFilters.Name     = "dgFilters";
     this.dgFilters.Size     = new System.Drawing.Size(376, 264);
     this.dgFilters.TabIndex = 2;
     //
     // bDelete
     //
     this.bDelete.Location = new System.Drawing.Point(392, 40);
     this.bDelete.Name     = "bDelete";
     this.bDelete.Size     = new System.Drawing.Size(48, 23);
     this.bDelete.TabIndex = 1;
     this.bDelete.Text     = "Delete";
     this.bDelete.Click   += new System.EventHandler(this.bDelete_Click);
     //
     // bUp
     //
     this.bUp.Location = new System.Drawing.Point(392, 71);
     this.bUp.Name     = "bUp";
     this.bUp.Size     = new System.Drawing.Size(48, 23);
     this.bUp.TabIndex = 3;
     this.bUp.Text     = "Up";
     this.bUp.Click   += new System.EventHandler(this.bUp_Click);
     //
     // bDown
     //
     this.bDown.Location = new System.Drawing.Point(392, 102);
     this.bDown.Name     = "bDown";
     this.bDown.Size     = new System.Drawing.Size(48, 23);
     this.bDown.TabIndex = 4;
     this.bDown.Text     = "Down";
     this.bDown.Click   += new System.EventHandler(this.bDown_Click);
     //
     // bValueExpr
     //
     this.bValueExpr.Font      = new System.Drawing.Font("Arial", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.bValueExpr.Location  = new System.Drawing.Point(392, 16);
     this.bValueExpr.Name      = "bValueExpr";
     this.bValueExpr.Size      = new System.Drawing.Size(22, 16);
     this.bValueExpr.TabIndex  = 5;
     this.bValueExpr.Tag       = "value";
     this.bValueExpr.Text      = "fx";
     this.bValueExpr.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     this.bValueExpr.Click    += new System.EventHandler(this.bValueExpr_Click);
     //
     // FiltersCtl
     //
     this.Controls.Add(this.bValueExpr);
     this.Controls.Add(this.bDown);
     this.Controls.Add(this.bUp);
     this.Controls.Add(this.bDelete);
     this.Controls.Add(this.dgFilters);
     this.Name = "FiltersCtl";
     this.Size = new System.Drawing.Size(488, 304);
     ((System.ComponentModel.ISupportInitialize)(this.dgFilters)).EndInit();
     this.ResumeLayout(false);
 }
Example #52
0
        public void ExportFileFromDataGridViewEmployee(System.Windows.Forms.DataGridView dgv, string fileName)
        {
            //set properties for SaveFileDilog
            SaveFileDialog sfdSave = new SaveFileDialog();

            sfdSave.Filter   = "Excel file(*.xls)|*.xls";
            sfdSave.Title    = "Save to Excel file";
            sfdSave.FileName = fileName;

            //proccess save file excel
            if (sfdSave.ShowDialog() == DialogResult.OK)
            {
                //create file infomation
                FileInfo f = new FileInfo(sfdSave.FileName);
                //delete if file exists
                if (f.Exists == true)
                {
                    f.Delete();
                }
                //Create excel file
                ExcelCOM.Application exApp   = new ExcelCOM.Application();
                ExcelCOM.Workbook    exBook  = exApp.Workbooks.Add(ExcelCOM.XlWBATemplate.xlWBATWorksheet);
                ExcelCOM.Worksheet   exSheet = (ExcelCOM.Worksheet)exBook.Worksheets[1];
                //ExcelCOM.Range chartRange;
                exSheet.Name = fileName;

                //list field will be exported
                List <string> field = new List <string> {
                    "EmployeeCode", "EmployeeName", "UserName", "Gender", "BirthDate", "PhoneNumber", "Email", "Address", "EmployeeTypeName", "CountryName", "EmployeeTypeName2", "CountryName2", "EmployeeTypeName3", "CountryName3", "HourlyWages", "CreatedDate", "UpdatedDate", "Notes"
                };

                //import header
                int col = 1;
                for (int i = 0; i < field.Count; i++)
                {
                    exSheet.Cells[1, col] = dgv.Columns[field[i]].HeaderText;
                    col++;
                }

                //import data
                for (int i = 0; i < dgv.Rows.Count; i++)
                {
                    col = 1;
                    for (int j = 0; j < field.Count; j++)
                    {
                        exSheet.Cells[i + 2, col] = dgv.Rows[i].Cells[field[j]].Value.ToString();
                        col++;
                    }
                }

                //(ExcelCOM.XlLineStyle.xlContinuous, ExcelCOM.XlBorderWeight.xlMedium, ExcelCOM.XlColorIndex.xlColorIndexAutomatic, ExcelCOM.XlColorIndex.xlColorIndexAutomatic);
                //chartRange.BorderAround(ExcelCOM.XlLineStyle.xlContinuous, ExcelCOM.XlBorderWeight.xlMedium, ExcelCOM.XlColorIndex.xlColorIndexAutomatic, ExcelCOM.XlColorIndex.xlColorIndexAutomatic);
                exApp.Visible = false;
                //Save file excel into dictionary that you choose
                exBook.SaveAs(sfdSave.FileName, ExcelCOM.XlFileFormat.xlWorkbookNormal,
                              null, null, false, false,
                              ExcelCOM.XlSaveAsAccessMode.xlExclusive,
                              false, false, false, false, false);

                //close and release object
                exBook.Close(false, false, false);
                exApp.Quit();

                System.Runtime.InteropServices.Marshal.ReleaseComObject(exBook);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(exApp);

                CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM385"),
                                                                 Common.clsLanguages.GetResource("CRM11"),
                                                                 Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                 Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
            }
        }
Example #53
0
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmCarteles));
     this.ToolTip1            = new System.Windows.Forms.ToolTip(this.components);
     this.Cartel1             = new System.Windows.Forms.GroupBox();
     this.txtCopias1          = new System.Windows.Forms.TextBox();
     this.cmbRazonSocial1     = new System.Windows.Forms.ComboBox();
     this._Lbl_30             = new System.Windows.Forms.Label();
     this.lblCP1              = new System.Windows.Forms.Label();
     this.lblProvincia1       = new System.Windows.Forms.Label();
     this.lblLocalidad1       = new System.Windows.Forms.Label();
     this.lblDireccion1       = new System.Windows.Forms.Label();
     this._Lbl_13             = new System.Windows.Forms.Label();
     this._Lbl_1              = new System.Windows.Forms.Label();
     this._Lbl_2              = new System.Windows.Forms.Label();
     this._Lbl_3              = new System.Windows.Forms.Label();
     this._Lbl_0              = new System.Windows.Forms.Label();
     this.Toolbar1            = new System.Windows.Forms.ToolStrip();
     this.tlbNuevo            = new System.Windows.Forms.ToolStripButton();
     this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
     this.tlbGuardar          = new System.Windows.Forms.ToolStripButton();
     this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
     this.tbImprimir          = new System.Windows.Forms.ToolStripButton();
     this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
     this.tlbAnual            = new System.Windows.Forms.ToolStripButton();
     this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
     this.tlbEditar           = new System.Windows.Forms.ToolStripButton();
     this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
     this.tlbCorreo           = new System.Windows.Forms.ToolStripButton();
     this.tlbCarteles         = new System.Windows.Forms.ToolStripButton();
     this.dataGridView1       = new System.Windows.Forms.DataGridView();
     this.Cartel1.SuspendLayout();
     this.Toolbar1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
     this.SuspendLayout();
     //
     // Cartel1
     //
     this.Cartel1.BackColor = System.Drawing.SystemColors.Control;
     this.Cartel1.Controls.Add(this.txtCopias1);
     this.Cartel1.Controls.Add(this.cmbRazonSocial1);
     this.Cartel1.Controls.Add(this._Lbl_30);
     this.Cartel1.Controls.Add(this.lblCP1);
     this.Cartel1.Controls.Add(this.lblProvincia1);
     this.Cartel1.Controls.Add(this.lblLocalidad1);
     this.Cartel1.Controls.Add(this.lblDireccion1);
     this.Cartel1.Controls.Add(this._Lbl_13);
     this.Cartel1.Controls.Add(this._Lbl_1);
     this.Cartel1.Controls.Add(this._Lbl_2);
     this.Cartel1.Controls.Add(this._Lbl_3);
     this.Cartel1.Controls.Add(this._Lbl_0);
     this.Cartel1.ForeColor   = System.Drawing.SystemColors.ControlText;
     this.Cartel1.Location    = new System.Drawing.Point(0, 32);
     this.Cartel1.Name        = "Cartel1";
     this.Cartel1.Padding     = new System.Windows.Forms.Padding(0);
     this.Cartel1.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this.Cartel1.Size        = new System.Drawing.Size(353, 145);
     this.Cartel1.TabIndex    = 0;
     this.Cartel1.TabStop     = false;
     this.Cartel1.Visible     = false;
     //
     // txtCopias1
     //
     this.txtCopias1.AcceptsReturn = true;
     this.txtCopias1.BackColor     = System.Drawing.SystemColors.Window;
     this.txtCopias1.Cursor        = System.Windows.Forms.Cursors.IBeam;
     this.txtCopias1.ForeColor     = System.Drawing.SystemColors.WindowText;
     this.txtCopias1.Location      = new System.Drawing.Point(304, 48);
     this.txtCopias1.MaxLength     = 0;
     this.txtCopias1.Name          = "txtCopias1";
     this.txtCopias1.RightToLeft   = System.Windows.Forms.RightToLeft.No;
     this.txtCopias1.Size          = new System.Drawing.Size(25, 20);
     this.txtCopias1.TabIndex      = 4;
     //
     // cmbRazonSocial1
     //
     this.cmbRazonSocial1.BackColor   = System.Drawing.SystemColors.Window;
     this.cmbRazonSocial1.Cursor      = System.Windows.Forms.Cursors.Default;
     this.cmbRazonSocial1.ForeColor   = System.Drawing.SystemColors.WindowText;
     this.cmbRazonSocial1.Location    = new System.Drawing.Point(8, 24);
     this.cmbRazonSocial1.Name        = "cmbRazonSocial1";
     this.cmbRazonSocial1.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this.cmbRazonSocial1.Size        = new System.Drawing.Size(329, 21);
     this.cmbRazonSocial1.Sorted      = true;
     this.cmbRazonSocial1.TabIndex    = 1;
     //
     // _Lbl_30
     //
     this._Lbl_30.AutoSize    = true;
     this._Lbl_30.BackColor   = System.Drawing.SystemColors.Control;
     this._Lbl_30.Cursor      = System.Windows.Forms.Cursors.Default;
     this._Lbl_30.ForeColor   = System.Drawing.SystemColors.ControlText;
     this._Lbl_30.Location    = new System.Drawing.Point(168, 96);
     this._Lbl_30.Name        = "_Lbl_30";
     this._Lbl_30.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this._Lbl_30.Size        = new System.Drawing.Size(21, 13);
     this._Lbl_30.TabIndex    = 76;
     this._Lbl_30.Text        = "CP";
     this._Lbl_30.TextAlign   = System.Drawing.ContentAlignment.TopRight;
     //
     // lblCP1
     //
     this.lblCP1.BackColor   = System.Drawing.SystemColors.Control;
     this.lblCP1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.lblCP1.Cursor      = System.Windows.Forms.Cursors.Default;
     this.lblCP1.ForeColor   = System.Drawing.SystemColors.ControlText;
     this.lblCP1.Location    = new System.Drawing.Point(168, 112);
     this.lblCP1.Name        = "lblCP1";
     this.lblCP1.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this.lblCP1.Size        = new System.Drawing.Size(65, 20);
     this.lblCP1.TabIndex    = 75;
     //
     // lblProvincia1
     //
     this.lblProvincia1.BackColor   = System.Drawing.SystemColors.Control;
     this.lblProvincia1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.lblProvincia1.Cursor      = System.Windows.Forms.Cursors.Default;
     this.lblProvincia1.ForeColor   = System.Drawing.SystemColors.ControlText;
     this.lblProvincia1.Location    = new System.Drawing.Point(240, 112);
     this.lblProvincia1.Name        = "lblProvincia1";
     this.lblProvincia1.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this.lblProvincia1.Size        = new System.Drawing.Size(97, 20);
     this.lblProvincia1.TabIndex    = 5;
     //
     // lblLocalidad1
     //
     this.lblLocalidad1.BackColor   = System.Drawing.SystemColors.Control;
     this.lblLocalidad1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.lblLocalidad1.Cursor      = System.Windows.Forms.Cursors.Default;
     this.lblLocalidad1.ForeColor   = System.Drawing.SystemColors.ControlText;
     this.lblLocalidad1.Location    = new System.Drawing.Point(8, 112);
     this.lblLocalidad1.Name        = "lblLocalidad1";
     this.lblLocalidad1.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this.lblLocalidad1.Size        = new System.Drawing.Size(153, 20);
     this.lblLocalidad1.TabIndex    = 7;
     //
     // lblDireccion1
     //
     this.lblDireccion1.BackColor   = System.Drawing.SystemColors.Control;
     this.lblDireccion1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.lblDireccion1.Cursor      = System.Windows.Forms.Cursors.Default;
     this.lblDireccion1.ForeColor   = System.Drawing.SystemColors.ControlText;
     this.lblDireccion1.Location    = new System.Drawing.Point(8, 72);
     this.lblDireccion1.Name        = "lblDireccion1";
     this.lblDireccion1.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this.lblDireccion1.Size        = new System.Drawing.Size(321, 20);
     this.lblDireccion1.TabIndex    = 6;
     //
     // _Lbl_13
     //
     this._Lbl_13.AutoSize    = true;
     this._Lbl_13.BackColor   = System.Drawing.SystemColors.Control;
     this._Lbl_13.Cursor      = System.Windows.Forms.Cursors.Default;
     this._Lbl_13.ForeColor   = System.Drawing.SystemColors.ControlText;
     this._Lbl_13.Location    = new System.Drawing.Point(264, 48);
     this._Lbl_13.Name        = "_Lbl_13";
     this._Lbl_13.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this._Lbl_13.Size        = new System.Drawing.Size(39, 13);
     this._Lbl_13.TabIndex    = 11;
     this._Lbl_13.Text        = "Copias";
     this._Lbl_13.TextAlign   = System.Drawing.ContentAlignment.TopRight;
     //
     // _Lbl_1
     //
     this._Lbl_1.AutoSize    = true;
     this._Lbl_1.BackColor   = System.Drawing.SystemColors.Control;
     this._Lbl_1.Cursor      = System.Windows.Forms.Cursors.Default;
     this._Lbl_1.ForeColor   = System.Drawing.SystemColors.ControlText;
     this._Lbl_1.Location    = new System.Drawing.Point(8, 56);
     this._Lbl_1.Name        = "_Lbl_1";
     this._Lbl_1.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this._Lbl_1.Size        = new System.Drawing.Size(52, 13);
     this._Lbl_1.TabIndex    = 10;
     this._Lbl_1.Text        = "Direccion";
     this._Lbl_1.TextAlign   = System.Drawing.ContentAlignment.TopRight;
     //
     // _Lbl_2
     //
     this._Lbl_2.AutoSize    = true;
     this._Lbl_2.BackColor   = System.Drawing.SystemColors.Control;
     this._Lbl_2.Cursor      = System.Windows.Forms.Cursors.Default;
     this._Lbl_2.ForeColor   = System.Drawing.SystemColors.ControlText;
     this._Lbl_2.Location    = new System.Drawing.Point(8, 96);
     this._Lbl_2.Name        = "_Lbl_2";
     this._Lbl_2.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this._Lbl_2.Size        = new System.Drawing.Size(53, 13);
     this._Lbl_2.TabIndex    = 9;
     this._Lbl_2.Text        = "Localidad";
     this._Lbl_2.TextAlign   = System.Drawing.ContentAlignment.TopRight;
     //
     // _Lbl_3
     //
     this._Lbl_3.AutoSize    = true;
     this._Lbl_3.BackColor   = System.Drawing.SystemColors.Control;
     this._Lbl_3.Cursor      = System.Windows.Forms.Cursors.Default;
     this._Lbl_3.ForeColor   = System.Drawing.SystemColors.ControlText;
     this._Lbl_3.Location    = new System.Drawing.Point(240, 96);
     this._Lbl_3.Name        = "_Lbl_3";
     this._Lbl_3.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this._Lbl_3.Size        = new System.Drawing.Size(51, 13);
     this._Lbl_3.TabIndex    = 8;
     this._Lbl_3.Text        = "Provincia";
     this._Lbl_3.TextAlign   = System.Drawing.ContentAlignment.TopRight;
     //
     // _Lbl_0
     //
     this._Lbl_0.AutoSize    = true;
     this._Lbl_0.BackColor   = System.Drawing.SystemColors.Control;
     this._Lbl_0.Cursor      = System.Windows.Forms.Cursors.Default;
     this._Lbl_0.ForeColor   = System.Drawing.SystemColors.ControlText;
     this._Lbl_0.Location    = new System.Drawing.Point(8, 8);
     this._Lbl_0.Name        = "_Lbl_0";
     this._Lbl_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this._Lbl_0.Size        = new System.Drawing.Size(70, 13);
     this._Lbl_0.TabIndex    = 2;
     this._Lbl_0.Text        = "Razon Social";
     this._Lbl_0.TextAlign   = System.Drawing.ContentAlignment.TopRight;
     //
     // Toolbar1
     //
     this.Toolbar1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.tlbNuevo,
         this.toolStripSeparator1,
         this.tlbGuardar,
         this.toolStripSeparator2,
         this.tbImprimir,
         this.toolStripSeparator3,
         this.tlbAnual,
         this.toolStripSeparator4,
         this.tlbEditar,
         this.toolStripSeparator5,
         this.tlbCorreo,
         this.tlbCarteles
     });
     this.Toolbar1.Location = new System.Drawing.Point(0, 0);
     this.Toolbar1.Name     = "Toolbar1";
     this.Toolbar1.Size     = new System.Drawing.Size(1298, 29);
     this.Toolbar1.TabIndex = 159;
     //
     // tlbNuevo
     //
     this.tlbNuevo.Image             = ((System.Drawing.Image)(resources.GetObject("tlbNuevo.Image")));
     this.tlbNuevo.ImageScaling      = System.Windows.Forms.ToolStripItemImageScaling.None;
     this.tlbNuevo.Name              = "tlbNuevo";
     this.tlbNuevo.Size              = new System.Drawing.Size(26, 26);
     this.tlbNuevo.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.tlbNuevo.ToolTipText       = "Nuevo";
     //
     // toolStripSeparator1
     //
     this.toolStripSeparator1.Name = "toolStripSeparator1";
     this.toolStripSeparator1.Size = new System.Drawing.Size(6, 29);
     //
     // tlbGuardar
     //
     this.tlbGuardar.Enabled           = false;
     this.tlbGuardar.Image             = ((System.Drawing.Image)(resources.GetObject("tlbGuardar.Image")));
     this.tlbGuardar.ImageScaling      = System.Windows.Forms.ToolStripItemImageScaling.None;
     this.tlbGuardar.Name              = "tlbGuardar";
     this.tlbGuardar.Size              = new System.Drawing.Size(26, 26);
     this.tlbGuardar.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.tlbGuardar.ToolTipText       = "Guardar";
     //
     // toolStripSeparator2
     //
     this.toolStripSeparator2.Name = "toolStripSeparator2";
     this.toolStripSeparator2.Size = new System.Drawing.Size(6, 29);
     //
     // tbImprimir
     //
     this.tbImprimir.Image             = ((System.Drawing.Image)(resources.GetObject("tbImprimir.Image")));
     this.tbImprimir.ImageScaling      = System.Windows.Forms.ToolStripItemImageScaling.None;
     this.tbImprimir.Name              = "tbImprimir";
     this.tbImprimir.Size              = new System.Drawing.Size(26, 26);
     this.tbImprimir.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.tbImprimir.ToolTipText       = "Imprimir";
     //
     // toolStripSeparator3
     //
     this.toolStripSeparator3.Name = "toolStripSeparator3";
     this.toolStripSeparator3.Size = new System.Drawing.Size(6, 29);
     //
     // tlbAnual
     //
     this.tlbAnual.Image             = ((System.Drawing.Image)(resources.GetObject("tlbAnual.Image")));
     this.tlbAnual.ImageScaling      = System.Windows.Forms.ToolStripItemImageScaling.None;
     this.tlbAnual.Name              = "tlbAnual";
     this.tlbAnual.Size              = new System.Drawing.Size(26, 26);
     this.tlbAnual.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.tlbAnual.ToolTipText       = "Anular";
     //
     // toolStripSeparator4
     //
     this.toolStripSeparator4.Name = "toolStripSeparator4";
     this.toolStripSeparator4.Size = new System.Drawing.Size(6, 29);
     //
     // tlbEditar
     //
     this.tlbEditar.Image             = ((System.Drawing.Image)(resources.GetObject("tlbEditar.Image")));
     this.tlbEditar.ImageScaling      = System.Windows.Forms.ToolStripItemImageScaling.None;
     this.tlbEditar.Name              = "tlbEditar";
     this.tlbEditar.Size              = new System.Drawing.Size(26, 26);
     this.tlbEditar.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.tlbEditar.ToolTipText       = "Editar";
     //
     // toolStripSeparator5
     //
     this.toolStripSeparator5.Name = "toolStripSeparator5";
     this.toolStripSeparator5.Size = new System.Drawing.Size(6, 29);
     //
     // tlbCorreo
     //
     this.tlbCorreo.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.tlbCorreo.Image                 = ((System.Drawing.Image)(resources.GetObject("tlbCorreo.Image")));
     this.tlbCorreo.ImageScaling          = System.Windows.Forms.ToolStripItemImageScaling.None;
     this.tlbCorreo.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.tlbCorreo.Name = "tlbCorreo";
     this.tlbCorreo.Size = new System.Drawing.Size(26, 26);
     this.tlbCorreo.Text = "Correspondencia";
     //
     // tlbCarteles
     //
     this.tlbCarteles.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.tlbCarteles.Image                 = ((System.Drawing.Image)(resources.GetObject("tlbCarteles.Image")));
     this.tlbCarteles.ImageScaling          = System.Windows.Forms.ToolStripItemImageScaling.None;
     this.tlbCarteles.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.tlbCarteles.Name = "tlbCarteles";
     this.tlbCarteles.Size = new System.Drawing.Size(26, 26);
     this.tlbCarteles.Text = "Cartel";
     //
     // dataGridView1
     //
     this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     this.dataGridView1.Location = new System.Drawing.Point(424, 40);
     this.dataGridView1.Name     = "dataGridView1";
     this.dataGridView1.Size     = new System.Drawing.Size(786, 400);
     this.dataGridView1.TabIndex = 160;
     //
     // frmCarteles
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.BackColor           = System.Drawing.SystemColors.Control;
     this.ClientSize          = new System.Drawing.Size(1298, 663);
     this.Controls.Add(this.dataGridView1);
     this.Controls.Add(this.Toolbar1);
     this.Controls.Add(this.Cartel1);
     this.Cursor      = System.Windows.Forms.Cursors.Default;
     this.Location    = new System.Drawing.Point(4, 25);
     this.Name        = "frmCarteles";
     this.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this.Text        = "Generador de Carteles";
     this.Load       += new System.EventHandler(this.FrmCartelesLoad);
     this.Cartel1.ResumeLayout(false);
     this.Cartel1.PerformLayout();
     this.Toolbar1.ResumeLayout(false);
     this.Toolbar1.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Example #54
0
        public static bool DataGridview2Sheet(System.Windows.Forms.DataGridView dataGridView1, string tableName)
        {
            NPOI.HSSF.UserModel.HSSFWorkbook wb = new NPOI.HSSF.UserModel.HSSFWorkbook();
            NPOI.SS.UserModel.ISheet         c  = wb.CreateSheet(tableName);

            List <DataGridViewColumn> ListColumns = new List <DataGridViewColumn>();

            foreach (DataGridViewColumn i in dataGridView1.Columns)
            {
                if (i.Visible == true)
                {
                    ListColumns.Add(i);
                }
            }
            ListColumns = ListColumns.OrderBy(r => r.DisplayIndex).ToList();

            if (dataGridView1.Rows.Count <= 0)
            {
                return(false);
            }

            foreach (DataGridViewColumn dc in ListColumns)
            {
                if (dc.Visible == false)
                {
                    continue;
                }
                if (dc.ValueType == typeof(int) || dc.ValueType == typeof(decimal) || dc.ValueType == typeof(double))
                {
                    c.SetColumnWidth(dc.Index, 10 * 256);
                }
                else
                {
                    c.SetColumnWidth(dc.Index, 20 * 256);
                }
            }


            #region 表头
            NPOI.SS.UserModel.IRow RowHeader = c.CreateRow(0);
            var FirstCell = RowHeader.CreateCell(0);
            FirstCell.SetCellValue(BugsBox.Pharmacy.AppClient.Common.AppClientContext.Config.Store.Name + tableName);
            NPOI.SS.UserModel.ICellStyle cellstyleHeader = wb.CreateCellStyle();
            cellstyleHeader.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
            cellstyleHeader.BorderLeft   = NPOI.SS.UserModel.BorderStyle.Thin;
            cellstyleHeader.BorderRight  = NPOI.SS.UserModel.BorderStyle.Thin;
            cellstyleHeader.BorderTop    = NPOI.SS.UserModel.BorderStyle.Thin;

            NPOI.SS.UserModel.IFont CellFontHeader = wb.CreateFont();
            CellFontHeader.FontName           = "微软雅黑";
            CellFontHeader.FontHeightInPoints = 16;
            cellstyleHeader.SetFont(CellFontHeader);
            cellstyleHeader.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
            FirstCell.CellStyle       = cellstyleHeader;

            c.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(0, 0, 0, ListColumns.Count - 1));
            #endregion

            #region 标题行 居中并且有框线
            NPOI.SS.UserModel.ICellStyle CellStyleTitles = wb.CreateCellStyle();
            CellStyleTitles.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
            CellStyleTitles.BorderLeft   = NPOI.SS.UserModel.BorderStyle.Thin;
            CellStyleTitles.BorderRight  = NPOI.SS.UserModel.BorderStyle.Thin;
            CellStyleTitles.BorderTop    = NPOI.SS.UserModel.BorderStyle.Thin;
            CellStyleTitles.Alignment    = NPOI.SS.UserModel.HorizontalAlignment.Center;
            NPOI.SS.UserModel.IRow RowTitle = c.CreateRow(1);
            int cindex = 0;
            foreach (DataGridViewColumn hc in ListColumns)
            {
                if (!hc.Visible)
                {
                    continue;
                }
                NPOI.SS.UserModel.ICell cell = RowTitle.CreateCell(cindex);
                cindex++;
                cell.CellStyle = CellStyleTitles;
                if (!string.IsNullOrEmpty(hc.HeaderText))
                {
                    cell.SetCellValue(hc.HeaderText);
                }
            }
            #endregion

            #region 列表 有框线,默认左对齐
            NPOI.SS.UserModel.ICellStyle CellStyleLeftAlignmentCell = wb.CreateCellStyle();
            CellStyleLeftAlignmentCell.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
            CellStyleLeftAlignmentCell.BorderLeft   = NPOI.SS.UserModel.BorderStyle.Thin;
            CellStyleLeftAlignmentCell.BorderRight  = NPOI.SS.UserModel.BorderStyle.Thin;
            CellStyleLeftAlignmentCell.BorderTop    = NPOI.SS.UserModel.BorderStyle.Thin;



            foreach (DataGridViewRow i in dataGridView1.Rows)
            {
                NPOI.SS.UserModel.IRow row = c.CreateRow(i.Index + 2);
                cindex = 0;
                foreach (var u in ListColumns)
                {
                    var col = dataGridView1.Rows[i.Index].Cells[u.Index];
                    if (!col.Visible)
                    {
                        continue;
                    }
                    NPOI.SS.UserModel.ICell xcell = row.CreateCell(cindex);
                    cindex++;

                    //设置居中对齐,如果是string则左对齐
                    if (col.ValueType == typeof(string) || col.ValueType == typeof(Guid))
                    {
                        xcell.CellStyle = CellStyleLeftAlignmentCell;//默认左对齐的风格
                    }
                    else
                    {
                        xcell.CellStyle = CellStyleTitles;//默认居中对齐的风格,与标题栏一致
                    }

                    if (col.Value == null)
                    {
                        continue;
                    }
                    if (col.ValueType == typeof(string))
                    {
                        xcell.SetCellValue(col.Value.ToString());
                    }
                    else if (col.ValueType == typeof(decimal?) || col.ValueType == typeof(int?) || col.ValueType == typeof(double?) || col.ValueType == typeof(decimal) || col.ValueType == typeof(int) || col.ValueType == typeof(double))
                    {
                        xcell.SetCellValue(double.Parse(col.Value.ToString()));
                    }
                    else
                    {
                        xcell.SetCellValue(col.Value.ToString());
                    }
                }
            }
            #endregion

            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                sfd.Filter   = "Excel电子表格|*.xls";
                sfd.FileName = tableName + DateTime.Now.Ticks.ToString();
                if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        using (System.IO.FileStream fs = System.IO.File.OpenWrite(sfd.FileName))
                        {
                            wb.Write(fs);
                            MessageBox.Show("导出成功!");
                        }
                    }
                    catch (System.IO.IOException ex)
                    {
                        MessageBox.Show("导出失败!\n" + ex.Message);
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #55
0
        public static void FillExcel(System.Windows.Forms.DataGridView gridView, string FileName)
        {
            System.Reflection.Missing miss  = System.Reflection.Missing.Value;
            ApplicationClass          excel = new ApplicationClass();

            excel.Application.Workbooks.Add(true);;
            excel.Visible = false;//若是true,则在导出的时候会显示EXcel界面。
            if (excel == null)
            {
                MessageBox.Show("EXCEL无法启动!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Workbooks books = (Workbooks)excel.Workbooks;
            Workbook  book  = (Workbook)(books.Add(miss));
            Worksheet sheet = (Worksheet)book.ActiveSheet;

            sheet.Name = "test";
            float fl = 0;

            //生成字段名称
            for (int i = 0; i < gridView.ColumnCount; i++)
            {
                if (gridView.Columns[i].Visible == true && (gridView.Columns[i] is DataGridViewTextBoxColumn))
                {
                    excel.Cells[1, i + 1] = gridView.Columns[i].HeaderText.ToString();
                }
            }
            //填充数据
            for (int i = 0; i < gridView.RowCount - 1; i++)
            {
                for (int j = 0; j < gridView.ColumnCount; j++)
                {
                    if (gridView.Columns[j].Visible == true && (gridView.Columns[j] is DataGridViewTextBoxColumn))
                    {
                        if (gridView[j, i].Value == typeof(string))
                        {
                            excel.Cells[i + 2, j + 1] = "" + gridView[i, j].Value.ToString();
                        }
                        else
                        {
                            excel.Cells[i + 2, j + 1] = gridView[j, i].Value.ToString();
                        }
                    }
                }
                fl += 100 / float.Parse(gridView.RowCount.ToString());
                if (fl > 1)
                {
                    Excel.Block += 1;
                    fl           = 0;
                }
            }
            sheet.SaveAs(FileName, miss, miss, miss, miss, miss, XlSaveAsAccessMode.xlNoChange, miss, miss, miss);
            book.Close(false, miss, miss);
            books.Close();
            excel.Quit();
            System.Runtime.InteropServices.Marshal.ReleaseComObject(sheet);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(book);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(books);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
            GC.Collect();
            MessageBox.Show("数据已经成功导出到:" + FileName, "导出完成", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Example #56
0
        /// <summary>
        /// Export file excel from datagridview - Created by Huynh Dung - ố ồ
        /// </summary>
        /// <param name="dgv"></param>
        /// <param name="fileName"></param>
        public void ExportFileFromDataGridView_Dung(System.Windows.Forms.DataGridView dgv, string fileName, string title)
        {
            //set properties for SaveFileDilog
            SaveFileDialog sfdSave = new SaveFileDialog();

            sfdSave.Filter   = "Excel file(*.xls)|*.xls";
            sfdSave.Title    = "Save to Excel file";
            sfdSave.FileName = fileName;

            //proccess save file excel
            if (sfdSave.ShowDialog() == DialogResult.OK)
            {
                //create file infomation
                FileInfo f = new FileInfo(sfdSave.FileName);
                //delete if file exists
                if (f.Exists == true)
                {
                    f.Delete();
                }
                //Create excel file
                ExcelCOM.Application exApp   = new ExcelCOM.Application();
                ExcelCOM.Workbook    exBook  = exApp.Workbooks.Add(ExcelCOM.XlWBATemplate.xlWBATWorksheet);
                ExcelCOM.Worksheet   exSheet = (ExcelCOM.Worksheet)exBook.Worksheets[1];
                //Microsoft.Office.Interop.Excel.Range excelCellrange;
                ExcelCOM.Range excelCellrange;
                exSheet.Name = fileName;

                //import Caption
                excelCellrange = exSheet.Range[exSheet.Cells[1, 1], exSheet.Cells[1, dgv.ColumnCount]];
                exSheet.get_Range((object)exSheet.Cells[1, 1], (object)exSheet.Cells[1, dgv.ColumnCount]).Merge(false);
                excelCellrange                     = exSheet.get_Range((object)exSheet.Cells[1, 1], (object)exSheet.Cells[1, dgv.ColumnCount]);
                excelCellrange.FormulaR1C1         = title;
                excelCellrange.HorizontalAlignment = 3;
                excelCellrange.VerticalAlignment   = 3;

                excelCellrange = exSheet.Range[exSheet.Cells[2, 1], exSheet.Cells[dgv.RowCount + 2, dgv.ColumnCount]];
                excelCellrange.NumberFormat = "@";
                //import header
                int col = 1;
                for (int i = 1; i <= dgv.ColumnCount; i++)
                {
                    exSheet.Cells[2, col] = dgv.Columns[i - 1].HeaderText;
                    col++;
                    //chartRange = exSheet.Cells[1, col];
                    //Font.Bold = true;
                }

                //import data
                for (int i = 0; i < dgv.RowCount; i++)
                {
                    col = 1;
                    for (int j = 0; j < dgv.ColumnCount; j++)
                    {
                        if (i != 0)
                        {
                            if ((dgv.Rows[i - 1].Cells[j].Value.ToString() == dgv.Rows[i].Cells[j].Value.ToString()) && (col == 1 || col == 2 || col == 3))
                            {
                                exSheet.get_Range((object)exSheet.Cells[i + 2, col], (object)exSheet.Cells[i + 3, col]).Merge(Type.Missing);
                                exSheet.Cells[i + 3, col] = dgv.Rows[i].Cells[j].Value.ToString();
                            }
                            else
                            {
                                exSheet.Cells[i + 3, col] = dgv.Rows[i].Cells[j].Value.ToString();
                            }
                        }
                        else
                        {
                            exSheet.Cells[i + 3, col] = dgv.Rows[i].Cells[j].Value.ToString();
                        }

                        col++;

                        //chartRange.Cells.Formula
                    }
                }
                //

                // now we resize the columns
                excelCellrange = exSheet.Range[exSheet.Cells[1, 1], exSheet.Cells[dgv.RowCount + 2, dgv.ColumnCount]];
                excelCellrange.EntireColumn.AutoFit();

                //excelCellrange.OutlineLevel = 2;
                //excelCellrange.Group(Type.Missing, Type.Missing, Type.Missing, Type.Missing);


                Microsoft.Office.Interop.Excel.Borders border = excelCellrange.Borders;
                border.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border.Weight    = 2d;


                //excelCellrange = exSheet.Range[exSheet.Cells[1, 1], exSheet.Cells[1, dgv.ColumnCount]];
                //FormattingExcelCells(excelCellrange, "#f5f5f5", System.Drawing.Color.DarkBlue, true);

                //excelCellrange = exSheet.Range[exSheet.Cells[2, 1], exSheet.Cells[2, dgv.ColumnCount]];
                //FormattingExcelCells(excelCellrange, "#0488a1", System.Drawing.Color.White, true);

                exApp.Visible = false;
                //
                //exBook = ActiveWorkbook;
                exBook.CheckCompatibility = false;
                //Save file excel into dictionary that you choose
                exBook.SaveAs(sfdSave.FileName, ExcelCOM.XlFileFormat.xlWorkbookNormal,
                              null, null, false, false,
                              ExcelCOM.XlSaveAsAccessMode.xlExclusive,
                              false, false, false, false, false);

                //close and release object
                exBook.Close(false, false, false);
                exApp.Quit();

                System.Runtime.InteropServices.Marshal.ReleaseComObject(exBook);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(exApp);

                CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRMFileExportSuccess"),
                                                                 Common.clsLanguages.GetResource("CRMInformation"),
                                                                 Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                 Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
            }
        }
 private void InitializeComponent()
 {
     this.pnlTop          = new System.Windows.Forms.Panel();
     this.lblMsg          = new System.Windows.Forms.Label();
     this.txtBarcode2     = new System.Windows.Forms.TextBox();
     this.label5          = new System.Windows.Forms.Label();
     this.panel3          = new System.Windows.Forms.Panel();
     this.button3         = new System.Windows.Forms.Button();
     this.button4         = new System.Windows.Forms.Button();
     this.panel1          = new System.Windows.Forms.Panel();
     this.button2         = new System.Windows.Forms.Button();
     this.button1         = new System.Windows.Forms.Button();
     this.txtBarcode1     = new System.Windows.Forms.TextBox();
     this.label2          = new System.Windows.Forms.Label();
     this.txtNaka         = new System.Windows.Forms.TextBox();
     this.label1          = new System.Windows.Forms.Label();
     this.pnlFooter       = new System.Windows.Forms.Panel();
     this.txtBarcodeEdit2 = new System.Windows.Forms.TextBox();
     this.label6          = new System.Windows.Forms.Label();
     this.panel2          = new System.Windows.Forms.Panel();
     this.btnRemove       = new System.Windows.Forms.Button();
     this.btnCancelEdit   = new System.Windows.Forms.Button();
     this.btnSaveEdit     = new System.Windows.Forms.Button();
     this.txtBarcodeEdit1 = new System.Windows.Forms.TextBox();
     this.label3          = new System.Windows.Forms.Label();
     this.pnlMain         = new System.Windows.Forms.Panel();
     this.dataGridView1   = new System.Windows.Forms.DataGridView();
     this.txtSearch       = new System.Windows.Forms.TextBox();
     this.pnlTop.SuspendLayout();
     this.panel3.SuspendLayout();
     this.panel1.SuspendLayout();
     this.pnlFooter.SuspendLayout();
     this.panel2.SuspendLayout();
     this.pnlMain.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
     this.SuspendLayout();
     //
     // pnlTop
     //
     this.pnlTop.Controls.Add(this.lblMsg);
     this.pnlTop.Controls.Add(this.txtBarcode2);
     this.pnlTop.Controls.Add(this.label5);
     this.pnlTop.Controls.Add(this.panel3);
     this.pnlTop.Controls.Add(this.panel1);
     this.pnlTop.Controls.Add(this.txtBarcode1);
     this.pnlTop.Controls.Add(this.label2);
     this.pnlTop.Controls.Add(this.txtNaka);
     this.pnlTop.Controls.Add(this.label1);
     this.pnlTop.Dock     = System.Windows.Forms.DockStyle.Top;
     this.pnlTop.Location = new System.Drawing.Point(0, 0);
     this.pnlTop.Name     = "pnlTop";
     this.pnlTop.Size     = new System.Drawing.Size(684, 133);
     this.pnlTop.TabIndex = 0;
     //
     // lblMsg
     //
     this.lblMsg.BackColor = System.Drawing.Color.Salmon;
     this.lblMsg.Dock      = System.Windows.Forms.DockStyle.Bottom;
     this.lblMsg.Location  = new System.Drawing.Point(0, 113);
     this.lblMsg.Name      = "lblMsg";
     this.lblMsg.Size      = new System.Drawing.Size(684, 20);
     this.lblMsg.TabIndex  = 7;
     this.lblMsg.Text      = "پيغام‌ها";
     //
     // txtBarcode2
     //
     this.txtBarcode2.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.txtBarcode2.Location     = new System.Drawing.Point(14, 41);
     this.txtBarcode2.Name         = "txtBarcode2";
     this.txtBarcode2.Size         = new System.Drawing.Size(245, 26);
     this.txtBarcode2.TabIndex     = 2;
     this.txtBarcode2.Tag          = "S";
     this.txtBarcode2.TextChanged += new System.EventHandler(this.TxtBarcode1_TextChanged);
     this.txtBarcode2.Enter       += new System.EventHandler(this.TxtNaka_Enter);
     this.txtBarcode2.KeyDown     += new System.Windows.Forms.KeyEventHandler(this.TxtBarcode2_KeyDown);
     this.txtBarcode2.Leave       += new System.EventHandler(this.TxtNaka_Leave);
     //
     // label5
     //
     this.label5.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label5.AutoSize = true;
     this.label5.Location = new System.Drawing.Point(265, 42);
     this.label5.Name     = "label5";
     this.label5.Size     = new System.Drawing.Size(81, 20);
     this.label5.TabIndex = 6;
     this.label5.Text     = "باركد2 (S) : ";
     //
     // panel3
     //
     this.panel3.Controls.Add(this.button3);
     this.panel3.Controls.Add(this.button4);
     this.panel3.Location = new System.Drawing.Point(12, 75);
     this.panel3.Name     = "panel3";
     this.panel3.Size     = new System.Drawing.Size(200, 29);
     this.panel3.TabIndex = 4;
     //
     // button3
     //
     this.button3.BackColor = System.Drawing.Color.DarkGoldenrod;
     this.button3.ForeColor = System.Drawing.Color.Snow;
     this.button3.Location  = new System.Drawing.Point(-1, 0);
     this.button3.Name      = "button3";
     this.button3.Size      = new System.Drawing.Size(105, 29);
     this.button3.TabIndex  = 3;
     this.button3.Text      = "ارسال به اكسل";
     this.button3.UseVisualStyleBackColor = false;
     this.button3.Click += new System.EventHandler(this.Excell_Click);
     //
     // button4
     //
     this.button4.BackColor = System.Drawing.Color.DarkSlateBlue;
     this.button4.ForeColor = System.Drawing.SystemColors.ButtonFace;
     this.button4.Location  = new System.Drawing.Point(103, 0);
     this.button4.Name      = "button4";
     this.button4.Size      = new System.Drawing.Size(82, 29);
     this.button4.TabIndex  = 2;
     this.button4.Text      = "چاپ";
     this.button4.UseVisualStyleBackColor = false;
     this.button4.Click += new System.EventHandler(this.Print_Click);
     //
     // panel1
     //
     this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.panel1.Controls.Add(this.button2);
     this.panel1.Controls.Add(this.button1);
     this.panel1.Location = new System.Drawing.Point(484, 71);
     this.panel1.Name     = "panel1";
     this.panel1.Size     = new System.Drawing.Size(195, 33);
     this.panel1.TabIndex = 3;
     //
     // button2
     //
     this.button2.BackColor = System.Drawing.Color.Crimson;
     this.button2.ForeColor = System.Drawing.SystemColors.ButtonFace;
     this.button2.Location  = new System.Drawing.Point(17, 1);
     this.button2.Name      = "button2";
     this.button2.Size      = new System.Drawing.Size(82, 29);
     this.button2.TabIndex  = 1;
     this.button2.Text      = "انصراف";
     this.button2.UseVisualStyleBackColor = false;
     this.button2.Click += new System.EventHandler(this.Delete_Click);
     //
     // button1
     //
     this.button1.BackColor = System.Drawing.Color.LimeGreen;
     this.button1.Location  = new System.Drawing.Point(105, 1);
     this.button1.Name      = "button1";
     this.button1.Size      = new System.Drawing.Size(82, 29);
     this.button1.TabIndex  = 0;
     this.button1.Text      = "ثبت";
     this.button1.UseVisualStyleBackColor = false;
     this.button1.Click += new System.EventHandler(this.Save_Click);
     //
     // txtBarcode1
     //
     this.txtBarcode1.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.txtBarcode1.Location     = new System.Drawing.Point(349, 40);
     this.txtBarcode1.Name         = "txtBarcode1";
     this.txtBarcode1.Size         = new System.Drawing.Size(245, 26);
     this.txtBarcode1.TabIndex     = 1;
     this.txtBarcode1.Tag          = "P";
     this.txtBarcode1.TextChanged += new System.EventHandler(this.TxtBarcode1_TextChanged);
     this.txtBarcode1.Enter       += new System.EventHandler(this.TxtNaka_Enter);
     this.txtBarcode1.KeyDown     += new System.Windows.Forms.KeyEventHandler(this.TxtNaka_KeyDown);
     this.txtBarcode1.Leave       += new System.EventHandler(this.TxtNaka_Leave);
     //
     // label2
     //
     this.label2.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label2.AutoSize = true;
     this.label2.Location = new System.Drawing.Point(600, 41);
     this.label2.Name     = "label2";
     this.label2.Size     = new System.Drawing.Size(80, 20);
     this.label2.TabIndex = 2;
     this.label2.Text     = "باركد1 (P) : ";
     //
     // txtNaka
     //
     this.txtNaka.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.txtNaka.Enabled  = false;
     this.txtNaka.Location = new System.Drawing.Point(349, 8);
     this.txtNaka.Name     = "txtNaka";
     this.txtNaka.Size     = new System.Drawing.Size(245, 26);
     this.txtNaka.TabIndex = 0;
     this.txtNaka.Enter   += new System.EventHandler(this.TxtNaka_Enter);
     this.txtNaka.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TxtNaka_KeyDown);
     this.txtNaka.Leave   += new System.EventHandler(this.TxtNaka_Leave);
     //
     // label1
     //
     this.label1.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label1.AutoSize = true;
     this.label1.Location = new System.Drawing.Point(600, 9);
     this.label1.Name     = "label1";
     this.label1.Size     = new System.Drawing.Size(53, 20);
     this.label1.TabIndex = 0;
     this.label1.Text     = "نام كالا :";
     //
     // pnlFooter
     //
     this.pnlFooter.Controls.Add(this.txtBarcodeEdit2);
     this.pnlFooter.Controls.Add(this.label6);
     this.pnlFooter.Controls.Add(this.panel2);
     this.pnlFooter.Controls.Add(this.txtBarcodeEdit1);
     this.pnlFooter.Controls.Add(this.label3);
     this.pnlFooter.Dock     = System.Windows.Forms.DockStyle.Bottom;
     this.pnlFooter.Location = new System.Drawing.Point(0, 283);
     this.pnlFooter.Name     = "pnlFooter";
     this.pnlFooter.Size     = new System.Drawing.Size(684, 78);
     this.pnlFooter.TabIndex = 1;
     this.pnlFooter.Visible  = false;
     //
     // txtBarcodeEdit2
     //
     this.txtBarcodeEdit2.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.txtBarcodeEdit2.Location     = new System.Drawing.Point(11, 7);
     this.txtBarcodeEdit2.Name         = "txtBarcodeEdit2";
     this.txtBarcodeEdit2.Size         = new System.Drawing.Size(245, 26);
     this.txtBarcodeEdit2.TabIndex     = 2;
     this.txtBarcodeEdit2.Tag          = "S";
     this.txtBarcodeEdit2.TextChanged += new System.EventHandler(this.TxtBarcode1_TextChanged);
     this.txtBarcodeEdit2.Enter       += new System.EventHandler(this.TxtNaka_Enter);
     this.txtBarcodeEdit2.KeyDown     += new System.Windows.Forms.KeyEventHandler(this.TxtBarcodeEdit2_KeyDown);
     this.txtBarcodeEdit2.Leave       += new System.EventHandler(this.TxtNaka_Leave);
     //
     // label6
     //
     this.label6.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label6.AutoSize = true;
     this.label6.Location = new System.Drawing.Point(262, 8);
     this.label6.Name     = "label6";
     this.label6.Size     = new System.Drawing.Size(81, 20);
     this.label6.TabIndex = 10;
     this.label6.Text     = "باركد2 (S) : ";
     //
     // panel2
     //
     this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.panel2.Controls.Add(this.btnRemove);
     this.panel2.Controls.Add(this.btnCancelEdit);
     this.panel2.Controls.Add(this.btnSaveEdit);
     this.panel2.Location = new System.Drawing.Point(399, 37);
     this.panel2.Name     = "panel2";
     this.panel2.Size     = new System.Drawing.Size(277, 33);
     this.panel2.TabIndex = 3;
     //
     // btnRemove
     //
     this.btnRemove.BackColor = System.Drawing.Color.Red;
     this.btnRemove.ForeColor = System.Drawing.Color.Transparent;
     this.btnRemove.Location  = new System.Drawing.Point(97, 2);
     this.btnRemove.Name      = "btnRemove";
     this.btnRemove.Size      = new System.Drawing.Size(82, 29);
     this.btnRemove.TabIndex  = 3;
     this.btnRemove.Text      = "حذف";
     this.btnRemove.UseVisualStyleBackColor = false;
     this.btnRemove.Click += new System.EventHandler(this.BtnRemove_Click);
     //
     // btnCancelEdit
     //
     this.btnCancelEdit.BackColor = System.Drawing.Color.Crimson;
     this.btnCancelEdit.ForeColor = System.Drawing.SystemColors.ButtonFace;
     this.btnCancelEdit.Location  = new System.Drawing.Point(17, 1);
     this.btnCancelEdit.Name      = "btnCancelEdit";
     this.btnCancelEdit.Size      = new System.Drawing.Size(82, 29);
     this.btnCancelEdit.TabIndex  = 1;
     this.btnCancelEdit.Text      = "انصراف";
     this.btnCancelEdit.UseVisualStyleBackColor = false;
     this.btnCancelEdit.Click += new System.EventHandler(this.CancelEdit_Click);
     //
     // btnSaveEdit
     //
     this.btnSaveEdit.BackColor = System.Drawing.Color.LimeGreen;
     this.btnSaveEdit.Location  = new System.Drawing.Point(190, 1);
     this.btnSaveEdit.Name      = "btnSaveEdit";
     this.btnSaveEdit.Size      = new System.Drawing.Size(82, 29);
     this.btnSaveEdit.TabIndex  = 0;
     this.btnSaveEdit.Text      = "ثبت";
     this.btnSaveEdit.UseVisualStyleBackColor = false;
     this.btnSaveEdit.Click += new System.EventHandler(this.BtnSaveEdit_Click);
     //
     // txtBarcodeEdit1
     //
     this.txtBarcodeEdit1.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.txtBarcodeEdit1.Location     = new System.Drawing.Point(347, 6);
     this.txtBarcodeEdit1.Name         = "txtBarcodeEdit1";
     this.txtBarcodeEdit1.Size         = new System.Drawing.Size(245, 26);
     this.txtBarcodeEdit1.TabIndex     = 1;
     this.txtBarcodeEdit1.Tag          = "P";
     this.txtBarcodeEdit1.TextChanged += new System.EventHandler(this.TxtBarcode1_TextChanged);
     this.txtBarcodeEdit1.Enter       += new System.EventHandler(this.TxtNaka_Enter);
     this.txtBarcodeEdit1.KeyDown     += new System.Windows.Forms.KeyEventHandler(this.TxtNaka_KeyDown);
     this.txtBarcodeEdit1.Leave       += new System.EventHandler(this.TxtNaka_Leave);
     //
     // label3
     //
     this.label3.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.label3.AutoSize = true;
     this.label3.Location = new System.Drawing.Point(598, 7);
     this.label3.Name     = "label3";
     this.label3.Size     = new System.Drawing.Size(80, 20);
     this.label3.TabIndex = 7;
     this.label3.Text     = "باركد1 (P) : ";
     //
     // pnlMain
     //
     this.pnlMain.Controls.Add(this.dataGridView1);
     this.pnlMain.Controls.Add(this.txtSearch);
     this.pnlMain.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.pnlMain.Location = new System.Drawing.Point(0, 133);
     this.pnlMain.Name     = "pnlMain";
     this.pnlMain.Size     = new System.Drawing.Size(684, 150);
     this.pnlMain.TabIndex = 2;
     //
     // dataGridView1
     //
     this.dataGridView1.AllowUserToAddRows          = false;
     this.dataGridView1.AllowUserToDeleteRows       = false;
     this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     this.dataGridView1.Dock              = System.Windows.Forms.DockStyle.Fill;
     this.dataGridView1.Location          = new System.Drawing.Point(0, 26);
     this.dataGridView1.Name              = "dataGridView1";
     this.dataGridView1.ReadOnly          = true;
     this.dataGridView1.RightToLeft       = System.Windows.Forms.RightToLeft.No;
     this.dataGridView1.RowHeadersVisible = false;
     this.dataGridView1.SelectionMode     = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
     this.dataGridView1.Size              = new System.Drawing.Size(684, 124);
     this.dataGridView1.TabIndex          = 0;
     this.dataGridView1.CellDoubleClick  += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridView1_CellDoubleClick);
     this.dataGridView1.KeyDown          += new System.Windows.Forms.KeyEventHandler(this.DataGridView1_KeyDown);
     //
     // txtSearch
     //
     this.txtSearch.Dock         = System.Windows.Forms.DockStyle.Top;
     this.txtSearch.Location     = new System.Drawing.Point(0, 0);
     this.txtSearch.Name         = "txtSearch";
     this.txtSearch.Size         = new System.Drawing.Size(684, 26);
     this.txtSearch.TabIndex     = 1;
     this.txtSearch.TextChanged += new System.EventHandler(this.Txtsearch_TextChanged);
     this.txtSearch.Enter       += new System.EventHandler(this.TxtNaka_Enter);
     this.txtSearch.KeyDown     += new System.Windows.Forms.KeyEventHandler(this.Txtsearch_KeyDown);
     this.txtSearch.Leave       += new System.EventHandler(this.TxtNaka_Leave);
     //
     // BarcodeDefinition
     //
     this.ClientSize = new System.Drawing.Size(684, 361);
     this.Controls.Add(this.pnlMain);
     this.Controls.Add(this.pnlFooter);
     this.Controls.Add(this.pnlTop);
     this.Font        = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(178)));
     this.Name        = "BarcodeDefinition";
     this.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
     this.Text        = "تعريف كالا";
     this.pnlTop.ResumeLayout(false);
     this.pnlTop.PerformLayout();
     this.panel3.ResumeLayout(false);
     this.panel1.ResumeLayout(false);
     this.pnlFooter.ResumeLayout(false);
     this.pnlFooter.PerformLayout();
     this.panel2.ResumeLayout(false);
     this.pnlMain.ResumeLayout(false);
     this.pnlMain.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
     this.ResumeLayout(false);
 }
Example #58
0
        private void add_product()
        {
            TabPage newTabPage = new TabPage("Продукт");

            Label label1 = new System.Windows.Forms.Label();

            label1.AutoSize = true;
            label1.Location = new System.Drawing.Point(10, 15);
            label1.Text     = "Наименование (код)";

            ComboBox cb_nameProduct = new System.Windows.Forms.ComboBox();

            cb_nameProduct.FormattingEnabled = true;
            cb_nameProduct.Location          = new System.Drawing.Point(10, 30);
            cb_nameProduct.Name                  = "cb_nameProduct";
            cb_nameProduct.Size                  = new System.Drawing.Size(150, 21);
            cb_nameProduct.TabIndex              = 1;
            cb_nameProduct.SelectedIndexChanged += new System.EventHandler(this.cb_nameProduct_SelectedIndexChanged);
            foreach (Product pr in products)
            {
                cb_nameProduct.Items.Add(pr.ToString());
            }



            Label label2 = new System.Windows.Forms.Label();

            label2.AutoSize = true;
            label2.Location = new System.Drawing.Point(180, 15);
            label2.Text     = "Количество";

            TextBox tb_Count = new System.Windows.Forms.TextBox();

            tb_Count.Location     = new System.Drawing.Point(180, 30);
            tb_Count.Name         = "tb_Count";
            tb_Count.Size         = new System.Drawing.Size(80, 20);
            tb_Count.TabIndex     = 2;
            tb_Count.KeyPress    += new KeyPressEventHandler(integer_tb_validator);
            tb_Count.TextChanged += new EventHandler(tb_count_textChanged);



            Label label3 = new System.Windows.Forms.Label();

            label3.AutoSize = true;
            label3.Location = new System.Drawing.Point(280, 15);
            label3.Text     = "Цена продажи";

            TextBox tb_Price = new System.Windows.Forms.TextBox();

            tb_Price.Location     = new System.Drawing.Point(280, 30);
            tb_Price.Name         = "tb_Price";
            tb_Price.Size         = new System.Drawing.Size(80, 20);
            tb_Price.TabIndex     = 3;
            tb_Price.KeyPress    += new KeyPressEventHandler(float_tb_validator);
            tb_Price.TextChanged += new EventHandler(tb_priceProd_textChanged);

            Label labelSPriceUnit = new System.Windows.Forms.Label();

            labelSPriceUnit.AutoSize = true;
            labelSPriceUnit.Location = new System.Drawing.Point(365, 30);
            labelSPriceUnit.Text     = "руб";



            Label labelFact = new System.Windows.Forms.Label();

            labelFact.AutoSize = true;
            labelFact.Location = new System.Drawing.Point(10, 60);
            labelFact.Text     = "Факт. выпуск";

            TextBox tb_Fact = new System.Windows.Forms.TextBox();

            tb_Fact.Location  = new System.Drawing.Point(10, 75);
            tb_Fact.Name      = "tb_Fact";
            tb_Fact.Size      = new System.Drawing.Size(80, 20);
            tb_Fact.TabIndex  = 3;
            tb_Fact.KeyPress += new KeyPressEventHandler(integer_tb_validator);



            Label labelMass = new System.Windows.Forms.Label();

            labelMass.AutoSize = true;
            labelMass.Location = new System.Drawing.Point(180, 60);
            labelMass.Text     = "Масса 1 шт";

            TextBox tb_Mass = new System.Windows.Forms.TextBox();

            tb_Mass.Location = new System.Drawing.Point(180, 75);
            tb_Mass.Name     = "tb_Mass";
            //tb_Mass.ReadOnly = true;
            tb_Mass.Size      = new System.Drawing.Size(80, 20);
            tb_Mass.TabStop   = false;
            tb_Mass.KeyPress += new KeyPressEventHandler(float_tb_validator);
            //tb_Mass.Text = "100";

            Label labelMassUnit = new System.Windows.Forms.Label();

            labelMassUnit.AutoSize = true;
            labelMassUnit.Location = new System.Drawing.Point(265, 75);
            labelMassUnit.Text     = "г.";



            Label labelSum = new System.Windows.Forms.Label();

            labelSum.AutoSize = true;
            labelSum.Location = new System.Drawing.Point(280, 60);
            labelSum.Text     = "Сумма";

            TextBox tb_Sum = new System.Windows.Forms.TextBox();

            tb_Sum.Location = new System.Drawing.Point(280, 75);
            tb_Sum.Name     = "tb_Sum";
            tb_Sum.ReadOnly = true;
            tb_Sum.Size     = new System.Drawing.Size(80, 20);
            tb_Sum.TabStop  = false;

            Label labelSumUnit = new System.Windows.Forms.Label();

            labelSumUnit.AutoSize = true;
            labelSumUnit.Location = new System.Drawing.Point(365, 75);
            labelSumUnit.Text     = "руб";



            Button btn_Close = new System.Windows.Forms.Button();

            btn_Close.Location = new System.Drawing.Point(tabProducts.Width - 30, 0);
            btn_Close.Name     = "btn_CloseProduct";
            btn_Close.Size     = new System.Drawing.Size(20, 20);
            btn_Close.TabStop  = false;
            btn_Close.Text     = "X";
            btn_Close.Click   += new System.EventHandler(this.btn_CloseProduct_Click);



            DataGridViewTextBoxColumn  Col_Norma = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewComboBoxColumn Col_unit  = new System.Windows.Forms.DataGridViewComboBoxColumn();
            DataGridViewTextBoxColumn  Col_sum   = new System.Windows.Forms.DataGridViewTextBoxColumn();

            //
            // Col_Norma
            //
            Col_Norma.HeaderText = "Норма";
            Col_Norma.Name       = "Col_Norma";
            Col_Norma.Width      = 215;
            //
            // Col_sum
            //
            Col_sum.HeaderText = "Всего";
            Col_sum.Name       = "Col_sum";
            Col_sum.ReadOnly   = true;
            Col_sum.Resizable  = System.Windows.Forms.DataGridViewTriState.True;
            Col_sum.SortMode   = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            Col_sum.Width      = 185;



            DataGridView dgv_MaterialsPr_1 = new System.Windows.Forms.DataGridView();

            dgv_MaterialsPr_1.Location = new Point(10, 121);
            ((System.ComponentModel.ISupportInitialize)(dgv_MaterialsPr_1)).BeginInit();
            dgv_MaterialsPr_1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            dgv_MaterialsPr_1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                Col_Norma,
                Col_sum
            });
            dgv_MaterialsPr_1.Name                     = "dgv_MaterialsPr"; // + tabProducts.TabCount;
            dgv_MaterialsPr_1.Size                     = new System.Drawing.Size(440, 384);
            dgv_MaterialsPr_1.TabIndex                 = 125;
            dgv_MaterialsPr_1.AllowUserToAddRows       = false;
            dgv_MaterialsPr_1.AllowUserToDeleteRows    = false;
            dgv_MaterialsPr_1.AllowUserToOrderColumns  = false;
            dgv_MaterialsPr_1.AllowUserToResizeColumns = false;
            dgv_MaterialsPr_1.AllowUserToResizeRows    = false;

            dgv_MaterialsPr_1.RowHeadersVisible = false;
            dgv_MaterialsPr_1.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgv_MateialsPr_CellValueChanged);
            //dgv_MaterialsPr_1.ColumnHeadersHeight = 40;
            ((System.ComponentModel.ISupportInitialize)(dgv_MaterialsPr_1)).EndInit();


            newTabPage.Controls.Add(label1);
            newTabPage.Controls.Add(cb_nameProduct);
            newTabPage.Controls.Add(label2);
            newTabPage.Controls.Add(label3);

            newTabPage.Controls.Add(labelMass);
            newTabPage.Controls.Add(tb_Mass);
            newTabPage.Controls.Add(labelMassUnit);

            newTabPage.Controls.Add(tb_Count);
            newTabPage.Controls.Add(tb_Price);
            newTabPage.Controls.Add(labelSPriceUnit);

            newTabPage.Controls.Add(labelFact);
            newTabPage.Controls.Add(tb_Fact);

            newTabPage.Controls.Add(labelSum);
            newTabPage.Controls.Add(tb_Sum);
            newTabPage.Controls.Add(labelSumUnit);

            newTabPage.Controls.Add(btn_Close);

            newTabPage.Controls.Add(dgv_MaterialsPr_1);

            newTabPage.ResumeLayout(false);
            newTabPage.PerformLayout();

            tabProducts.TabPages.Add(newTabPage);

            tabProducts.SelectedTab = newTabPage;

            //panelMaterials.VerticalScroll.Value = panelMaterials.VerticalScroll.Value;

            for (int j = 0; j < countMaterials; j++)
            {
                copy_material(tabProducts.TabCount - 1, j);
            }
        }
Example #59
0
        /// <summary>
        /// Поиск текста по гриду.
        /// </summary>
        /// <param name="DGSearch"></param>
        /// <param name="DGResult"></param>
        /// <param name="SearchText"></param>
        /// <param name="FirstRow"></param>
        /// <param name="CaseSensitivity"></param>
        /// <param name="OnlySelectedColumns"></param>
        /// <param name="OnlySelectedRows"></param>
        /// <param name="OnlySelectedArea"></param>
        /// <param name="SearchDirection"></param>
        /// <param name="SearchPart"></param>
        /// <param name="SelectedRows"></param>
        /// <param name="SelectedColumns"></param>
        /// <param name="FindCount"></param>
        /// <returns></returns>
        public static bool SerchTextSourceGrid(FBA.GridFBA DGSearch,
                                               System.Windows.Forms.DataGridView DGResult,
                                               string SearchText,
                                               int FirstRow,
                                               bool CaseSensitivity,
                                               bool OnlySelectedColumns,
                                               bool OnlySelectedRows,
                                               bool OnlySelectedArea,
                                               int SearchDirection,
                                               int SearchPart,
                                               int[] SelectedRows,
                                               int[] SelectedColumns,
                                               ref int FindCount)

        {
            //SearchPart = 1 - Exact match.
            //SearchPart = 2 - Starts with text.
            //SearchPart = 3 - Ends with text.
            //SearchPart = 4 - Contain text.

            //SearchDirection = 1 - All.
            //SearchDirection = 2 - Down.
            //SearchDirection = 3 - Up.

            //SearchDirection = 0
            if (SearchText.IsNullOrEmpty())
            {
                return(false);
            }

            //Чувствительность к регистру. Если true, то регистрозависимый поиск.
            if (!CaseSensitivity)
            {
                SearchText = SearchText.ToLower();
            }

            //Если поиск Ends with text.
            if (SearchPart == 3)
            {
                SearchText = SearchText.Reverse();
            }

            if (DGResult != null)
            {
                //Копируем структуру. Только названия полей.
                DGResult.Columns.Add("Num", "Num");
                for (int j = 0; j < DGSearch.Columns.Count; j++)
                {
                    string ColumnName   = DGSearch.Columns[j].PropertyName;
                    string ColumnHeader = DGSearch.Columns[j].PropertyName;
                    DGResult.Columns.Add(ColumnName, ColumnHeader);
                }
            }

            string Value     = "";
            int    CountFind = 0;

            //Ищем по всему гриду или только вниз.
            if ((SearchDirection == 1) || (SearchDirection == 2))
            {
                for (int iRow = FirstRow; iRow < DGSearch.Rows.Count; iRow++)
                {
                    //Если поиск по выделенным строкам
                    if ((OnlySelectedArea) || (OnlySelectedRows))
                    {
                        if (!SelectedRows.Contains(iRow))
                        {
                            continue;
                        }
                    }

                    bool FindRow = false;
                    for (int iColumn = 0; iColumn < DGSearch.Columns.Count; iColumn++)
                    {
                        //Если поиск по выделенным колонкам
                        if ((OnlySelectedArea) || (OnlySelectedColumns))
                        {
                            if (!SelectedColumns.Contains(iColumn))
                            {
                                continue;
                            }
                        }

                        bool FindCell = false;
                        if (!CaseSensitivity)
                        {
                            Value = DGSearch.Value(iRow, iColumn).ToLower();
                        }
                        else
                        {
                            Value = DGSearch.Value(iRow, iColumn);
                        }

                        if ((SearchPart == 1) && (Value == SearchText))
                        {
                            FindCell = true;
                        }
                        if ((SearchPart == 2) && (Value.IndexOf(SearchText, StringComparison.CurrentCulture) == 0))
                        {
                            FindCell = true;
                        }
                        if ((SearchPart == 3) && (Value.Reverse().IndexOf(SearchText, StringComparison.CurrentCulture) == 0))
                        {
                            FindCell = true;
                        }
                        if ((SearchPart == 4) && (Value.IndexOf(SearchText, StringComparison.CurrentCulture) > -1))
                        {
                            FindCell = true;
                        }
                        if (!FindCell)
                        {
                            continue;
                        }
                        CountFind++;
                        if (CountFind == 1)
                        {
                            DGSearch.SelectColumnRowCell(iRow, iColumn, true);                 //В sysData.
                        }
                        FindRow = true;
                        FindCount++;
                    }

                    //Если нашли строку:
                    if (FindRow)
                    {
                        var rowstr = new string[DGSearch.Columns.Count + 1];
                        rowstr[0] = (iRow - 1).ToString();
                        for (int N = 0; N < DGSearch.Columns.Count; N++)
                        {
                            rowstr[N + 1] = DGSearch.Value(iRow, N);
                        }
                        if (DGResult != null)
                        {
                            DGResult.Rows.Add(rowstr);
                        }

                        //Если ищем только до первой найденной строки, то выходим. Direction Search = Down.
                        if (SearchDirection == 2)
                        {
                            return(true);
                        }
                    }
                }
            }

            if (SearchDirection == 3)
            {
                for (int iRow = DGSearch.Rows.Count - 1; iRow >= 0; iRow--)
                {
                    //Если поиск по выделенным строкам
                    if ((OnlySelectedArea) || (OnlySelectedRows))
                    {
                        if (!SelectedRows.Contains(iRow))
                        {
                            continue;
                        }
                    }

                    bool FindRow = false;
                    for (int iColumn = 0; iColumn < DGSearch.Columns.Count; iColumn++)
                    {
                        //Если поиск по выделенным колонкам
                        if ((OnlySelectedArea) || (OnlySelectedColumns))
                        {
                            if (!SelectedColumns.Contains(iColumn))
                            {
                                continue;
                            }
                        }

                        bool FindCell = false;
                        if (!CaseSensitivity)
                        {
                            Value = DGSearch.Value(iRow, iColumn).ToLower();
                        }
                        else
                        {
                            Value = DGSearch.Value(iRow, iColumn);
                        }

                        if ((SearchPart == 1) && (Value == SearchText))
                        {
                            FindCell = true;
                        }
                        if ((SearchPart == 2) && (Value.IndexOf(SearchText, StringComparison.CurrentCulture) == 0))
                        {
                            FindCell = true;
                        }
                        if ((SearchPart == 3) && (Value.Reverse().IndexOf(SearchText, StringComparison.CurrentCulture) == 0))
                        {
                            FindCell = true;
                        }
                        if ((SearchPart == 4) && (Value.IndexOf(SearchText, StringComparison.CurrentCulture) > -1))
                        {
                            FindCell = true;
                        }
                        if (!FindCell)
                        {
                            continue;
                        }
                        CountFind++;
                        if (CountFind == 1)
                        {
                            DGSearch.SelectColumnRowCell(iRow, iColumn, true);                 //В sysData.
                        }
                        FindRow = true;
                        FindCount++;
                    }

                    //Если нашли строку:
                    if (FindRow)
                    {
                        var rowstr = new string[DGSearch.Columns.Count + 1];
                        rowstr[0] = (iRow - 1).ToString();
                        for (int N = 0; N < DGSearch.Columns.Count; N++)
                        {
                            rowstr[N + 1] = DGSearch.Value(iRow, N);
                        }
                        DGResult.Rows.Add(rowstr);

                        //Если ищем только до первой найденной строки, то выходим. Direction Search = Up.
                        return(true);
                    }
                }
            }
            return(FindCount > 0);
        }