// The class constructor
 public DataGridViewPrinter( DataGridView [] aDataGridList
         , PrintDocument aPrintDocument
         , bool CenterOnPage
         , bool WithTitle
         , string aTitleText
         , Font aTitleFont
         , Color aTitleColor
         , bool WithPaging
     )
 {
     TheDataGridList = aDataGridList;
     InitializeComponent(aPrintDocument, CenterOnPage, WithTitle, aTitleText, aTitleFont, aTitleColor, WithPaging );
 }
Пример #2
1
    // The class constructor
    public DataGridViewPrinter(DataGridView aDataGridView,
        PrintDocument aPrintDocument,
        bool CenterOnPage, bool WithTitle,
        string aTitleText, Font aTitleFont,
        Color aTitleColor, bool WithPaging)
    {
        TheDataGridView = aDataGridView;
        ThePrintDocument = aPrintDocument;
        IsCenterOnPage = CenterOnPage;
        IsWithTitle = WithTitle;
        TheTitleText = aTitleText;
        TheTitleFont = aTitleFont;
        TheTitleColor = aTitleColor;
        IsWithPaging = WithPaging;

        PageNumber = 0;

        RowsHeight = new List<float>();
        ColumnsWidth = new List<float>();

        mColumnPoints = new List<int[]>();
        mColumnPointsWidth = new List<float>();

        // Claculating the PageWidth and the PageHeight
        if (!ThePrintDocument.DefaultPageSettings.Landscape)
        {
            PageWidth =
              ThePrintDocument.DefaultPageSettings.PaperSize.Width;
            PageHeight =
              ThePrintDocument.DefaultPageSettings.PaperSize.Height;
        }
        else
        {
            PageHeight =
              ThePrintDocument.DefaultPageSettings.PaperSize.Width;
            PageWidth =
              ThePrintDocument.DefaultPageSettings.PaperSize.Height;
        }

        // Claculating the page margins
        LeftMargin = ThePrintDocument.DefaultPageSettings.Margins.Left;
        TopMargin = ThePrintDocument.DefaultPageSettings.Margins.Top;
        RightMargin = ThePrintDocument.DefaultPageSettings.Margins.Right;
        BottomMargin = ThePrintDocument.DefaultPageSettings.Margins.Bottom;

        // First, the current row to be printed
        // is the first row in the DataGridView control
        CurrentRow = 0;
    }
Пример #3
0
	public MainForm ()
	{
		// 
		// _dataGridView
		// 
		_dataGridView = new DataGridView ();
		_dataGridView.Dock = DockStyle.Fill;
		Controls.Add (_dataGridView);
		// 
		// _nameTextBoxColumn
		// 
		_nameTextBoxColumn = new DataGridViewTextBoxColumn ();
		_nameTextBoxColumn.HeaderText = "Name";
		_dataGridView.Columns.Add (_nameTextBoxColumn);
		// 
		// _firstNameTextBoxColumn
		// 
		_firstNameTextBoxColumn = new DataGridViewTextBoxColumn ();
		_firstNameTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
		_firstNameTextBoxColumn.HeaderText = "First Name";
		_dataGridView.Columns.Add (_firstNameTextBoxColumn);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 190);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #82219";
		Load += new EventHandler (MainForm_Load);
	}
Пример #4
0
	public MainForm ()
	{
		// 
		// _dataGridView
		// 
		_dataGridView = new DataGridView ();
		_dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		_dataGridView.Location = new Point (26, 22);
		_dataGridView.Size = new Size (240, 221);
		_dataGridView.TabIndex = 0;
		Controls.Add (_dataGridView);
		// 
		// _changeButton
		// 
		_changeButton = new Button ();
		_changeButton.Location = new Point (97, 261);
		_changeButton.Size = new Size (112, 32);
		_changeButton.TabIndex = 1;
		_changeButton.Text = "&Change";
		_changeButton.UseVisualStyleBackColor = true;
		_changeButton.Click += new EventHandler (ChangeButton_Click);
		Controls.Add (_changeButton);
		// 
		// MainForm
		// 
		AutoScaleDimensions = new SizeF (6F, 13F);
		AutoScaleMode = AutoScaleMode.Font;
		BackColor = Color.FromArgb (((int) (((byte) (220)))), ((int) (((byte) (220)))), ((int) (((byte) (255)))));
		ClientSize = new Size (292, 305);
		Location = new Point (200, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #78523";
		Layout += new LayoutEventHandler (OnLayout);
		Load += new EventHandler (MainForm_Load);
	}
Пример #5
0
	public MainForm ()
	{
		// 
		// _dataGridView
		// 
		_dataGridView = new DataGridView ();
		_dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		_dataGridView.Dock = DockStyle.Fill;
		_dataGridView.TabIndex = 0;
		Controls.Add (_dataGridView);
		// 
		// _textBoxColumn
		// 
		_textBoxColumn = new DataGridViewTextBoxColumn ();
		_textBoxColumn.HeaderText = "ColumnA";
		_textBoxColumn.Name = "ColumnA";
		_dataGridView.Columns.Add (_textBoxColumn);
		// 
		// MainForm
		// 
		AutoScaleDimensions = new SizeF (6F, 13F);
		AutoScaleMode = AutoScaleMode.Font;
		ClientSize = new Size (292, 266);
		Location = new Point (200, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #80657";
		Load += new EventHandler (MainForm_Load);
	}
Пример #6
0
	public MainForm ()
	{
		_dataGrid = new DataGridView ();
		_column = new DataGridViewTextBoxColumn ();
		SuspendLayout ();
		((ISupportInitialize) (_dataGrid)).BeginInit ();
		// 
		// _dataGrid
		// 
		_dataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		_dataGrid.Columns.Add (_column);
		_dataGrid.RowTemplate.Height = 21;
		_dataGrid.Location = new Point (12, 115);
		_dataGrid.Size = new Size (268, 146);
		_dataGrid.TabIndex = 0;
		// 
		// _column
		// 
		_column.HeaderText = "Column";
		// 
		// MainForm
		// 
		ClientSize = new Size (292, 273);
		Controls.Add (_dataGrid);
		((ISupportInitialize) (_dataGrid)).EndInit ();
		ResumeLayout (false);
		Load += new EventHandler (MainForm_Load);
	}
Пример #7
0
 public static void DataGridViewFormat(DataGridView dgv, string[] columns)
 {
     foreach (DataGridViewColumn cl in dgv.Columns)
     {
         if (!columns.Contains(cl.DataPropertyName))
             cl.Visible = false;
     }
 }
Пример #8
0
	public MainForm ()
	{
		// 
		// _dataGridView
		// 
		_dataGridView = new DataGridView ();
		_dataGridView.Dock = DockStyle.Top;
		_dataGridView.Height = 100;
		Controls.Add (_dataGridView);
		// 
		// _nameTextBoxColumn
		// 
		_nameTextBoxColumn = new DataGridViewTextBoxColumn ();
		_nameTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
		_nameTextBoxColumn.HeaderText = "Name";
		_dataGridView.Columns.Add (_nameTextBoxColumn);
		// 
		// _columnHeadersHeightSizeModeGroupBox
		// 
		_columnHeadersHeightSizeModeGroupBox = new GroupBox ();
		_columnHeadersHeightSizeModeGroupBox.Dock = DockStyle.Bottom;
		_columnHeadersHeightSizeModeGroupBox.Height = 85;
		_columnHeadersHeightSizeModeGroupBox.Text = "ColumnHeadersHeightSizeMode";
		Controls.Add (_columnHeadersHeightSizeModeGroupBox);
		// 
		// _autoSizeHeightSizeMode
		// 
		_autoSizeHeightSizeMode = new RadioButton ();
		_autoSizeHeightSizeMode.Location = new Point (8, 16);
		_autoSizeHeightSizeMode.Text = "AutoSize";
		_autoSizeHeightSizeMode.CheckedChanged += new EventHandler (AutoSizeHeightSizeMode_CheckedChanged);
		_columnHeadersHeightSizeModeGroupBox.Controls.Add (_autoSizeHeightSizeMode);
		// 
		// _disableResizingHeightSizeMode
		// 
		_disableResizingHeightSizeMode = new RadioButton ();
		_disableResizingHeightSizeMode.Location = new Point (8, 36);
		_disableResizingHeightSizeMode.Text = "DisableResizing";
		_disableResizingHeightSizeMode.CheckedChanged += new EventHandler (DisableResizingHeightSizeMode_CheckedChanged);
		_columnHeadersHeightSizeModeGroupBox.Controls.Add (_disableResizingHeightSizeMode);
		// 
		// _enableResizingHeightSizeMode
		// 
		_enableResizingHeightSizeMode = new RadioButton ();
		_enableResizingHeightSizeMode.Checked = true;
		_enableResizingHeightSizeMode.Location = new Point (8, 56);
		_enableResizingHeightSizeMode.Text = "EnableResizing";
		_enableResizingHeightSizeMode.CheckedChanged += new EventHandler (EnableResizingHeightSizeMode_CheckedChanged);
		_columnHeadersHeightSizeModeGroupBox.Controls.Add (_enableResizingHeightSizeMode);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 195);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #82221";
		Load += new EventHandler (MainForm_Load);
	}
Пример #9
0
		public DataGridComparer(DataGridView datagrid)
		{
			_grid = datagrid;

			// No limit by default to the number of columns sorted.
			_maxSortColumns = 0;

			_sortedColumns = new List<SortColDefn>(_maxSortColumns);
		}
 protected override void OnCellBeginEdit(System.Windows.Forms.DataGridViewCellCancelEventArgs e)
 {
     //base.OnCellBeginEdit(e);
     int x, y;
     DataGridView dg = new DataGridView();
     dg.Height = 100;
     dg.Width = 100;
     dg.Visible = true;
     dg.BringToFront();
        // MessageBox.Show("SDF");
 }
Пример #11
0
	public Form1 () {
		//this.AutoSize = true;
		DataGridView dgv = new DataGridView();
		//dgv.Size = new Size(500,250);
		dgv.Location = new Point(10,10);
		dgv.EnableHeadersVisualStyles = false;
		dgv.AutoSize = true;
		this.Controls.Add(dgv);
		this.Text = "DataGridView advanced border styles demo";
		dgv.DataSource = GetList();
	}
Пример #12
0
 private void nextStep_Click(object sender, EventArgs e)
 {
     if (filePathText.Text == "")
         MessageBox.Show("Nebyl zvolen žádný soubor!");
     else
     {
         config.AddToUniqueList();
         DataGridView grid = new DataGridView();
         grid.Show();
         Close();
     }
 }
Пример #13
0
    public PartEditView()
    {
        this.SuspendLayout();

        tlp0 = new TableLayoutPanel();
        tlp0.Dock = DockStyle.Fill;
        this.Controls.Add(tlp0);

        txtPart = new TextBox();
        txtPart.Text = "";
        txtPart.Width *= 2;
        txtPart.ReadOnly = true;
        tlp0.Controls.Add(txtPart, 0, 0);

        btnSave = new Button();
        btnSave.Text = "Save";
        btnSave.Click += new EventHandler(delegate (object sender, EventArgs e) {
            if (OnSavePart != null && newPart != null) {
                foreach (DataRow row in newPart.Attributes.Rows) {
                    row.EndEdit();
                }
                OnSavePart(newPart);
            }
        });
        tlp0.Controls.Add(btnSave, 1, 0);

        btnReset = new Button();
        btnReset.Text = "Reset";
        btnReset.Click += new EventHandler(delegate (object sender, EventArgs e) {
            this.Reset();
        });
        tlp0.Controls.Add(btnReset, 2, 0);

        dgvAttributes = new DataGridView();
        dgvAttributes.Dock = DockStyle.Top;
        dgvAttributes.MultiSelect = false;
        dgvAttributes.RowHeadersVisible = false;
        dgvAttributes.AllowUserToAddRows = false;
        dgvAttributes.AllowUserToDeleteRows = false;
        dgvAttributes.DataBindingComplete += new DataGridViewBindingCompleteEventHandler(dgv_DataBindingComplete);
        dgvAttributes.CellParsing += new DataGridViewCellParsingEventHandler(dgv_CellParsing);
        tlp0.Controls.Add(dgvAttributes, 0, 1);
        tlp0.SetColumnSpan(dgvAttributes, 3);

        tlp0.RowCount = 2;
        tlp0.ColumnCount = 3;

        Util.FixTableLayoutStyles(tlp0);

        this.ResumeLayout();
    }
Пример #14
0
	public MainForm ()
	{
		// 
		// _dataGridView
		// 
		_dataGridView = new DataGridView ();
		_dataGridView.Dock = DockStyle.Top;
		_dataGridView.Height = 120;
		_dataGridView.MultiSelect = true;
		Controls.Add (_dataGridView);
		// 
		// _nameTextBoxColumn
		// 
		_nameTextBoxColumn = new DataGridViewTextBoxColumn ();
		_nameTextBoxColumn.HeaderText = "Name";
		_dataGridView.Columns.Add (_nameTextBoxColumn);
		// 
		// _firstNameTextBoxColumn
		// 
		_firstNameTextBoxColumn = new DataGridViewTextBoxColumn ();
		_firstNameTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
		_firstNameTextBoxColumn.HeaderText = "First Name";
		_dataGridView.Columns.Add (_firstNameTextBoxColumn);
		// 
		// _refreshButton
		// 
		_refreshButton = new Button ();
		_refreshButton.Location = new Point (8, 130);
		_refreshButton.Size = new Size (60, 20);
		_refreshButton.Text = "Refresh";
		_refreshButton.Click += new EventHandler (RefreshButton_Click);
		Controls.Add (_refreshButton);
		// 
		// _textBox
		// 
		_textBox = new TextBox ();
		_textBox.Dock = DockStyle.Bottom;
		_textBox.Height = 50;
		_textBox.Multiline = true;
		_textBox.ReadOnly = true;
		Controls.Add (_textBox);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 210);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #81075";
		Load += new EventHandler (MainForm_Load);
	}
Пример #15
0
	public MainForm ()
	{
		_dataGrid = new DataGridView ();
		_dataGrid.AutoGenerateColumns = true;
		Controls.Add (_dataGrid);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 200);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #79265";
		Load += new EventHandler (MainForm_Load);
	}
Пример #16
0
        public ProductFilter(ref DataGridView dataGridView, string ExcludeColumns)
        {
            InitializeComponent();
            _dataGridView = dataGridView;
            excludeColumns = ExcludeColumns;

            try
            {
                data = dataGridView.DataSource as BindingSource;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Product Filter", "The datasource property of the containing DataGridView control " +
                    "must be set to a BindingSource.");
            }
        }
Пример #17
0
    public PropertiesControl(NativeWorkbenchForm parent,
    DataGridView propertyControlGrid, ComboBox nativeGroupDDL, ComboBox nativeNameDDL, 
        Button addToPropBtn, Button addOnTickBtn, Button addImmediateButton, TextBox ontickText, TextBox immediateText, TextBox ouputText,
    CheckBox enablePropUpdate, CheckBox enableBoolColors)
    {
        _parent = parent;
        _propertyControlGrid = propertyControlGrid;
        _propertyControlGrid.Click += _propertyControlGrid_Click;
        _propertyControlGrid.LostFocus += _propertyControlGrid_LostFocus;
        
        NativeManager.Init();

        _nativeNameDDL = nativeNameDDL;
        _nativeGroupDDL = nativeGroupDDL;
        ItemGroup[] values = (ItemGroup[])Enum.GetValues(typeof(ItemGroup));
        var nativeValues = values.OrderBy(v => v.ToString()).ToList();
        nativeValues.Insert(0, ItemGroup.Select);
        _nativeGroupDDL.DataSource = nativeValues;
        _nativeNameDDL.DisplayMember = "NativeNameReturn";
        _nativeNameDDL.ValueMember = "NativeHash";
        _nativeNameDDL.SelectedValueChanged += _nativeNameDDL_SelectedValueChanged;
        _nativeGroupDDL.SelectedValueChanged += nativeGroupDDL_SelectedValueChanged;
        _nativeGroupDDL.GotFocus += _nativeGroupDDL_GotFocus;
        _nativeNameDDL.GotFocus += _nativeNameDDL_GotFocus;
        _ontickText = ontickText;
        _outputText = ouputText;
        _immediateText = immediateText;

        _enablePropUpdate = enablePropUpdate;
        _enablePropUpdate.CheckStateChanged += _enablePropUpdate_CheckStateChanged;

        _enableBoolColors = enableBoolColors;
        _enableBoolColors.CheckStateChanged += _enableBoolColors_CheckStateChanged;

        _addToPropBtn = addToPropBtn;
        _addOnTickBtn = addOnTickBtn;
        _addImmediateButton = addImmediateButton;

        _addToPropBtn.Click += _addBtnClick;
        _addOnTickBtn.Click += _addBtnClick;
        _addImmediateButton.Click += _addBtnClick;
        _propertyControlGrid.MouseDown += _propertyControlGrid_MouseDown;
        
      //  _propertyControlGrid

        initGrid();
    }
Пример #18
0
	public Form1() {
		//this.AutoSize = true;
		DataGridView dgv = new DataGridView();
		//dgv.Size = new Size(500,250);
		dgv.Location = new Point(10,10);
		dgv.RowTemplate = new DataGridViewRow();
		DataGridViewColumn col = new DataGridViewColumn();
		col.CellTemplate = new DataGridViewTextBoxCell();
		dgv.Columns.Add(col.Clone() as DataGridViewColumn);
		dgv.Columns.Add(col.Clone() as DataGridViewColumn);
		dgv.Columns.Add(col.Clone() as DataGridViewColumn);
		dgv.RowCount = 4;
		dgv.EnableHeadersVisualStyles = false;
		dgv.AutoSize = true;
		this.Controls.Add(dgv);
		this.Text = "DataGridView advanced border styles demo";
	}
Пример #19
0
	public MainForm ()
	{
		// 
		// _dataGridView
		// 
		_dataGridView = new DataGridView ();
		_dataGridView.Dock = DockStyle.Fill;
		Controls.Add (_dataGridView);
		// 
		// MainForm
		// 
		ClientSize = new Size (292, 266);
		Location = new Point (200, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #80745";
		Load += new EventHandler (MainForm_Load);
	}
Пример #20
0
public void InitializeComponent()
{
grid = new DataGridView();
btn = new Button();
this.MinimumSize = new Size(400, 400);

this.btn.Click += new EventHandler(click_btn);
this.btn.Location = new Point(190, 100);
this.btn.Text = "Show Data";
this.Size = new Size(600, 600);
this.Text = "This is title";
this.grid.Size = new Size(500, 400);
this.grid.Location = new Point(50, 150);
this.grid.CellFormatting += new DataGridViewCellFormattingEventHandler(cellformatting);
this.Controls.Add(grid);
this.Controls.Add(btn);
}
Пример #21
0
    public ResultForm(object datasource)
    {
        MenuStrip ms = new MenuStrip();
          ToolStripMenuItem file = new ToolStripMenuItem("&File");
          ToolStripMenuItem exit = new ToolStripMenuItem(
                  "E&xit", null, new EventHandler(OnExit));
          DataGridView dgv = new DataGridView();

          file.DropDownItems.Add(exit);
          ms.Parent = this;
          ms.Items.Add(file);
          MainMenuStrip = ms;

          dgv.Parent = this;
          dgv.Dock = DockStyle.Fill;

          dgv.DataSource = datasource;
    }
Пример #22
0
    public static void BindGridview(DataGridView grd, string qry)
    {
        try
        {
            OpenConnection();
            _objAdp = new OleDbDataAdapter(qry, _objCon);
            _objDt = new DataTable();
            _objAdp.Fill(_objDt);
            grd.DataSource = _objDt;
            //grd.DataBind();
        }
        catch (Exception e)
        {

        }
        finally
        {
        }
    }
Пример #23
0
	public MainForm ()
	{
		// 
		// _dataGridView
		// 
		_dataGridView = new DataGridView ();
		_dataGridView.Location = new Point (0, 0);
		Controls.Add (_dataGridView);
		// 
		// _tabControl
		// 
		_tabControl = new TabControl ();
		_tabControl.Dock = DockStyle.Bottom;
		_tabControl.Height = 150;
		Controls.Add (_tabControl);
		// 
		// _bugDescriptionText1
		// 
		_bugDescriptionText1 = new TextBox ();
		_bugDescriptionText1.Dock = DockStyle.Fill;
		_bugDescriptionText1.Multiline = true;
		_bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture,
			"Expected result on start-up:{0}{0}" +
			"1. A DataGridView measuring 240 by 150 pixels is displayed.",
			Environment.NewLine);
		// 
		// _tabPage1
		// 
		_tabPage1 = new TabPage ();
		_tabPage1.Text = "#1";
		_tabPage1.Controls.Add (_bugDescriptionText1);
		_tabControl.Controls.Add (_tabPage1);
		// 
		// MainForm
		// 
		ClientSize = new Size (292, 310);
		StartPosition = FormStartPosition.CenterScreen;
		Text = "bug #80354";
		Load += new EventHandler (MainForm_Load);
	}
Пример #24
0
	public Form1() {
		//this.AutoSize = true;
		dgv = new DataGridView();
		Console.WriteLine("AdvancedCellBorderStyle: " + dgv.AdvancedCellBorderStyle.ToString());
		//dgv.Size = new Size(500,250);
		dgv.Location = new Point(10,10);
		dgv.RowTemplate = new DataGridViewRow();
		DataGridViewColumn col = new DataGridViewColumn();
		col.CellTemplate = new DataGridViewTextBoxCell();
		dgv.Columns.Add(col);
		DataGridViewColumn col2 = col.Clone() as DataGridViewColumn;
		col2.CellTemplate = col.CellTemplate;
		dgv.Columns.Add(col2);
		DataGridViewColumn col3 = col.Clone() as DataGridViewColumn;
		col3.CellTemplate = col.CellTemplate;
		dgv.Columns.Add(col3);
		dgv.RowCount = 4;
		dgv.EnableHeadersVisualStyles = false;
		dgv.AutoSize = true;
		dgv.CellPainting += OnCellPainting;
		this.Controls.Add(dgv);
		this.Text = "DataGridView advanced border styles demo";
	}
Пример #25
0
	public MainForm ()
	{
		// 
		// _dataGridView
		// 
		_dataGridView = new DataGridView ();
		_dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		_dataGridView.Dock = DockStyle.Top;
		_dataGridView.Height = 150;
		_dataGridView.RowHeadersVisible = false;
		_dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
		Controls.Add (_dataGridView);
		// 
		// _urlTextBoxColumn
		// 
		_urlTextBoxColumn = new DataGridViewTextBoxColumn ();
		_urlTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
		_urlTextBoxColumn.HeaderText = "Source url";
		_dataGridView.Columns.Add (_urlTextBoxColumn);
		// 
		// _fillButton
		// 
		_fillButton = new Button ();
		_fillButton.Location = new Point (115, 160);
		_fillButton.Text = "Fill";
		_fillButton.Click += new EventHandler (FillButton_Click);
		Controls.Add (_fillButton);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 190);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #82234";
		Load += new EventHandler (MainForm_Load);
	}
Пример #26
0
        //SEARCHING OF LOANS
        public void SearchLoan(DataGridView dgv, TextBox loan_no, TextBox name, TextBox employeeid)
        {
            if (loan_no.Text == "" && name.Text == "" && employeeid.Text == "")
            {
                Alert.show("Please put keyword to be search!", Alert.AlertType.error);
                return;
            }

            using (SqlConnection con = new SqlConnection(global.connectString()))
            {
                con.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = con;
                cmd.CommandText = "select * from vw_LoanSearch WHERE loan_no like '%" + loan_no.Text + "%'" + " and Name like '%" + name.Text + "%'" + " and EmployeeID like '%" + employeeid.Text + "%'" + " ORDER BY Loan_Date,Loan_No ASC";
                cmd.CommandType = CommandType.Text;

                adapter = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable();
                adapter.Fill(dt);

                if (dt.Rows.Count == 0)
                {
                    Alert.show("No record/s found.", Alert.AlertType.error);
                    return;
                }

                dgv.DataSource = dt;

                int colCnt = dt.Columns.Count;
                int x      = 0;


                while (x != colCnt)
                {
                    dgv.Columns[x].Visible = false;
                    x = x + 1;
                }

                dgv.Columns["Loan_No"].Visible    = true;
                dgv.Columns["Loan_No"].HeaderText = "Loan No";
                dgv.Columns["Loan_No"].FillWeight = 50;

                dgv.Columns["Loan_Type"].Visible    = true;
                dgv.Columns["Loan_Type"].HeaderText = "Type";
                dgv.Columns["Loan_Type"].FillWeight = 150;

                dgv.Columns["Loan_Date"].Visible    = true;
                dgv.Columns["Loan_Date"].HeaderText = "Date";
                dgv.Columns["Loan_Date"].FillWeight = 50;

                dgv.Columns["Name"].Visible    = true;
                dgv.Columns["Name"].HeaderText = "Name";
                dgv.Columns["Name"].FillWeight = 140;

                dgv.Columns["VoucherNo"].Visible    = true;
                dgv.Columns["VoucherNo"].HeaderText = "Voucher";
                dgv.Columns["VoucherNo"].FillWeight = 70;

                dgv.Columns["status_description"].Visible    = true;
                dgv.Columns["status_description"].HeaderText = "Status";
                dgv.Columns["status_description"].FillWeight = 70;

                dgv.Columns["Encoded_By"].Visible    = true;
                dgv.Columns["Encoded_By"].HeaderText = "Encoded By";
                dgv.Columns["Encoded_By"].FillWeight = 60;
            }
        }
Пример #27
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            int flag = 0;

            if (!(dgvInv.CurrentCell is null))
            {
                flag++;
                if (flag == 0)
                {
                    dgvInv.BeginEdit(true);
                }
            }

            if (e.RowIndex < 0)
            {
                return;
            }

            DataGridView dgv        = (DataGridView)sender;
            DataRowView  drv        = (DataRowView)dgv.Rows[e.RowIndex].DataBoundItem;
            DataRow      dr         = drv.Row;
            bool         esOriginal = dr.HasVersion(DataRowVersion.Original);
            string       dpn        = dgv.Columns[e.ColumnIndex].DataPropertyName;
            DataTable    dtTempInv  = dtInv.Clone();

            switch (dpn)
            {
            case "_idProducto":
            case "_idTalla":
            case "_idCualidad":
                int idProducto = TryInt(dr["_idProducto"]), idTalla = TryInt(dr["_idTalla"]), idCualidad = TryInt(dr["_idCualidad"]);


                if (idProducto != 0 && idTalla != 0 && idCualidad != 0)
                {
                    int idInv;
                    dtFill(dtTempInv, "SELECT " + getTableColumns(dtInv) + " FROM Inv WHERE Existencia <> 0 AND idProducto = " + gsql(idProducto) + " AND idTalla = " + gsql(idTalla) + " AND idCualidad = " + gsql(idCualidad));
                    if (!esOriginal)
                    {
                        if (dtTempInv.Rows.Count == 0)
                        {
                            ShowMsg("El producto con las especificaciones escogidas no tiene inventario.", "Sin Inventario", "error");
                            dr[dpn] = DBNull.Value;
                            return;
                        }
                        else if (dtInv.Rows.Count == 0)
                        {
                            DataRow drInvTemp = dtTempInv.Rows[0];
                            idInv = TryInt(drInvTemp["idInv"]);
                            dtInv.ImportRow(drInvTemp);
                        }
                        else
                        {
                            dtInv.Merge(dtTempInv);
                            idInv = TryInt(dtTempInv.Rows[0]["idInv"]);
                        }
                        bs.EndEdit();
                        var dsTemp1 = ds;
                        dr["idInv"] = idInv;
                    }
                }
                break;

            case "Cantidad":
            case "CostoU":
            case "Descuento":


                int     idPK        = TryInt(dr["idInv"]);
                DataRow drInv       = dtInv.Rows.Find(idPK); //no me funcionó este método.
                decimal saldoActual = TryDec(drInv["Existencia", DataRowVersion.Original]);



                decimal cantidad = TryDec(dr["Cantidad"]), CostoU = TryDec(dr["CostoU"]), Descuento = TryDec(dr["Descuento"]);
                decimal totalR = (cantidad * CostoU) - Descuento;

                decimal saldoFut = saldoActual - (cantidad - (esOriginal ? TryDec(dr["Cantidad", DataRowVersion.Original]) : 0));    //Saldo con el q quedaría.
                if (saldoFut < 0)
                {
                    MessageBox.Show("La existencia quedará con saldo negativo. Actualmente hay " + saldoActual.ToString("N0") + " Unidades.");
                    dr.RejectChanges();
                    return;
                }


                drInv["Existencia"] = saldoFut;
                dr["CostoT"]        = totalR;
                var     dtdi   = dtDoc_Inv;
                decimal x      = TryDec(dr["CostoT"]); //para DeBugg
                var     dsTemp = ds;                   //para DeBugg
                bs.EndEdit();
                decimal total = 0;

                foreach (DataRow drT in dtDoc_Inv.Rows)
                {
                    //DataRowView drT = (DataRowView)dgv.Rows[i].DataBoundItem;
                    total += TryDec(drT["CostoT"]);
                }
                lblTotal.Text = total.ToString("N0");
                break;
            }
        }
Пример #28
0
        private DataTable dataGridViewToDataTable(DataGridView dgv)
        {
            var dt = dgv.DataSource as DataTable;

            return dt;
        }
Пример #29
0
        /// <summary>
        /// 导出Excel 的方法
        /// </summary>
        private void tslExport_Excel(string fileName, DataGridView myDGV)
        {
            string         saveFileName = "";
            SaveFileDialog saveDialog   = new SaveFileDialog();

            saveDialog.DefaultExt = "xls";
            saveDialog.Filter     = "Excel文件|*.xls";
            saveDialog.FileName   = fileName;
            saveDialog.ShowDialog();
            saveFileName = saveDialog.FileName;
            if (saveFileName.IndexOf(":") < 0)
            {
                return;                                //被点了取消
            }
            Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
            if (xlApp == null)
            {
                MessageBox.Show("无法创建Excel对象,可能您的机子未安装Excel");
                return;
            }

            Microsoft.Office.Interop.Excel.Workbooks workbooks = xlApp.Workbooks;
            Microsoft.Office.Interop.Excel.Workbook  workbook  = workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
            Microsoft.Office.Interop.Excel.Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Worksheets[1];//取得sheet1


            //写入标题
            for (int i = 1; i < myDGV.ColumnCount; i++)
            {
                worksheet.Cells[1, i] = myDGV.Columns[i].HeaderText;
            }
            //写入数值
            int s = 0;

            for (int r = 0; r < myDGV.Rows.Count; r++)
            {
                if (Convert.ToBoolean(myDGV.Rows[r].Cells[0].Value))
                {
                    for (int i = 1; i < myDGV.ColumnCount; i++)
                    {
                        worksheet.Cells[s + 2, i] = myDGV.Rows[r].Cells[i].Value;
                    }
                    System.Windows.Forms.Application.DoEvents();
                    s++;
                }
            }
            worksheet.Columns.EntireColumn.AutoFit();//列宽自适应
            Microsoft.Office.Interop.Excel.Range rang = worksheet.get_Range(worksheet.Cells[2, 1], worksheet.Cells[myDGV.Rows.Count + 2, 2]);
            rang.NumberFormat = "000000000000";

            if (saveFileName != "")
            {
                try
                {
                    workbook.Saved = true;
                    workbook.SaveCopyAs(saveFileName);
                    //fileSaved = true;
                }
                catch
                {
                    //fileSaved = false;
                    MessageBox.Show("导出文件时出错,文件可能正被打开!\n");
                }
            }
            //else
            //{
            //    fileSaved = false;
            //}
            xlApp.Quit();
            GC.Collect();//强行销毁
            MessageBox.Show(fileName + ",保存成功", "提示", MessageBoxButtons.OK);
        }
        private DataGridView Standard_dgv(Point location, string Name, string headerText)
        {
            DataGridView dgv = new DataGridView();

            dgv.ScrollBars = ScrollBars.None;
            DataGridViewCellStyle dataGridViewCellStyle1  = new DataGridViewCellStyle();
            DataGridViewCellStyle dataGridViewCellStyle2  = new DataGridViewCellStyle();
            DataGridViewCellStyle dataGridViewCellStyle3  = new DataGridViewCellStyle();
            DataGridViewCellStyle dataGridViewCellStyle10 = new DataGridViewCellStyle();

            dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleCenter;

            DataGridViewTextBoxColumnEx TimeSpans = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx MON       = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx TUE       = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx WED       = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx THUR      = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx FRI       = new DataGridViewTextBoxColumnEx();

            dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle2.Font      = new Font("Times New Roman", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            TimeSpans.DefaultCellStyle       = dataGridViewCellStyle2;
            TimeSpans.Frozen      = true;
            TimeSpans.HeaderText  = headerText;
            TimeSpans.Name        = "TimeSpan";
            TimeSpans.ReadOnly    = true;
            TimeSpans.SortMode    = DataGridViewColumnSortMode.NotSortable;
            TimeSpans.ToolTipText = headerText;

            MON.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            MON.DefaultCellStyle = dataGridViewCellStyle3;
            MON.FillWeight       = 90F;
            MON.HeaderText       = "PAZARTESİ";
            MON.Name             = "PZT";
            MON.SortMode         = DataGridViewColumnSortMode.NotSortable;

            TUE.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            TUE.DefaultCellStyle = dataGridViewCellStyle3;
            TUE.FillWeight       = 90F;
            TUE.HeaderText       = "SALI";
            TUE.Name             = "SAL";
            TUE.SortMode         = DataGridViewColumnSortMode.NotSortable;

            WED.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            WED.DefaultCellStyle = dataGridViewCellStyle3;
            WED.FillWeight       = 90F;
            WED.HeaderText       = "ÇARŞAMBA";
            WED.Name             = "ÇAR";
            WED.SortMode         = DataGridViewColumnSortMode.NotSortable;

            THUR.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            THUR.DefaultCellStyle = dataGridViewCellStyle3;
            THUR.FillWeight       = 90F;
            THUR.HeaderText       = "PERŞEMBE";
            THUR.Name             = "PER";
            THUR.SortMode         = DataGridViewColumnSortMode.NotSortable;

            FRI.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            FRI.DefaultCellStyle = dataGridViewCellStyle3;
            FRI.FillWeight       = 90F;
            FRI.HeaderText       = "CUMA";
            FRI.Name             = "CUM";
            FRI.SortMode         = DataGridViewColumnSortMode.NotSortable;

            dgv.AllowUserToAddRows    = false;
            dgv.AllowUserToDeleteRows = false;
            dgv.Anchor                                = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right)));
            dgv.BorderStyle                           = BorderStyle.Fixed3D;
            dgv.CellBorderStyle                       = DataGridViewCellBorderStyle.Sunken;
            dgv.ColumnHeadersBorderStyle              = DataGridViewHeaderBorderStyle.Sunken;
            dataGridViewCellStyle1.Alignment          = DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle1.BackColor          = SystemColors.Control;
            dataGridViewCellStyle1.Font               = new Font("Times New Roman", 11F);
            dataGridViewCellStyle1.ForeColor          = SystemColors.WindowText;
            dataGridViewCellStyle1.SelectionBackColor = SystemColors.Highlight;
            dataGridViewCellStyle1.SelectionForeColor = SystemColors.HighlightText;
            dataGridViewCellStyle1.WrapMode           = DataGridViewTriState.True;
            dgv.ColumnHeadersDefaultCellStyle         = dataGridViewCellStyle1;
            dgv.ColumnHeadersHeight                   = 40;
            dgv.ColumnHeadersHeightSizeMode           = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            dgv.Columns.AddRange(new DataGridViewColumn[] {
                TimeSpans,
                MON,
                TUE,
                WED,
                THUR,
                FRI
            });
            dataGridViewCellStyle10.Alignment          = DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle10.BackColor          = SystemColors.Window;
            dataGridViewCellStyle10.Font               = new Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(178)));
            dataGridViewCellStyle10.ForeColor          = SystemColors.ControlText;
            dataGridViewCellStyle10.SelectionBackColor = SystemColors.Highlight;
            dataGridViewCellStyle10.SelectionForeColor = SystemColors.HighlightText;
            dataGridViewCellStyle10.WrapMode           = DataGridViewTriState.True;
            dgv.DefaultCellStyle        = dataGridViewCellStyle10;
            dgv.GridColor               = SystemColors.ActiveCaption;
            dgv.Location                = location;
            dgv.Name                    = Name;
            dgv.RightToLeft             = RightToLeft.No;
            dgv.RowHeadersBorderStyle   = DataGridViewHeaderBorderStyle.Sunken;
            dgv.RowHeadersVisible       = false;
            dgv.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            dgv.RowTemplate.Height      = 60;
            dgv.RowTemplate.Resizable   = DataGridViewTriState.False;
            dgv.CausesValidation        = true;
            dgv.SelectionMode           = DataGridViewSelectionMode.RowHeaderSelect;
            dgv.Size                    = new Size(748, 582);
            dgv.ReadOnly                = true;
            dgv.RightToLeft             = RightToLeft.No;
            dgv.CellContentClick       += new DataGridViewCellEventHandler(dgv_CellContentClick);
            dgv.CellMouseUp            += new DataGridViewCellMouseEventHandler(dgv_CellMouseUp);
            dgv.MultiSelect             = false;

            for (int i = 9; i < 18; i++)
            {
                dgv.Rows.Add(i.ToString() + " - " + (i + 1).ToString());
            }
            return(dgv);
        }
        private void OnCellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (clearingTables || e.ColumnIndex == PARAMS_COLUMN_LOCK)
            {
                return;
            }
            DataGridView table = (DataGridView)sender;
            MaidInfo     maid  = SelectedMaid;

            if (SelectedMaid == null)
            {
                return;
            }

            MaidChangeType?type = null;

            if (table == dataGridView_params)
            {
                type = maidParamsTableDic[e.RowIndex];
            }
            else if (table == dataGridView_ero_zones)
            {
                type = maidEroTableDic[e.RowIndex];
            }
            else if (table == dataGridView_maid_params_bonus)
            {
                type = maidBonusStatsTableDic[e.RowIndex];
            }
            else if (table == dataGridView_statistics)
            {
                type = maidStatsTableDic[e.RowIndex];
            }
            if (type == null)
            {
                return;
            }

            if (valueUpdate[type.Value])
            {
                valueUpdate[type.Value] = false;
                return;
            }

            object val = table[e.ColumnIndex, e.RowIndex].Value;

            if (!(val is int) && !(val is long))
            {
                maid.UpdateField(type.Value);
                return;
            }

            if (maid.IsHardLocked(type.Value))
            {
                Debugger.WriteLine(
                    LogLevel.Info,
                    $"Value {EnumHelper.GetName(type.Value)} is locked! Unlocking temporarily...");
                maid.UnlockTemp(type.Value);
            }

            maid.SetValue(type.Value, val);
        }
Пример #32
0
        public static void sendReport(DataGridView dgvDoublons, DataGridView dgvError)
        {
            MailMessage mail = new MailMessage(Analyser.Config.mailFrom, Analyser.Config.ReportMail)
            {
                Subject = "Rapport d'analyse",
                Body    = "Rapport d'analyse :\n" + Analyser.Stats.ToString()
            };

            SmtpClient client = new SmtpClient()
            {
                Port                  = 25,
                DeliveryMethod        = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Host                  = Analyser.Config.ServerSMTP
            };

            //MemoryStream msDupFile=null;

            bool sendNeeded = false;

            System.Net.Mime.ContentType pdfContentType = new System.Net.Mime.ContentType(System.Net.Mime.MediaTypeNames.Application.Pdf);

            //report duplicate files
            if (Analyser.Config.AttDup)
            {
                MemoryStream msDupFile = PDFExport.PDFFromGridView(dgvDoublons, true);

                SimpleLog.Log("Preparing duplicate file report", SimpleLog.Severity.Exception);
                Attachment rap = new Attachment(msDupFile, pdfContentType);
                rap.ContentDisposition.FileName = "DupFile.pdf";
                mail.Attachments.Add(rap);
                SimpleLog.Log("file" + msDupFile.Length, SimpleLog.Severity.Exception);
                sendNeeded = sendIfNeeded(ref mail, client);

                msDupFile.Close();
            }
            // report stats
            if (Analyser.Config.Bdd & Analyser.Config.AttStats)
            {
                SimpleLog.Log("Preparing stats.pdf file", SimpleLog.Severity.Exception);
                var        tempPath = Charts.ChartTools.draw(false);
                Attachment stat     = new Attachment(tempPath, pdfContentType);
                stat.ContentDisposition.FileName = "stat.pdf";
                mail.Attachments.Add(stat);
                sendNeeded = sendIfNeeded(ref mail, client);
            }

            // report error
            if (Analyser.Config.AttError && dgvError.RowCount > 0)
            {
                var msError = PDFExport.PDFFromGridView(dgvError, false);

                SimpleLog.Log("Preparing error.pdf report", SimpleLog.Severity.Info2);
                Attachment rap = new Attachment(msError, pdfContentType);
                rap.ContentDisposition.FileName = "Error.pdf";
                mail.Attachments.Add(rap);
                SimpleLog.Log("file length " + msError.Length, SimpleLog.Severity.Exception);
                sendNeeded = sendIfNeeded(ref mail, client);

                msError.Close();
            }


            if (sendNeeded)
            {
                try { client.Send(mail); }
                catch (Exception e) { SimpleLog.Log("Error sending email : " + e.Message, SimpleLog.Severity.Error); }
            }


            SimpleLog.Log("Report sended", SimpleLog.Severity.Info2);
        }
Пример #33
0
        /// <summary>
        /// 导出到Excel
        /// </summary>
        /// <param name="dgvData"></param>
        /// <returns></returns>
        public static bool ToExcel(DataGridView dgvData)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "Execl files (*.xls)|*.xls";
            saveFileDialog.FilterIndex      = 0;
            saveFileDialog.RestoreDirectory = true;
            saveFileDialog.CreatePrompt     = true;
            saveFileDialog.Title            = "Export Excel File To";
            DialogResult dr = saveFileDialog.ShowDialog();

            if (dr != DialogResult.OK)
            {
                return(false);
            }

            Stream myStream;

            myStream = saveFileDialog.OpenFile();
            //StreamWriter sw = new StreamWriter(myStream, System.Text.Encoding.GetEncoding("gb2312"));
            StreamWriter sw  = new StreamWriter(myStream, System.Text.Encoding.GetEncoding(-0));
            string       str = "";

            try
            {
                //写标题
                for (int i = 0; i < dgvData.ColumnCount; i++)
                {
                    if (i > 0)
                    {
                        str += "\t";
                    }
                    str += dgvData.Columns[i].HeaderText;
                }
                sw.WriteLine(str);
                //写内容
                for (int j = 0; j < dgvData.Rows.Count; j++)
                {
                    string tempStr = "";
                    for (int k = 0; k < dgvData.Columns.Count; k++)
                    {
                        if (k > 0)
                        {
                            tempStr += "\t";
                        }
                        string cellValue = "";
                        try
                        {
                            cellValue = dgvData.Rows[j].Cells[k].Value.ToString();
                            cellValue = cellValue.Replace(" ", "");
                            cellValue = cellValue.Replace("\r", "");
                            cellValue = cellValue.Replace("\n", "");
                            cellValue = cellValue.Replace("\r\n", "");
                        }
                        catch { }
                        tempStr += cellValue;
                        // tempStr += dgvData.Rows[j].Cells[k].Value.ToString();
                    }

                    sw.WriteLine(tempStr);
                }
                sw.Close();
                myStream.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
            finally
            {
                sw.Close();
                myStream.Close();
            }

            return(true);
        }
Пример #34
0
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
     System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
     System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
     this.LblInvoice       = new System.Windows.Forms.Label();
     this.ShapeContainer1  = new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
     this.RectangleShape1  = new Microsoft.VisualBasic.PowerPacks.RectangleShape();
     this.Panel1           = new System.Windows.Forms.Panel();
     this.ChkTaxInclusive  = new System.Windows.Forms.CheckBox();
     this.BsServiceInvoice = new System.Windows.Forms.BindingSource(this.components);
     this.TextTotalAmount  = new System.Windows.Forms.TextBox();
     this.LabelTotal       = new System.Windows.Forms.Label();
     this.TextTax          = new System.Windows.Forms.TextBox();
     this.LabelTax         = new System.Windows.Forms.Label();
     this.TextSubtotal     = new System.Windows.Forms.TextBox();
     this.LabelSubtotal    = new System.Windows.Forms.Label();
     this.GrdServiceLines  = new System.Windows.Forms.DataGridView();
     this.RowId            = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.ColDescription   = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.ColAccount       = new System.Windows.Forms.DataGridViewComboBoxColumn();
     this.ColAmount        = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.ColJob           = new System.Windows.Forms.DataGridViewComboBoxColumn();
     this.ColTax           = new System.Windows.Forms.DataGridViewComboBoxColumn();
     this.RowVersion       = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.DtDate           = new System.Windows.Forms.DateTimePicker();
     this.Label1           = new System.Windows.Forms.Label();
     this.TxtInvoiceNo     = new System.Windows.Forms.TextBox();
     this.V                          = new System.Windows.Forms.Label();
     this.LblAddress                 = new System.Windows.Forms.Label();
     this.TxtAddress                 = new System.Windows.Forms.TextBox();
     this.CmboCustomer               = new System.Windows.Forms.ComboBox();
     this.LblCustomer                = new System.Windows.Forms.Label();
     this.ShapeContainer2            = new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
     this.RectangleShape2            = new Microsoft.VisualBasic.PowerPacks.RectangleShape();
     this.BtnRecord                  = new System.Windows.Forms.Button();
     this.DataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.DataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.DataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.DataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
     this.Panel1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.BsServiceInvoice)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.GrdServiceLines)).BeginInit();
     this.SuspendLayout();
     //
     // LblInvoice
     //
     this.LblInvoice.AutoSize  = true;
     this.LblInvoice.BackColor = System.Drawing.Color.Transparent;
     this.LblInvoice.Font      = new System.Drawing.Font("Calibri", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.LblInvoice.Location  = new System.Drawing.Point(15, 3);
     this.LblInvoice.Name      = "LblInvoice";
     this.LblInvoice.Size      = new System.Drawing.Size(153, 18);
     this.LblInvoice.TabIndex  = 4;
     this.LblInvoice.Text      = "Invoice - Service Layout";
     //
     // ShapeContainer1
     //
     this.ShapeContainer1.Location = new System.Drawing.Point(0, 0);
     this.ShapeContainer1.Margin   = new System.Windows.Forms.Padding(0);
     this.ShapeContainer1.Name     = "ShapeContainer1";
     this.ShapeContainer1.Shapes.AddRange(new Microsoft.VisualBasic.PowerPacks.Shape[] {
         this.RectangleShape1
     });
     this.ShapeContainer1.Size     = new System.Drawing.Size(784, 562);
     this.ShapeContainer1.TabIndex = 5;
     this.ShapeContainer1.TabStop  = false;
     //
     // RectangleShape1
     //
     this.RectangleShape1.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.RectangleShape1.BackColor = System.Drawing.Color.White;
     this.RectangleShape1.BackStyle = Microsoft.VisualBasic.PowerPacks.BackStyle.Opaque;
     this.RectangleShape1.Location  = new System.Drawing.Point(10, 25);
     this.RectangleShape1.Name      = "RectangleShape1";
     this.RectangleShape1.Size      = new System.Drawing.Size(760, 490);
     //
     // Panel1
     //
     this.Panel1.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.Panel1.BackColor = System.Drawing.Color.PowderBlue;
     this.Panel1.Controls.Add(this.ChkTaxInclusive);
     this.Panel1.Controls.Add(this.TextTotalAmount);
     this.Panel1.Controls.Add(this.LabelTotal);
     this.Panel1.Controls.Add(this.TextTax);
     this.Panel1.Controls.Add(this.LabelTax);
     this.Panel1.Controls.Add(this.TextSubtotal);
     this.Panel1.Controls.Add(this.LabelSubtotal);
     this.Panel1.Controls.Add(this.GrdServiceLines);
     this.Panel1.Controls.Add(this.DtDate);
     this.Panel1.Controls.Add(this.Label1);
     this.Panel1.Controls.Add(this.TxtInvoiceNo);
     this.Panel1.Controls.Add(this.V);
     this.Panel1.Controls.Add(this.LblAddress);
     this.Panel1.Controls.Add(this.TxtAddress);
     this.Panel1.Controls.Add(this.CmboCustomer);
     this.Panel1.Controls.Add(this.LblCustomer);
     this.Panel1.Controls.Add(this.ShapeContainer2);
     this.Panel1.Location = new System.Drawing.Point(14, 30);
     this.Panel1.Name     = "Panel1";
     this.Panel1.Size     = new System.Drawing.Size(752, 480);
     this.Panel1.TabIndex = 6;
     //
     // ChkTaxInclusive
     //
     this.ChkTaxInclusive.AutoSize   = true;
     this.ChkTaxInclusive.Checked    = true;
     this.ChkTaxInclusive.CheckState = System.Windows.Forms.CheckState.Checked;
     this.ChkTaxInclusive.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.BsServiceInvoice, "IsTaxInclusive", true));
     this.ChkTaxInclusive.Location = new System.Drawing.Point(550, 9);
     this.ChkTaxInclusive.Name     = "ChkTaxInclusive";
     this.ChkTaxInclusive.Size     = new System.Drawing.Size(89, 17);
     this.ChkTaxInclusive.TabIndex = 16;
     this.ChkTaxInclusive.Text     = "Tax Inclusive";
     this.ChkTaxInclusive.UseVisualStyleBackColor = true;
     //
     // BsServiceInvoice
     //
     this.BsServiceInvoice.DataSource = typeof(MYOB.AccountRight.SDK.Contracts.Version2.Sale.ServiceInvoice);
     //
     // TextTotalAmount
     //
     this.TextTotalAmount.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.BsServiceInvoice, "TotalAmount", true));
     this.TextTotalAmount.Enabled  = false;
     this.TextTotalAmount.Location = new System.Drawing.Point(550, 432);
     this.TextTotalAmount.Name     = "TextTotalAmount";
     this.TextTotalAmount.Size     = new System.Drawing.Size(130, 20);
     this.TextTotalAmount.TabIndex = 15;
     //
     // LabelTotal
     //
     this.LabelTotal.AutoSize  = true;
     this.LabelTotal.BackColor = System.Drawing.Color.Transparent;
     this.LabelTotal.Location  = new System.Drawing.Point(471, 435);
     this.LabelTotal.Name      = "LabelTotal";
     this.LabelTotal.Size      = new System.Drawing.Size(73, 13);
     this.LabelTotal.TabIndex  = 14;
     this.LabelTotal.Text      = "Total Amount:";
     this.LabelTotal.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // TextTax
     //
     this.TextTax.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.BsServiceInvoice, "TotalTax", true));
     this.TextTax.Enabled  = false;
     this.TextTax.Location = new System.Drawing.Point(550, 406);
     this.TextTax.Name     = "TextTax";
     this.TextTax.Size     = new System.Drawing.Size(130, 20);
     this.TextTax.TabIndex = 13;
     //
     // LabelTax
     //
     this.LabelTax.AutoSize  = true;
     this.LabelTax.BackColor = System.Drawing.Color.Transparent;
     this.LabelTax.Location  = new System.Drawing.Point(516, 409);
     this.LabelTax.Name      = "LabelTax";
     this.LabelTax.Size      = new System.Drawing.Size(28, 13);
     this.LabelTax.TabIndex  = 12;
     this.LabelTax.Text      = "Tax:";
     this.LabelTax.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // TextSubtotal
     //
     this.TextSubtotal.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.BsServiceInvoice, "Subtotal", true));
     this.TextSubtotal.Enabled  = false;
     this.TextSubtotal.Location = new System.Drawing.Point(550, 380);
     this.TextSubtotal.Name     = "TextSubtotal";
     this.TextSubtotal.Size     = new System.Drawing.Size(130, 20);
     this.TextSubtotal.TabIndex = 11;
     //
     // LabelSubtotal
     //
     this.LabelSubtotal.AutoSize  = true;
     this.LabelSubtotal.BackColor = System.Drawing.Color.Transparent;
     this.LabelSubtotal.Location  = new System.Drawing.Point(495, 383);
     this.LabelSubtotal.Name      = "LabelSubtotal";
     this.LabelSubtotal.Size      = new System.Drawing.Size(49, 13);
     this.LabelSubtotal.TabIndex  = 10;
     this.LabelSubtotal.Text      = "Subtotal:";
     this.LabelSubtotal.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // GrdServiceLines
     //
     this.GrdServiceLines.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.GrdServiceLines.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     this.GrdServiceLines.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
         this.RowId,
         this.ColDescription,
         this.ColAccount,
         this.ColAmount,
         this.ColJob,
         this.ColTax,
         this.RowVersion
     });
     this.GrdServiceLines.Location   = new System.Drawing.Point(19, 149);
     this.GrdServiceLines.Name       = "GrdServiceLines";
     this.GrdServiceLines.Size       = new System.Drawing.Size(713, 208);
     this.GrdServiceLines.TabIndex   = 9;
     this.GrdServiceLines.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.GrdServiceLinesDataError);
     //
     // RowId
     //
     this.RowId.DataPropertyName = "RowId";
     this.RowId.HeaderText       = "RowId";
     this.RowId.Name             = "RowId";
     this.RowId.Visible          = false;
     //
     // ColDescription
     //
     this.ColDescription.DataPropertyName = "Description";
     this.ColDescription.FillWeight       = 200F;
     this.ColDescription.HeaderText       = "Description";
     this.ColDescription.Name             = "ColDescription";
     this.ColDescription.Width            = 200;
     //
     // ColAccount
     //
     this.ColAccount.DataPropertyName = "AccountUID";
     this.ColAccount.HeaderText       = "Account";
     this.ColAccount.Name             = "ColAccount";
     this.ColAccount.Resizable        = System.Windows.Forms.DataGridViewTriState.True;
     this.ColAccount.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
     this.ColAccount.Width            = 150;
     //
     // ColAmount
     //
     this.ColAmount.DataPropertyName  = "Total";
     dataGridViewCellStyle7.Format    = "C2";
     dataGridViewCellStyle7.NullValue = "0.00";
     this.ColAmount.DefaultCellStyle  = dataGridViewCellStyle7;
     this.ColAmount.HeaderText        = "Amount";
     this.ColAmount.Name = "ColAmount";
     //
     // ColJob
     //
     this.ColJob.DataPropertyName = "JobUID";
     this.ColJob.HeaderText       = "Job";
     this.ColJob.Name             = "ColJob";
     this.ColJob.Resizable        = System.Windows.Forms.DataGridViewTriState.True;
     this.ColJob.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
     //
     // ColTax
     //
     this.ColTax.DataPropertyName = "TaxUID";
     this.ColTax.HeaderText       = "Tax";
     this.ColTax.Name             = "ColTax";
     this.ColTax.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
     //
     // RowVersion
     //
     this.RowVersion.DataPropertyName = "RowVersion";
     this.RowVersion.HeaderText       = "RowVersion";
     this.RowVersion.Name             = "RowVersion";
     this.RowVersion.Visible          = false;
     //
     // DtDate
     //
     this.DtDate.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.BsServiceInvoice, "Date", true));
     this.DtDate.Format   = System.Windows.Forms.DateTimePickerFormat.Short;
     this.DtDate.Location = new System.Drawing.Point(550, 84);
     this.DtDate.Name     = "DtDate";
     this.DtDate.Size     = new System.Drawing.Size(130, 20);
     this.DtDate.TabIndex = 8;
     this.DtDate.Value    = new System.DateTime(2013, 8, 9, 23, 56, 56, 0);
     //
     // Label1
     //
     this.Label1.AutoSize  = true;
     this.Label1.BackColor = System.Drawing.Color.White;
     this.Label1.Location  = new System.Drawing.Point(511, 84);
     this.Label1.Name      = "Label1";
     this.Label1.Size      = new System.Drawing.Size(33, 13);
     this.Label1.TabIndex  = 7;
     this.Label1.Text      = "Date:";
     this.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // TxtInvoiceNo
     //
     this.TxtInvoiceNo.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.BsServiceInvoice, "Number", true));
     this.TxtInvoiceNo.Location = new System.Drawing.Point(550, 54);
     this.TxtInvoiceNo.Name     = "TxtInvoiceNo";
     this.TxtInvoiceNo.Size     = new System.Drawing.Size(130, 20);
     this.TxtInvoiceNo.TabIndex = 6;
     //
     // V
     //
     this.V.AutoSize  = true;
     this.V.BackColor = System.Drawing.Color.White;
     this.V.Location  = new System.Drawing.Point(482, 57);
     this.V.Name      = "V";
     this.V.Size      = new System.Drawing.Size(62, 13);
     this.V.TabIndex  = 5;
     this.V.Text      = "Invoice No:";
     this.V.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // LblAddress
     //
     this.LblAddress.AutoSize  = true;
     this.LblAddress.BackColor = System.Drawing.Color.White;
     this.LblAddress.Location  = new System.Drawing.Point(133, 57);
     this.LblAddress.Name      = "LblAddress";
     this.LblAddress.Size      = new System.Drawing.Size(45, 13);
     this.LblAddress.TabIndex  = 4;
     this.LblAddress.Text      = "Address";
     //
     // TxtAddress
     //
     this.TxtAddress.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.BsServiceInvoice, "ShipToAddress", true));
     this.TxtAddress.Location   = new System.Drawing.Point(188, 54);
     this.TxtAddress.Multiline  = true;
     this.TxtAddress.Name       = "TxtAddress";
     this.TxtAddress.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
     this.TxtAddress.Size       = new System.Drawing.Size(249, 89);
     this.TxtAddress.TabIndex   = 3;
     //
     // CmboCustomer
     //
     this.CmboCustomer.DisplayMember     = "UID";
     this.CmboCustomer.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.CmboCustomer.FormattingEnabled = true;
     this.CmboCustomer.Location          = new System.Drawing.Point(184, 6);
     this.CmboCustomer.Name                  = "CmboCustomer";
     this.CmboCustomer.Size                  = new System.Drawing.Size(254, 21);
     this.CmboCustomer.TabIndex              = 1;
     this.CmboCustomer.ValueMember           = "UID";
     this.CmboCustomer.SelectedIndexChanged += new System.EventHandler(this.CmboCustomerSelectedIndexChanged);
     this.CmboCustomer.Format               += new System.Windows.Forms.ListControlConvertEventHandler(this.CmboCustomerFormat);
     //
     // LblCustomer
     //
     this.LblCustomer.AutoSize = true;
     this.LblCustomer.Location = new System.Drawing.Point(127, 9);
     this.LblCustomer.Name     = "LblCustomer";
     this.LblCustomer.Size     = new System.Drawing.Size(51, 13);
     this.LblCustomer.TabIndex = 0;
     this.LblCustomer.Text     = "Customer";
     //
     // ShapeContainer2
     //
     this.ShapeContainer2.Location = new System.Drawing.Point(0, 0);
     this.ShapeContainer2.Margin   = new System.Windows.Forms.Padding(0);
     this.ShapeContainer2.Name     = "ShapeContainer2";
     this.ShapeContainer2.Shapes.AddRange(new Microsoft.VisualBasic.PowerPacks.Shape[] {
         this.RectangleShape2
     });
     this.ShapeContainer2.Size     = new System.Drawing.Size(752, 480);
     this.ShapeContainer2.TabIndex = 2;
     this.ShapeContainer2.TabStop  = false;
     //
     // RectangleShape2
     //
     this.RectangleShape2.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.RectangleShape2.BackColor = System.Drawing.Color.White;
     this.RectangleShape2.FillColor = System.Drawing.Color.White;
     this.RectangleShape2.FillStyle = Microsoft.VisualBasic.PowerPacks.FillStyle.Solid;
     this.RectangleShape2.Location  = new System.Drawing.Point(8, 40);
     this.RectangleShape2.Name      = "RectangleShape2";
     this.RectangleShape2.Size      = new System.Drawing.Size(735, 326);
     //
     // BtnRecord
     //
     this.BtnRecord.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.BtnRecord.Location = new System.Drawing.Point(616, 527);
     this.BtnRecord.Name     = "BtnRecord";
     this.BtnRecord.Size     = new System.Drawing.Size(75, 23);
     this.BtnRecord.TabIndex = 7;
     this.BtnRecord.Text     = "Record";
     this.BtnRecord.UseVisualStyleBackColor = true;
     this.BtnRecord.Click += new System.EventHandler(this.BtnRecordClick);
     //
     // DataGridViewTextBoxColumn1
     //
     this.DataGridViewTextBoxColumn1.DataPropertyName = "Description";
     this.DataGridViewTextBoxColumn1.FillWeight       = 200F;
     this.DataGridViewTextBoxColumn1.HeaderText       = "Description";
     this.DataGridViewTextBoxColumn1.Name             = "DataGridViewTextBoxColumn1";
     this.DataGridViewTextBoxColumn1.Width            = 200;
     //
     // DataGridViewTextBoxColumn2
     //
     this.DataGridViewTextBoxColumn2.DataPropertyName = "Total";
     dataGridViewCellStyle8.Format    = "C2";
     dataGridViewCellStyle8.NullValue = "0.00";
     this.DataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle8;
     this.DataGridViewTextBoxColumn2.FillWeight       = 200F;
     this.DataGridViewTextBoxColumn2.HeaderText       = "Amount";
     this.DataGridViewTextBoxColumn2.Name             = "DataGridViewTextBoxColumn2";
     this.DataGridViewTextBoxColumn2.Width            = 200;
     //
     // DataGridViewTextBoxColumn3
     //
     this.DataGridViewTextBoxColumn3.DataPropertyName = "RowVersion";
     dataGridViewCellStyle9.Format    = "C2";
     dataGridViewCellStyle9.NullValue = "0.00";
     this.DataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle9;
     this.DataGridViewTextBoxColumn3.HeaderText       = "RowVersion";
     this.DataGridViewTextBoxColumn3.Name             = "DataGridViewTextBoxColumn3";
     this.DataGridViewTextBoxColumn3.Visible          = false;
     //
     // DataGridViewTextBoxColumn4
     //
     this.DataGridViewTextBoxColumn4.DataPropertyName = "RowVersion";
     this.DataGridViewTextBoxColumn4.HeaderText       = "RowVersion";
     this.DataGridViewTextBoxColumn4.Name             = "DataGridViewTextBoxColumn4";
     //
     // InvoiceForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.ClientSize          = new System.Drawing.Size(784, 562);
     this.Controls.Add(this.BtnRecord);
     this.Controls.Add(this.Panel1);
     this.Controls.Add(this.LblInvoice);
     this.Controls.Add(this.ShapeContainer1);
     this.Name  = "InvoiceForm";
     this.Load += new System.EventHandler(this.InvoiceFormLoad);
     this.Controls.SetChildIndex(this.ShapeContainer1, 0);
     this.Controls.SetChildIndex(this.LblInvoice, 0);
     this.Controls.SetChildIndex(this.Panel1, 0);
     this.Controls.SetChildIndex(this.BtnRecord, 0);
     this.Panel1.ResumeLayout(false);
     this.Panel1.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.BsServiceInvoice)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.GrdServiceLines)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
        private void dgvDiem_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView d = sender as DataGridView;
            string       a = "";

            if (d.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
            {
                a = d.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Trim();
                int s = 0;
                if (int.TryParse(a, out s))
                {
                    if (int.Parse(a) < 0 || int.Parse(a) > 10)
                    {
                        MessageBox.Show("Điểm nhập vào không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        d.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = temp;
                        return;
                    }
                }
            }
            if (d.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
            {
                a = d.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Trim();
            }
            double x = 0;

            if (double.TryParse(a, out x) || a == "")
            {
                string idSinhVien = "";
                string tk1        = "";
                string tk2        = "";
                string tk3        = "";
                string gk         = "";
                string ck         = "";
                string tongKet    = "";
                string xepLoai    = "";
                if (d.Rows[e.RowIndex].Cells[0].Value != null)
                {
                    idSinhVien = d.Rows[e.RowIndex].Cells[0].Value.ToString().Trim();
                }
                if (d.Rows[e.RowIndex].Cells[4].Value != null)
                {
                    tk1 = d.Rows[e.RowIndex].Cells[4].Value.ToString().Trim();
                }
                if (d.Rows[e.RowIndex].Cells[5].Value != null)
                {
                    tk2 = d.Rows[e.RowIndex].Cells[5].Value.ToString().Trim();
                }
                if (d.Rows[e.RowIndex].Cells[6].Value != null)
                {
                    tk3 = d.Rows[e.RowIndex].Cells[6].Value.ToString().Trim();
                }
                if (d.Rows[e.RowIndex].Cells[7].Value != null)
                {
                    gk = d.Rows[e.RowIndex].Cells[7].Value.ToString().Trim();
                }
                if (d.Rows[e.RowIndex].Cells[8].Value != null)
                {
                    ck = d.Rows[e.RowIndex].Cells[8].Value.ToString().Trim();
                }
                if (d.Rows[e.RowIndex].Cells[9].Value != null)
                {
                    tongKet = d.Rows[e.RowIndex].Cells[9].Value.ToString().Trim();
                }
                if (d.Rows[e.RowIndex].Cells[10].Value != null)
                {
                    xepLoai = d.Rows[e.RowIndex].Cells[10].Value.ToString().Trim();
                }

                DiemLopHocPhanViewModels diemEdit = new DiemLopHocPhanViewModels
                {
                    ID_SinhVien = idSinhVien,
                    TK1         = tk1,
                    TK2         = tk2,
                    TK3         = tk3,
                    GK          = gk,
                    CK          = ck,
                    TongKet     = tongKet,
                    XepLoai     = xepLoai,
                };

                if (diemEdit.TK1 != "" && diemEdit.TK2 != "" && diemEdit.TK3 != "" && diemEdit.GK != "" && diemEdit.CK != "")
                {
                    diemEdit.TongKet = (((float.Parse(diemEdit.TK1.Trim()) + float.Parse(diemEdit.TK2.Trim()) + float.Parse(diemEdit.TK3.Trim())) / 3 * 2 + float.Parse(diemEdit.GK.Trim()) * 3 + float.Parse(diemEdit.CK.Trim()) * 5) * 0.1).ToString();
                    if (float.Parse(diemEdit.TongKet.Trim()) <= 3)
                    {
                        diemEdit.XepLoai = "E";
                    }
                    else if (float.Parse(diemEdit.TongKet.Trim()) < 5)
                    {
                        diemEdit.XepLoai = "D";
                    }
                    else if (float.Parse(diemEdit.TongKet.Trim()) < 6.5)
                    {
                        diemEdit.XepLoai = "C";
                    }
                    else if (float.Parse(diemEdit.TongKet.Trim()) < 8)
                    {
                        diemEdit.XepLoai = "B";
                    }
                    else if (float.Parse(diemEdit.TongKet.Trim()) <= 10)
                    {
                        diemEdit.XepLoai = "A";
                    }
                    else
                    {
                        diemEdit.XepLoai = "";
                    }
                }
                else
                {
                    diemEdit.XepLoai = "";
                    diemEdit.TongKet = "";
                }

                d.Rows[e.RowIndex].Cells[9].Value  = diemEdit.TongKet;
                d.Rows[e.RowIndex].Cells[10].Value = diemEdit.XepLoai;

                btnLuu.Visible = true;
                btnHuy.Visible = true;
                int flag = 0;
                foreach (DiemLopHocPhanViewModels t in lstEdit)
                {
                    flag = 0;
                    if (t.ID_SinhVien == diemEdit.ID_SinhVien)
                    {
                        t.TK1     = diemEdit.TK1;
                        t.TK2     = diemEdit.TK2;
                        t.TK3     = diemEdit.TK3;
                        t.GK      = diemEdit.GK;
                        t.CK      = diemEdit.CK;
                        t.TongKet = diemEdit.TongKet;
                        t.XepLoai = diemEdit.XepLoai;
                        flag      = 1;
                        break;
                    }
                }
                if (flag == 0)
                {
                    lstEdit.Add(diemEdit);
                }
            }
            else
            {
                MessageBox.Show("Điểm nhập vào không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                d.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = temp;
            }
        }
 public frmForecastManualOverride(DataGridViewSelectedCellCollection selectedCellCollection, DataGridView dgvForecast, Customer customer)
 {
     InitializeComponent();
     _selectedCellCollection = selectedCellCollection;
     _dgvForecast            = dgvForecast;
     _customer = customer;
 }
Пример #37
0
    /// <summary>
    /// exports data to xls file 
    /// (http://www.codeproject.com/Tips/545456/Exporting-DataGridview-To-Excel)
    /// </summary>
    /// <param name="dGV">datagridview</param>
    /// <param name="filename">filename</param>
    public static void ToCsV(DataGridView dGV, string filename)
    {
        string stOutput = "";
            // Export titles:
            string sHeaders = "";

            for (int j = 0; j < dGV.Columns.Count; j++)
                sHeaders = sHeaders.ToString() + Convert.ToString(dGV.Columns[j].HeaderText) + "\t";
            stOutput += sHeaders + "\r\n";
            // Export data.
            for (int i = 0; i < dGV.RowCount - 1; i++)
            {
                string stLine = "";
                for (int j = 0; j < dGV.Rows[i].Cells.Count; j++)
                    stLine = stLine.ToString() + Convert.ToString(dGV.Rows[i].Cells[j].Value) + "\t";
                stOutput += stLine + "\r\n";
            }
            Encoding utf16 = Encoding.GetEncoding(1254);
            byte[] output = utf16.GetBytes(stOutput);
            FileStream fs = new FileStream(filename, FileMode.Create);
            BinaryWriter bw = new BinaryWriter(fs);
            bw.Write(output, 0, output.Length); //write the encoded file
            bw.Flush();
            bw.Close();
            fs.Close();
    }
Пример #38
0
        public void ExportWithFormatting(DataGridView dataGridView1)
        {
            var saveFileDialog1 = new SaveFileDialog
            {
                Filter   = "xls files (*.xlsx)|*.xlsx|All files (*.*)|*.*|csv files (*.csv)|*.csv",
                Title    = "To Excel",
                FileName = this.Text + " (" + DateTime.Now.ToString("yyyy-MM-dd") + ")"
            };

            if (saveFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            if (saveFileDialog1.FilterIndex == 3)
            {
                int      columnCount = dgTransactions.ColumnCount;
                string   columnNames = "";
                string[] output      = new string[dgTransactions.RowCount + 1];
                for (int i = 0; i < columnCount; i++)
                {
                    columnNames += dgTransactions.Columns[i].Name.ToString() + ",";
                }
                output[0] += columnNames;
                for (int i = 1; (i - 1) < dgTransactions.RowCount; i++)
                {
                    for (int j = 0; j < columnCount; j++)
                    {
                        output[i] += dgTransactions.Rows[i - 1].Cells[j].Value.ToString() + ",";
                    }
                }
                System.IO.File.WriteAllLines(saveFileDialog1.FileName, output, System.Text.Encoding.UTF8);
            }
            else
            {
                string       fileName  = saveFileDialog1.FileName;
                XLWorkbook   workbook  = new XLWorkbook();
                IXLWorksheet worksheet = workbook.Worksheets.Add(this.Text);
                for (int i = 0; i < dataGridView1.Columns.Count; i++)
                {
                    worksheet.Cell(1, i + 1).Value = dataGridView1.Columns[i].HeaderText;
                }
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    for (int j = 0; j < dataGridView1.Columns.Count; j++)
                    {
                        worksheet.Cell(i + 2, j + 1).Value = dataGridView1.Rows[i].Cells[j].Value.ToString();
                        if (worksheet.Cell(i + 2, j + 1).Value.ToString().Length > 0)
                        {
                            XLAlignmentHorizontalValues align;
                            switch (dataGridView1.Rows[i].Cells[j].Style.Alignment)
                            {
                            case DataGridViewContentAlignment.BottomRight:
                                align = XLAlignmentHorizontalValues.Right;
                                break;

                            case DataGridViewContentAlignment.MiddleRight:
                                align = XLAlignmentHorizontalValues.Right;
                                break;

                            case DataGridViewContentAlignment.TopRight:
                                align = XLAlignmentHorizontalValues.Right;
                                break;

                            case DataGridViewContentAlignment.BottomCenter:
                                align = XLAlignmentHorizontalValues.Center;
                                break;

                            case DataGridViewContentAlignment.MiddleCenter:
                                align = XLAlignmentHorizontalValues.Center;
                                break;

                            case DataGridViewContentAlignment.TopCenter:
                                align = XLAlignmentHorizontalValues.Center;
                                break;

                            default:
                                align = XLAlignmentHorizontalValues.Left;
                                break;
                            }
                            worksheet.Cell(i + 2, j + 1).Style.Alignment.Horizontal = align;
                            XLColor xlColor = XLColor.FromColor(dataGridView1.Rows[i].Cells[j].Style.SelectionBackColor);
                            worksheet.Cell(i + 2, j + 1).AddConditionalFormat().WhenLessThan(1).Fill.SetBackgroundColor(xlColor);
                            worksheet.Cell(i + 2, j + 1).Style.Font.FontName = dataGridView1.Font.Name;
                            worksheet.Cell(i + 2, j + 1).Style.Font.FontSize = dataGridView1.Font.Size;
                        }
                    }
                }
                worksheet.Columns().AdjustToContents();
                workbook.SaveAs(fileName);
            }
            MessageBox.Show("Export Successful!");
        }
Пример #39
0
 public ResultTable()
 {
     this._grid = new DataGridView();
     ObjectCount++;
     this._name = ObjectName + ObjectCount.ToString();
 }
Пример #40
0
        private void PassFilter(DataGridView datagridview, string strFilter)
        {
            int  i          = 0;
            int  j          = 0;
            int  jk         = 0;
            int  kj         = 0;
            int  wr         = 0;
            bool containStr = false;
            // Row indexes we'll remove later on.
            List <int> deleteIndexList = new List <int>();

            string strNewFilter = "";

            switch (cboCriteria.Text)
            {
            case "=":
                strNewFilter = strFilter;
                break;

            case "Containing":
                strNewFilter = "*" + strFilter + "*";
                break;

            case "Start With":
                strNewFilter = strFilter + "*";
                break;

            case "End With":
                strNewFilter = "*" + strFilter;
                break;
            }
            while (i < datagridview.Rows.Count)
            {
                j          = 0;
                containStr = false;

                if (chkIgnore.Checked == true)
                {
                    jk = datagridview.Rows[i].Cells.Count - 1;
                    kj = 0;
                }
                else
                {
                    kj = Convert.ToInt16(SelColumn.Value) - 1;
                    jk = Convert.ToInt16(SelColumn.Value) - 1;
                }
                for (j = kj; j <= jk; j++)
                {
                    if (!(datagridview[j, i].Value == null))

                    {
                        if (cboCriteria.Text == "<>")
                        {
                            if (datagridview[j, i].Value.ToString().ToLower() != strNewFilter.ToLower())

                            {
                                containStr = true;
                                wr         = wr + 1;
                                break;
                            }
                        }
                        else
                        {
                            if (Microsoft.VisualBasic.CompilerServices.StringType.StrLike(datagridview[j, i].Value.ToString().ToLower(), strNewFilter.ToLower(), Microsoft.VisualBasic.CompareMethod.Binary))
                            {
                                containStr = true;
                                wr         = wr + 1;
                                break;
                            }
                        }
                    }
                }
                if (!containStr)
                {
                    // Don't remove rows here or your row indexes will get out of whack!
                    // datagridview.Rows.RemoveAt(i)
                    deleteIndexList.Add(i);
                }
                i = i + 1;
            }
            // Remove rows by reversed row index order (highest removed first) to keep the indexes in whack.
            deleteIndexList.Reverse();
            foreach (int idx in deleteIndexList)
            {
                datagridview.Rows.RemoveAt(idx);
            }
            lblCount.Text = "List Count:" + wr.ToString();
        }
Пример #41
0
 /// <summary>Enable double buffering to make redraw faster.</summary>
 public static void EnableDoubleBuffering(DataGridView grid)
 {
     typeof(DataGridView).InvokeMember("DoubleBuffered",
                                       BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
                                       null, grid, new object[] { true });
 }
Пример #42
0
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            ComponentResourceManager resources = new ComponentResourceManager(typeof(MainWindow));

            this.tableLayoutPanel1     = new TableLayoutPanel();
            this.toolStrip1            = new ToolStrip();
            this.toolStripButton1      = new ToolStripButton();
            this.toolStripSeparator1   = new ToolStripSeparator();
            this.toolStripSplitButton1 = new ToolStripButton();
            this.toolStripSeparator3   = new ToolStripSeparator();
            this.btnStart                           = new ToolStripButton();
            this.btnStop                            = new ToolStripButton();
            this.toolStripSeparator2                = new ToolStripSeparator();
            this.toolStripLabel1                    = new ToolStripLabel();
            this.toolStripNumberControl1            = new ToolStripNumberControl();
            this.dataGridView1                      = new DataGridView();
            this.contextMenuStrip1                  = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.toolStripMenuItem1                 = new ToolStripMenuItem();
            this.toolStripMenuItem2                 = new ToolStripMenuItem();
            this.toolStripSeparator4                = new ToolStripSeparator();
            this.toolStripMenuItem3                 = new ToolStripMenuItem();
            this.runCompleteScanToolStripMenuItem   = new ToolStripMenuItem();
            this.toolStripSeparator5                = new ToolStripSeparator();
            this.openFolderToolStripMenuItem        = new ToolStripMenuItem();
            this.openSiteToolStripMenuItem          = new ToolStripMenuItem();
            this.statusStrip1                       = new StatusStrip();
            this.menuStrip1                         = new MenuStrip();
            this.fileToolStripMenuItem              = new ToolStripMenuItem();
            this.newToolStripMenuItem               = new ToolStripMenuItem();
            this.settingsToolStripMenuItem          = new ToolStripMenuItem();
            this.exitToolStripMenuItem              = new ToolStripMenuItem();
            this.editToolStripMenuItem              = new ToolStripMenuItem();
            this.editToolStripMenuItem1             = new ToolStripMenuItem();
            this.deleteToolStripMenuItem            = new ToolStripMenuItem();
            this.helpToolStripMenuItem              = new ToolStripMenuItem();
            this.sendDebugInfoToolStripMenuItem     = new ToolStripMenuItem();
            this.aboutToolStripMenuItem             = new ToolStripMenuItem();
            this.importSettingsToolStripMenuItem    = new ToolStripMenuItem();
            this.unlockTumblRipperToolStripMenuItem = new ToolStripMenuItem();
            this.tableLayoutPanel1.SuspendLayout();
            this.toolStrip1.SuspendLayout();
            ((ISupportInitialize)this.dataGridView1).BeginInit();
            this.contextMenuStrip1.SuspendLayout();
            this.menuStrip1.SuspendLayout();
            base.SuspendLayout();
            this.tableLayoutPanel1.ColumnCount = 1;
            this.tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
            this.tableLayoutPanel1.Controls.Add(this.toolStrip1);
            this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 1);
            this.tableLayoutPanel1.Controls.Add(this.statusStrip1, 0, 2);
            this.tableLayoutPanel1.Dock     = DockStyle.Fill;
            this.tableLayoutPanel1.Location = new Point(0, 24);
            this.tableLayoutPanel1.Name     = "tableLayoutPanel1";
            this.tableLayoutPanel1.RowCount = 3;
            this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
            this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100f));
            this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 20f));
            this.tableLayoutPanel1.Size     = new System.Drawing.Size(773, 340);
            this.tableLayoutPanel1.TabIndex = 0;
            this.toolStrip1.Dock            = DockStyle.Fill;
            this.toolStrip1.GripStyle       = ToolStripGripStyle.Hidden;
            this.toolStrip1.Items.AddRange(new ToolStripItem[] { this.toolStripButton1, this.toolStripSeparator1, this.toolStripSplitButton1, this.toolStripSeparator3, this.btnStart, this.btnStop, this.toolStripSeparator2, this.toolStripLabel1, this.toolStripNumberControl1 });
            this.toolStrip1.Location    = new Point(0, 0);
            this.toolStrip1.Name        = "toolStrip1";
            this.toolStrip1.Size        = new System.Drawing.Size(773, 40);
            this.toolStrip1.TabIndex    = 0;
            this.toolStrip1.Text        = "toolStrip1";
            this.toolStripButton1.Image = (Image)resources.GetObject("toolStripButton1.Image");
            this.toolStripButton1.ImageTransparentColor = Color.Magenta;
            this.toolStripButton1.Name       = "toolStripButton1";
            this.toolStripButton1.Size       = new System.Drawing.Size(93, 37);
            this.toolStripButton1.Text       = "New Tumblr";
            this.toolStripButton1.Click     += new EventHandler(this.newToolStripMenuItem_Click);
            this.toolStripSeparator1.Name    = "toolStripSeparator1";
            this.toolStripSeparator1.Size    = new System.Drawing.Size(6, 40);
            this.toolStripSplitButton1.Image = (Image)resources.GetObject("toolStripSplitButton1.Image");
            this.toolStripSplitButton1.ImageTransparentColor = Color.Magenta;
            this.toolStripSplitButton1.Name   = "toolStripSplitButton1";
            this.toolStripSplitButton1.Size   = new System.Drawing.Size(92, 37);
            this.toolStripSplitButton1.Text   = "Open Folder";
            this.toolStripSplitButton1.Click += new EventHandler(this.toolStripSplitButton1_Click);
            this.toolStripSeparator3.Name     = "toolStripSeparator3";
            this.toolStripSeparator3.Size     = new System.Drawing.Size(6, 40);
            this.btnStart.Image                 = (Image)resources.GetObject("btnStart.Image");
            this.btnStart.ImageScaling          = ToolStripItemImageScaling.None;
            this.btnStart.ImageTransparentColor = Color.Magenta;
            this.btnStart.Name   = "btnStart";
            this.btnStart.Size   = new System.Drawing.Size(48, 37);
            this.btnStart.Text   = "Run";
            this.btnStart.Click += new EventHandler(this.toolStripButton2_Click);
            this.btnStop.Image   = (Image)resources.GetObject("btnStop.Image");
            this.btnStop.ImageTransparentColor = Color.Magenta;
            this.btnStop.Name                              = "btnStop";
            this.btnStop.Size                              = new System.Drawing.Size(51, 37);
            this.btnStop.Text                              = "Stop";
            this.btnStop.Click                            += new EventHandler(this.btnStop_Click);
            this.toolStripSeparator2.Name                  = "toolStripSeparator2";
            this.toolStripSeparator2.Size                  = new System.Drawing.Size(6, 40);
            this.toolStripLabel1.Name                      = "toolStripLabel1";
            this.toolStripLabel1.Size                      = new System.Drawing.Size(106, 37);
            this.toolStripLabel1.Text                      = "Download Threads";
            this.toolStripNumberControl1.Name              = "toolStripNumberControl1";
            this.toolStripNumberControl1.Size              = new System.Drawing.Size(41, 37);
            this.toolStripNumberControl1.Text              = "0";
            this.toolStripNumberControl1.ValueChanged     += new EventHandler(this.toolStripNumberControl1_ValueChanged);
            this.dataGridView1.AllowUserToAddRows          = false;
            this.dataGridView1.AllowUserToDeleteRows       = false;
            this.dataGridView1.AllowUserToOrderColumns     = true;
            this.dataGridView1.AllowUserToResizeRows       = false;
            this.dataGridView1.AutoSizeColumnsMode         = DataGridViewAutoSizeColumnsMode.Fill;
            this.dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.ContextMenuStrip            = this.contextMenuStrip1;
            this.dataGridView1.Dock                        = DockStyle.Fill;
            this.dataGridView1.Location                    = new Point(3, 43);
            this.dataGridView1.Name                        = "dataGridView1";
            this.dataGridView1.ReadOnly                    = true;
            this.dataGridView1.Size                        = new System.Drawing.Size(767, 274);
            this.dataGridView1.TabIndex                    = 1;
            this.dataGridView1.CellDoubleClick            += new DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);
            this.dataGridView1.ColumnWidthChanged         += new DataGridViewColumnEventHandler(this.dataGridView1_ColumnWidthChanged);
            this.dataGridView1.DataError                  += new DataGridViewDataErrorEventHandler(this.dataGridView1_DataError);
            this.dataGridView1.KeyDown                    += new KeyEventHandler(this.dataGridView1_KeyDown);
            this.contextMenuStrip1.Items.AddRange(new ToolStripItem[] { this.toolStripMenuItem1, this.toolStripMenuItem2, this.toolStripSeparator4, this.toolStripMenuItem3, this.runCompleteScanToolStripMenuItem, this.toolStripSeparator5, this.openFolderToolStripMenuItem, this.openSiteToolStripMenuItem });
            this.contextMenuStrip1.Name                  = "contextMenuStrip1";
            this.contextMenuStrip1.Size                  = new System.Drawing.Size(178, 148);
            this.contextMenuStrip1.Opening              += new CancelEventHandler(this.contextMenuStrip1_Opening);
            this.toolStripMenuItem1.Name                 = "toolStripMenuItem1";
            this.toolStripMenuItem1.Size                 = new System.Drawing.Size(177, 22);
            this.toolStripMenuItem1.Text                 = "Edit";
            this.toolStripMenuItem1.Click               += new EventHandler(this.toolStripMenuItem1_Click);
            this.toolStripMenuItem2.Name                 = "toolStripMenuItem2";
            this.toolStripMenuItem2.Size                 = new System.Drawing.Size(177, 22);
            this.toolStripMenuItem2.Text                 = "Delete";
            this.toolStripMenuItem2.Click               += new EventHandler(this.toolStripMenuItem2_Click);
            this.toolStripSeparator4.Name                = "toolStripSeparator4";
            this.toolStripSeparator4.Size                = new System.Drawing.Size(174, 6);
            this.toolStripMenuItem3.Name                 = "toolStripMenuItem3";
            this.toolStripMenuItem3.Size                 = new System.Drawing.Size(177, 22);
            this.toolStripMenuItem3.Text                 = "Run Update";
            this.toolStripMenuItem3.Click               += new EventHandler(this.toolStripMenuItem3_Click);
            this.runCompleteScanToolStripMenuItem.Name   = "runCompleteScanToolStripMenuItem";
            this.runCompleteScanToolStripMenuItem.Size   = new System.Drawing.Size(177, 22);
            this.runCompleteScanToolStripMenuItem.Text   = "Run Complete scan";
            this.runCompleteScanToolStripMenuItem.Click += new EventHandler(this.runCompleteScanToolStripMenuItem_Click);
            this.toolStripSeparator5.Name                = "toolStripSeparator5";
            this.toolStripSeparator5.Size                = new System.Drawing.Size(174, 6);
            this.openFolderToolStripMenuItem.Name        = "openFolderToolStripMenuItem";
            this.openFolderToolStripMenuItem.Size        = new System.Drawing.Size(177, 22);
            this.openFolderToolStripMenuItem.Text        = "Open Folder";
            this.openFolderToolStripMenuItem.Click      += new EventHandler(this.openFolderToolStripMenuItem_Click);
            this.openSiteToolStripMenuItem.Name          = "openSiteToolStripMenuItem";
            this.openSiteToolStripMenuItem.Size          = new System.Drawing.Size(177, 22);
            this.openSiteToolStripMenuItem.Text          = "Open Site";
            this.openSiteToolStripMenuItem.Click        += new EventHandler(this.openSiteToolStripMenuItem_Click);
            this.statusStrip1.Location = new Point(0, 320);
            this.statusStrip1.Name     = "statusStrip1";
            this.statusStrip1.Size     = new System.Drawing.Size(773, 20);
            this.statusStrip1.TabIndex = 2;
            this.statusStrip1.Text     = "statusStrip1";
            this.menuStrip1.Items.AddRange(new ToolStripItem[] { this.fileToolStripMenuItem, this.editToolStripMenuItem, this.helpToolStripMenuItem, this.unlockTumblRipperToolStripMenuItem });
            this.menuStrip1.Location = new Point(0, 0);
            this.menuStrip1.Name     = "menuStrip1";
            this.menuStrip1.Size     = new System.Drawing.Size(773, 24);
            this.menuStrip1.TabIndex = 1;
            this.menuStrip1.Text     = "menuStrip1";
            this.fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.newToolStripMenuItem, this.settingsToolStripMenuItem, this.exitToolStripMenuItem });
            this.fileToolStripMenuItem.Name       = "fileToolStripMenuItem";
            this.fileToolStripMenuItem.Size       = new System.Drawing.Size(37, 20);
            this.fileToolStripMenuItem.Text       = "File";
            this.newToolStripMenuItem.Name        = "newToolStripMenuItem";
            this.newToolStripMenuItem.Size        = new System.Drawing.Size(152, 22);
            this.newToolStripMenuItem.Text        = "New";
            this.newToolStripMenuItem.Click      += new EventHandler(this.newToolStripMenuItem_Click);
            this.settingsToolStripMenuItem.Name   = "settingsToolStripMenuItem";
            this.settingsToolStripMenuItem.Size   = new System.Drawing.Size(152, 22);
            this.settingsToolStripMenuItem.Text   = "Settings";
            this.settingsToolStripMenuItem.Click += new EventHandler(this.settingsToolStripMenuItem_Click);
            this.exitToolStripMenuItem.Name       = "exitToolStripMenuItem";
            this.exitToolStripMenuItem.Size       = new System.Drawing.Size(152, 22);
            this.exitToolStripMenuItem.Text       = "Exit";
            this.exitToolStripMenuItem.Click     += new EventHandler(this.exitToolStripMenuItem_Click);
            this.editToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.editToolStripMenuItem1, this.deleteToolStripMenuItem });
            this.editToolStripMenuItem.Name     = "editToolStripMenuItem";
            this.editToolStripMenuItem.Size     = new System.Drawing.Size(39, 20);
            this.editToolStripMenuItem.Text     = "Edit";
            this.editToolStripMenuItem1.Name    = "editToolStripMenuItem1";
            this.editToolStripMenuItem1.Size    = new System.Drawing.Size(107, 22);
            this.editToolStripMenuItem1.Text    = "Edit";
            this.editToolStripMenuItem1.Click  += new EventHandler(this.editToolStripMenuItem1_Click);
            this.deleteToolStripMenuItem.Name   = "deleteToolStripMenuItem";
            this.deleteToolStripMenuItem.Size   = new System.Drawing.Size(107, 22);
            this.deleteToolStripMenuItem.Text   = "Delete";
            this.deleteToolStripMenuItem.Click += new EventHandler(this.deleteToolStripMenuItem_Click);
            this.helpToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.sendDebugInfoToolStripMenuItem, this.aboutToolStripMenuItem, this.importSettingsToolStripMenuItem });
            this.helpToolStripMenuItem.Name                = "helpToolStripMenuItem";
            this.helpToolStripMenuItem.Size                = new System.Drawing.Size(44, 20);
            this.helpToolStripMenuItem.Text                = "Help";
            this.sendDebugInfoToolStripMenuItem.Name       = "sendDebugInfoToolStripMenuItem";
            this.sendDebugInfoToolStripMenuItem.Size       = new System.Drawing.Size(162, 22);
            this.sendDebugInfoToolStripMenuItem.Text       = "Send Debug Info";
            this.sendDebugInfoToolStripMenuItem.Click     += new EventHandler(this.sendDebugInfoToolStripMenuItem_Click);
            this.aboutToolStripMenuItem.Name               = "aboutToolStripMenuItem";
            this.aboutToolStripMenuItem.Size               = new System.Drawing.Size(162, 22);
            this.aboutToolStripMenuItem.Text               = "About";
            this.aboutToolStripMenuItem.Click             += new EventHandler(this.aboutToolStripMenuItem_Click);
            this.importSettingsToolStripMenuItem.Name      = "importSettingsToolStripMenuItem";
            this.importSettingsToolStripMenuItem.Size      = new System.Drawing.Size(162, 22);
            this.importSettingsToolStripMenuItem.Text      = "ImportSettings";
            this.importSettingsToolStripMenuItem.Click    += new EventHandler(this.importSettingsToolStripMenuItem_Click);
            this.unlockTumblRipperToolStripMenuItem.Name   = "unlockTumblRipperToolStripMenuItem";
            this.unlockTumblRipperToolStripMenuItem.Size   = new System.Drawing.Size(128, 20);
            this.unlockTumblRipperToolStripMenuItem.Text   = "Unlock TumblRipper";
            this.unlockTumblRipperToolStripMenuItem.Click += new EventHandler(this.unlockTumblRipperToolStripMenuItem_Click);
            this.AllowDrop           = true;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            base.ClientSize          = new System.Drawing.Size(773, 364);
            base.Controls.Add(this.tableLayoutPanel1);
            base.Controls.Add(this.menuStrip1);
            base.Icon          = (System.Drawing.Icon)resources.GetObject("$this.Icon");
            base.MainMenuStrip = this.menuStrip1;
            base.Name          = "MainWindow";
            this.Text          = "TumblRipper";
            base.FormClosing  += new FormClosingEventHandler(this.MainWindow_FormClosing);
            base.Load         += new EventHandler(this.MainWindow_Load);
            base.DragDrop     += new DragEventHandler(this.Form1_DragDrop);
            base.DragEnter    += new DragEventHandler(this.Form1_DragEnter);
            this.tableLayoutPanel1.ResumeLayout(false);
            this.tableLayoutPanel1.PerformLayout();
            this.toolStrip1.ResumeLayout(false);
            this.toolStrip1.PerformLayout();
            ((ISupportInitialize)this.dataGridView1).EndInit();
            this.contextMenuStrip1.ResumeLayout(false);
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
Пример #43
0
        void AutoHeightGrid(DataGridView grid)
        {
            var proposedSize = grid.GetPreferredSize(new Size(0, 0));

            grid.Height = proposedSize.Height;
        }
Пример #44
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Constructor de la clase.\n
        ///             Constructor. </summary>
        ///
        /// <remarks>   Javier Fernández Fernández, 18/05/2020. </remarks>
        ///
        /// <param name="idParam">              ID de la pregunta a modificar/borrar.\n
        ///                                     ID of the question to modify/delete </param>
        /// <param name="questionParam">        Pregunta a modificar/borrar.\n
        ///                                     Question to modify/delete. </param>
        /// <param name="answer_A_param">       Respuesta A de la pregunta.\n
        ///                                     Answer A of the question. </param>
        /// <param name="answer_B_param">       Respuesta B de la pregunta.\n
        ///                                     Answer B of the question. </param>
        /// <param name="answer_C_param">       Respuesta C de la pregunta.\n
        ///                                     Answer C of the question. </param>
        /// <param name="answer_D_param">       Respuesta D de la pregunta.\n
        ///                                     Answer D of the question. </param>
        /// <param name="answer_correct_param"> Respuesta correccta de la pregunta.\n
        ///                                     Correct answer of the question. </param>
        /// <param name="tempRowParam">         Fila con los datos de la pregunta a modificar/borrar.\n
        ///                                     Row with all data of the question to modify/detele. </param>
        /// <param name="allQuestionsParam">    Lista con todas las preguntas del modelo.\n
        ///                                     List with all questions of the model.</param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public FormNewTestModificationForModel(string idParam, string questionParam, string answer_A_param, string answer_B_param, string answer_C_param, string answer_D_param, string answer_correct_param, DataGridViewRow tempRowParam, DataGridView allQuestionsParam)
        {
            InitializeComponent();
            id                                  = idParam;
            question                            = questionParam;
            labelQuestion.Text                 += question;
            answer_A                            = answer_A_param;
            labelAnswerA.Text                  += answer_A;
            answer_B                            = answer_B_param;
            labelAnswerB.Text                  += answer_B;
            answer_C                            = answer_C_param;
            labelAnswerC.Text                  += answer_C;
            answer_D                            = answer_D_param;
            labelAnswerD.Text                  += answer_D;
            answer_correct                      = answer_correct_param;
            labelAnswerCorrect.Text            += answer_correct;
            datagridViewObject                  = allQuestionsParam;
            dataGridViewRowObject               = tempRowParam;
            panelUp.Height                     -= 9;
            panelDown.Height                   -= 9;
            pictureBoxSpaceBlack.Width         -= 9;
            comboBoxCorrectAnswer.SelectedIndex = comboBoxCorrectAnswer.FindStringExact("A");
        }
        private void dgvDiem_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            DataGridView d = sender as DataGridView;

            temp = d.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
        }
Пример #46
0
        public FrmPointerFinder(FrmMain mainForm, ulong address, string dataType, ProcessManager processManager, DataGridView cheat_list_view)
        {
            MemoryHelper = new MemoryHelper(true, 0);
            MemoryHelper.InitMemoryHandler(dataType, CONSTANT.EXACT_VALUE, true);

            this.mainForm       = mainForm;
            this.address        = address;
            this.cheatList      = cheat_list_view;
            this.processManager = processManager;

            InitializeComponent();
        }
        private void ConfigureDataGridView(DataGridView dgv)
        {
            dgv.AutoGenerateColumns = false;
            dgv.Columns.Clear();

            DataGridViewColumn c = null;

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "ItemNumber";
            c.HeaderText       = "Item #";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "ItemName";
            c.HeaderText       = "Name";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "QuantityOnHand";
            c.HeaderText       = "On Hand";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "LastCostText";
            c.HeaderText       = "Last Cost";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "SellPriceText";
            c.HeaderText       = "Sell Price";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "ItemSize";
            c.HeaderText       = "Item Size";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "Gender";
            c.HeaderText       = "Gender";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "Color";
            c.HeaderText       = "Color";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "SerialNumber";
            c.HeaderText       = "Serial #";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "BatchNumber";
            c.HeaderText       = "Batch #";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "Brand";
            c.HeaderText       = "Brand";
            dgv.Columns.Add(c);

            c = new DataGridViewTextBoxColumn();
            c.DataPropertyName = "ExpiryDateText";
            c.HeaderText       = "Expired";
            dgv.Columns.Add(c);

            DacII.Util.DataGridViewHelper.UpdateColumnHeaderStyles(dgv);
        }
Пример #48
0
        private void PopulateFilteredShowMSRItemListDGV(String workFlowTrace, String idSearchText, String deptSearchText, String ogSearchText, String apSearchText, BindingSource tabDGVSource, DataGridView dataGridView)
        {
            ICollection <Domain.ShowMSRItem> showMSRItemData = BusinessAPI.BusinessSingleton.Instance.MSRInfoAPI.GetShowMSRList(BusinessAPI.BusinessSingleton.Instance.userInfo_EF.DeptId.ToString(), workFlowTrace);

            ICollection <Domain.ShowMSRItem> showMSRItemDatafilter = BusinessAPI.BusinessSingleton.Instance.MSRInfoAPI.GetFilterShowMSRList(showMSRItemData, idSearchText, deptSearchText, ogSearchText, apSearchText);

            if (showMSRItemDatafilter == null)
            {
                MessageBox.Show("DB error");
                return;
            }

            tabDGVSource.DataSource = showMSRItemDatafilter;
            dataGridView.DataSource = tabDGVSource;
            dataGridView.ClearSelection();
        }
Пример #49
0
 public Grid_View(DataGridView gridView)
 {
     this.gridView = gridView;
 }
Пример #50
0
        private void InitializeComponent()
        {
            ComponentResourceManager resources = new ComponentResourceManager(typeof(ctFormDDJYTestResultView));

            this.btnQuit = new Button();
            this.btnExportPinRelation       = new Button();
            this.groupBox2                  = new GroupBox();
            this.dataGridView1              = new DataGridView();
            this.dataGridViewTextBoxColumn1 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn2 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn3 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn4 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn5 = new DataGridViewTextBoxColumn();
            this.folderBrowserDialog1       = new FolderBrowserDialog();
            this.groupBox2.SuspendLayout();
            ((ISupportInitialize)this.dataGridView1).BeginInit();
            base.SuspendLayout();
            this.btnQuit.Anchor = AnchorStyles.Bottom;
            this.btnQuit.Font   = new System.Drawing.Font("宋体", 10.8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
            System.Drawing.Point location = new System.Drawing.Point(489, 519);
            this.btnQuit.Location = location;
            Padding margin = new Padding(2, 2, 2, 2);

            this.btnQuit.Margin = margin;
            this.btnQuit.Name   = "btnQuit";
            System.Drawing.Size size = new System.Drawing.Size(90, 24);
            this.btnQuit.Size     = size;
            this.btnQuit.TabIndex = 0;
            this.btnQuit.Text     = "关闭";
            this.btnQuit.UseVisualStyleBackColor = true;
            this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click);
            this.btnExportPinRelation.Anchor = AnchorStyles.Bottom;
            this.btnExportPinRelation.Font   = new System.Drawing.Font("宋体", 10.8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
            System.Drawing.Point location2 = new System.Drawing.Point(216, 519);
            this.btnExportPinRelation.Location = location2;
            Padding margin2 = new Padding(2, 2, 2, 2);

            this.btnExportPinRelation.Margin = margin2;
            this.btnExportPinRelation.Name   = "btnExportPinRelation";
            System.Drawing.Size size2 = new System.Drawing.Size(90, 24);
            this.btnExportPinRelation.Size     = size2;
            this.btnExportPinRelation.TabIndex = 1;
            this.btnExportPinRelation.Text     = "导出";
            this.btnExportPinRelation.UseVisualStyleBackColor = true;
            this.btnExportPinRelation.Click += new System.EventHandler(this.btnExportPinRelation_Click);
            this.groupBox2.Anchor            = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
            this.groupBox2.Controls.Add(this.dataGridView1);
            this.groupBox2.Font = new System.Drawing.Font("宋体", 10.8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
            System.Drawing.Point location3 = new System.Drawing.Point(8, 16);
            this.groupBox2.Location = location3;
            Padding margin3 = new Padding(2, 2, 2, 2);

            this.groupBox2.Margin = margin3;
            this.groupBox2.Name   = "groupBox2";
            Padding padding = new Padding(2, 2, 2, 2);

            this.groupBox2.Padding = padding;
            System.Drawing.Size size3 = new System.Drawing.Size(778, 480);
            this.groupBox2.Size     = size3;
            this.groupBox2.TabIndex = 3;
            this.groupBox2.TabStop  = false;
            this.groupBox2.Text     = "对地绝缘测试数据表";
            this.dataGridView1.AllowUserToAddRows       = false;
            this.dataGridView1.AllowUserToDeleteRows    = false;
            this.dataGridView1.AllowUserToResizeColumns = false;
            this.dataGridView1.AllowUserToResizeRows    = false;
            System.Drawing.Color window = System.Drawing.SystemColors.Window;
            this.dataGridView1.BackgroundColor             = window;
            this.dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            DataGridViewColumn[] dataGridViewColumns = new DataGridViewColumn[]
            {
                this.dataGridViewTextBoxColumn1,
                this.dataGridViewTextBoxColumn2,
                this.dataGridViewTextBoxColumn3,
                this.dataGridViewTextBoxColumn4,
                this.dataGridViewTextBoxColumn5
            };
            this.dataGridView1.Columns.AddRange(dataGridViewColumns);
            this.dataGridView1.Dock = DockStyle.Fill;
            System.Drawing.Point location4 = new System.Drawing.Point(2, 19);
            this.dataGridView1.Location = location4;
            Padding margin4 = new Padding(2, 2, 2, 2);

            this.dataGridView1.Margin             = margin4;
            this.dataGridView1.MultiSelect        = false;
            this.dataGridView1.Name               = "dataGridView1";
            this.dataGridView1.ReadOnly           = true;
            this.dataGridView1.RowHeadersVisible  = false;
            this.dataGridView1.RowTemplate.Height = 27;
            this.dataGridView1.SelectionMode      = DataGridViewSelectionMode.FullRowSelect;
            System.Drawing.Size size4 = new System.Drawing.Size(774, 459);
            this.dataGridView1.Size     = size4;
            this.dataGridView1.TabIndex = 2;
            this.dataGridViewTextBoxColumn1.HeaderText = "序号";
            this.dataGridViewTextBoxColumn1.Name       = "dataGridViewTextBoxColumn1";
            this.dataGridViewTextBoxColumn1.ReadOnly   = true;
            this.dataGridViewTextBoxColumn1.Width      = 80;
            this.dataGridViewTextBoxColumn2.HeaderText = "起点";
            this.dataGridViewTextBoxColumn2.Name       = "dataGridViewTextBoxColumn2";
            this.dataGridViewTextBoxColumn2.ReadOnly   = true;
            this.dataGridViewTextBoxColumn2.Width      = 180;
            this.dataGridViewTextBoxColumn3.HeaderText = "终点";
            this.dataGridViewTextBoxColumn3.Name       = "dataGridViewTextBoxColumn3";
            this.dataGridViewTextBoxColumn3.ReadOnly   = true;
            this.dataGridViewTextBoxColumn3.Width      = 150;
            this.dataGridViewTextBoxColumn4.HeaderText = "测试值";
            this.dataGridViewTextBoxColumn4.Name       = "dataGridViewTextBoxColumn4";
            this.dataGridViewTextBoxColumn4.ReadOnly   = true;
            this.dataGridViewTextBoxColumn4.Width      = 180;
            this.dataGridViewTextBoxColumn5.HeaderText = "测试结果";
            this.dataGridViewTextBoxColumn5.Name       = "dataGridViewTextBoxColumn5";
            this.dataGridViewTextBoxColumn5.ReadOnly   = true;
            this.dataGridViewTextBoxColumn5.Width      = 150;
            System.Drawing.SizeF autoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
            base.AutoScaleDimensions = autoScaleDimensions;
            base.AutoScaleMode       = AutoScaleMode.Font;
            System.Drawing.Size clientSize = new System.Drawing.Size(794, 571);
            base.ClientSize = clientSize;
            base.Controls.Add(this.btnQuit);
            base.Controls.Add(this.btnExportPinRelation);
            base.Controls.Add(this.groupBox2);
            base.FormBorderStyle = FormBorderStyle.FixedDialog;
            base.Icon            = (System.Drawing.Icon)resources.GetObject("$this.Icon");
            Padding margin5 = new Padding(2, 2, 2, 2);

            base.Margin        = margin5;
            base.Name          = "ctFormDDJYTestResultView";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text          = "对地绝缘测试数据";
            base.Load         += new System.EventHandler(this.ctFormDDJYTestResultView_Load);
            base.SizeChanged  += new System.EventHandler(this.ctFormDDJYTestResultView_SizeChanged);
            this.groupBox2.ResumeLayout(false);
            ((ISupportInitialize)this.dataGridView1).EndInit();
            base.ResumeLayout(false);
        }
Пример #51
0
        //Función para exportar a excel
        private void exportarAExcel(DataGridView dgvCierre)
        {
            try
            {
                Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();

                excel.Application.Workbooks.Add(true);

                int iIndiceColumna = 0;

                excel.Columns.ColumnWidth = 40;
                excel.Cells[1, 4]         = "INFORME DE INGRESOS ";
                excel.Cells[2, 4]         = "DESDE " + sFechaInicio + " A " + sFechaFin;

                foreach (DataGridViewColumn col in dgvCierre.Columns)
                {
                    iIndiceColumna++;

                    if (iIndiceColumna == 1)
                    {
                        excel.Cells[1, iIndiceColumna].ColumnWidth = 0;
                    }

                    if (iIndiceColumna == 2 || iIndiceColumna == 6 || iIndiceColumna == 7 || iIndiceColumna == 12 || iIndiceColumna == 13)
                    {
                        excel.Cells[1, iIndiceColumna].ColumnWidth = 8;
                    }

                    if (iIndiceColumna == 3 || iIndiceColumna == 5 || iIndiceColumna == 9 || iIndiceColumna == 10 || iIndiceColumna == 11)
                    {
                        excel.Cells[1, iIndiceColumna].ColumnWidth = 10;
                    }


                    if (iIndiceColumna != 1)
                    {
                        excel.Cells[4, iIndiceColumna] = col.HeaderText;
                        excel.Cells[4, iIndiceColumna].Interior.Color = Color.Yellow;
                        excel.Cells[4, iIndiceColumna].BorderAround();
                    }
                }


                int iIndiceFila = 4;

                foreach (DataGridViewRow row in dgvCierre.Rows)
                {
                    iIndiceFila++;

                    iIndiceColumna = 0;

                    foreach (DataGridViewColumn col in dgvCierre.Columns)
                    {
                        iIndiceColumna++;
                        excel.Cells[iIndiceFila + 1, iIndiceColumna] = row.Cells[col.Name].Value;
                    }
                }

                excel.get_Range("A4", "M4").BorderAround();
                excel.Visible = true;
            }

            catch (Exception ex)
            {
                catchMensaje.lblMensaje.Text = ex.Message;
                catchMensaje.ShowDialog();
            }
        }
Пример #52
0
        private void fillTableResult(DataGridView dgv, Task task, src.SMethod.SimplexMethodSolver slv)
        {
            dgv.Rows.Clear();
            dgv.Columns.Clear();

            if (slv.errMsg != "OK")
            {
                return;
            }

            List <OrderPair> savedOrder = new List <OrderPair>();

            foreach (OrderPair p in order)
            {
                savedOrder.Add(new OrderPair(new Detail1D(pgrdOrderDetail, new double[] { p.Detail.Volume }), p.Num));
            }

            String[] strs = new String[3];
            strs[0] = "Число заготовок:";
            strs[1] = "Разрез:";
            strs[2] = "Остатки:";

            dgv.Columns.Add("", ""); dgv.Columns.Add("", ""); dgv.Columns.Add("", "");

            dgv.Rows.Add(strs);
            dgv.Rows[0].DefaultCellStyle.BackColor = Color.LightGray;
            dgv.Columns[0].Width = 150; dgv.Columns[2].Width = 100;

            double allLeft = 0.0;

            for (int i = 0; i < slv.xsCol.Count - 1; i++)
            {
                if (slv.table[i, slv.table.GetLength(1) - 1] == 0.0)
                {
                    continue;
                }

                int rounded = (int)slv.table[i, slv.table.GetLength(1) - 1];

                strs[0] = rounded.ToString();
                strs[1] = "";
                foreach (OrderPair p in task.AllCuts[slv.xsCol[i] - 1].Pairs)
                {
                    for (int j = 0; j < p.Num; j++)
                    {
                        strs[1] += (((Detail1D)p.Detail).Length).ToString().Replace(',', '.');
                        foreach (OrderPair oP in order)
                        {
                            if (((Detail1D)oP.Detail).Length == ((Detail1D)p.Detail).Length)
                            {
                                oP.Num -= rounded;
                                break;
                            }
                        }

                        if (j == p.Num - 1)
                        {
                            if (p != task.AllCuts[slv.xsCol[i] - 1].Pairs.Last())
                            {
                                strs[1] += ",";
                            }
                        }
                        else
                        {
                            strs[1] += ",";
                        }
                    }
                }
                strs[2]  = Math.Round(task.AllCuts[slv.xsCol[i] - 1].Left, 3).ToString().Replace(',', '.');
                allLeft += task.AllCuts[slv.xsCol[i] - 1].Left * rounded;
                dgv.Rows.Add(strs);
            }

            // ЖАДНЫЙ
            List <src.Cut> leftCuts      = greedyAlgorithm();
            double         greedyCutLeft = 0.0;

            foreach (Cut cut in leftCuts)
            {
                strs[0] = "1"; strs[1] = "";
                foreach (OrderPair p in cut.Pairs)
                {
                    for (int j = 0; j < p.Num; j++)
                    {
                        strs[1] += (((Detail1D)p.Detail).Length).ToString().Replace(',', '.');
                        foreach (OrderPair oP in order)
                        {
                            if (((Detail1D)oP.Detail).Length == ((Detail1D)p.Detail).Length)
                            {
                                oP.Num -= 1;
                                break;
                            }
                        }

                        if (j == p.Num - 1)
                        {
                            if (p != cut.Pairs.Last())
                            {
                                strs[1] += ",";
                            }
                        }
                        else
                        {
                            strs[1] += ",";
                        }
                    }
                }
                strs[2]        = Math.Round(cut.Left, 3).ToString().Replace(',', '.');
                greedyCutLeft += cut.Left;
                dgv.Rows.Add(strs);
            }

            strs[0] = strs[1] = strs[2] = "";
            dgv.Rows.Add(strs);
            strs[0] = "Общие:";
            strs[2] = Math.Round(allLeft, 3).ToString().Replace(',', '.') + " + " + Math.Round(greedyCutLeft, 3).ToString().Replace(',', '.');
            dgv.Rows.Add(strs);
            dgv.Rows[dgv.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Gray;

            order = savedOrder;
        }
Пример #53
0
        //列表控件,鼠标左键双击列表项事件
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            MyTabItem foundTab = null;
            bool      bNewTab  = false;

            //已经有数据读到显示panel中,就设置为可写属性
            condition.ReadOnly        = false;
            filterexpression.ReadOnly = false;
            sortexpression.ReadOnly   = false;


            //根据列表项的内容,找到标签
            foreach (TabItem tabItem in tabControl1.Tabs)
            {
                if (tabItem.Text == treeView1.SelectedNode.Text)
                {
                    foundTab = tabItem as MyTabItem;  //as语句作为类型转换
                }
            }
            if (foundTab == null)
            {//如果没找到标签页
                MyTabItem newTab = new MyTabItem();
                tabControl1.Tabs.Add(newTab);
                newTab.Text      = treeView1.SelectedNode.Text;
                tabControlPanel1 = new TabControlPanel();
                DataGridView dgv = new DataGridView();

                DataView dataView = new DataView();
                tabControlPanel1.Dock   = DockStyle.Fill;
                dataView.Table          = DS.Tables[treeView1.SelectedNode.Text];
                dataView.RowFilter      = "";
                newTab.AttachedDataView = dataView;
                //设置表格属性

                dgv.AutoGenerateColumns     = true;
                dgv.AllowUserToAddRows      = false;
                dgv.AllowUserToDeleteRows   = false;
                dgv.AllowUserToOrderColumns = false;
                dgv.DataSource          = dataView;
                dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
                for (int i = 5; i < dgv.Columns.Count; i++)
                {
                    dgv.Columns[i].MinimumWidth = 60;
                }
                if (dataView.Table.Columns.Contains("Flg"))
                {
                    foreach (DataGridViewColumn col in dgv.Columns)
                    {
                        if (col.Name == "Flg")
                        {
                            col.MinimumWidth = 70
                            ;
                        }
                    }
                }
                dgv.Location = new Point(0, 0);
                dgv.Dock     = DockStyle.Fill;
                newTab.AttachedDataGridview = dgv;



                DisableAutoSort(dgv);
                tabControlPanel1.Controls.Add(dgv);
                newTab.AttachedControl = tabControlPanel1;
                foundTab = newTab;
                bNewTab  = true;
            }

            //表格显示
            tabControl1.SelectedTab   = foundTab;
            tabControl1.SelectedPanel = foundTab.AttachedControl as TabControlPanel;
            if (bNewTab)//如果是新的标签页,则添加到控件中(个人感觉这句话放在上面大if里比较好)
            {
                tabControl1.Controls.Add(tabControl1.SelectedPanel);
            }
            tabControl1.SelectedPanel.Show();//显示表格

            //填充字段选择下拉列表
            fields.SelectedIndex = foundTab.fieldIndex;
        }
 public void dataGridSipariseAitUrunleriGetir(DataGridView dataGridView, List <SiparisDetayModel> siparisDetaylistesi)
 {
     dataGridView.DataSource = siparisDetaylistesi;
 }
	// Constructors
	public DataGridViewColumnCollection(DataGridView dataGridView) {}
Пример #56
0
        private void dataGridToTrade_DataError(object sender, DataGridViewDataErrorEventArgs anError)
        {
            DataGridView view = (DataGridView)sender;

            view.Rows[anError.RowIndex].Cells[anError.ColumnIndex].Value = 0;
        }
	// Constructors
	public DataGridViewCellPaintingEventArgs(DataGridView dataGridView, System.Drawing.Graphics graphics, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, int columnIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {}
Пример #58
0
        public static void DataGridView2Excel_cvs(DataGridView dgv)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter           = "Excel files (*.xls)|*.xls";
            dlg.FilterIndex      = 0;
            dlg.RestoreDirectory = true;
            //dlg.CreatePrompt = true;
            dlg.Title = "保存为Excel文件";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Stream myStream;
                myStream = dlg.OpenFile();
                StreamWriter sw          = new StreamWriter(myStream, System.Text.Encoding.GetEncoding(-0));
                string       columnTitle = "";
                try
                {
                    //写入列标题
                    for (int i = 0; i < dgv.ColumnCount; i++)
                    {
                        if (i > 0)
                        {
                            columnTitle += "\t";
                        }
                        columnTitle += dgv.Columns[i].HeaderText;
                    }
                    sw.WriteLine(columnTitle);
                    //写入内容
                    for (int j = 0; j < dgv.Rows.Count; j++)
                    {
                        string columnValue = "";
                        for (int k = 0; k < dgv.Columns.Count; k++)
                        {
                            if (k > 0)
                            {
                                columnValue += "\t";
                            }
                            if (dgv.Rows[j].Cells[k].Value == null)
                            {
                                columnValue += "";
                            }
                            else
                            {
                                columnValue += dgv.Rows[j].Cells[k].Value.ToString().Trim();
                            }
                        }
                        sw.WriteLine(columnValue);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }
                finally
                {
                    sw.Close();
                    myStream.Close();
                }
            }
        }
Пример #59
0
	public MainForm ()
	{
		// 
		// _dataGrid
		// 
		_dataGrid = new DataGridView ();
		_dataGrid.AllowUserToAddRows = false;
		_dataGrid.AllowUserToDeleteRows = false;
		_dataGrid.AllowUserToResizeRows = true;
		_dataGrid.Dock = DockStyle.Top;
		_dataGrid.Height = 100;
		_dataGrid.MultiSelect = true;
		_dataGrid.RowHeadersVisible = false;
		_dataGrid.RowTemplate.Height = 18;
		_dataGrid.ShowCellToolTips = false;
		Controls.Add (_dataGrid);
		// 
		// _readOnlyGroupBox
		// 
		_readOnlyGroupBox = new GroupBox ();
		_readOnlyGroupBox.Dock = DockStyle.Bottom;
		_readOnlyGroupBox.Height = 100;
		_readOnlyGroupBox.Text = "ReadOnly";
		Controls.Add (_readOnlyGroupBox);
		// 
		// _dataGridViewReadOnlyCheckBox
		// 
		_dataGridViewReadOnlyCheckBox = new CheckBox ();
		_dataGridViewReadOnlyCheckBox.Location = new Point (8, 16);
		_dataGridViewReadOnlyCheckBox.Size = new Size (120, 20);
		_dataGridViewReadOnlyCheckBox.Text = "DataGridView";
		_dataGridViewReadOnlyCheckBox.CheckedChanged += new EventHandler (DataGridViewReadOnlyCheckBox_CheckChanged);
		_readOnlyGroupBox.Controls.Add (_dataGridViewReadOnlyCheckBox);
		// 
		// _rowReadOnlyCheckBox
		// 
		_rowReadOnlyCheckBox = new CheckBox ();
		_rowReadOnlyCheckBox.Location = new Point (8, 35);
		_rowReadOnlyCheckBox.Size = new Size (120, 20);
		_rowReadOnlyCheckBox.Text = "2nd Row";
		_rowReadOnlyCheckBox.CheckedChanged += new EventHandler (RowReadOnlyCheckBox_CheckChanged);
		_readOnlyGroupBox.Controls.Add (_rowReadOnlyCheckBox);
		// 
		// _columnReadOnlyCheckBox
		// 
		_columnReadOnlyCheckBox = new CheckBox ();
		_columnReadOnlyCheckBox.Location = new Point (8, 54);
		_columnReadOnlyCheckBox.Size = new Size (120, 20);
		_columnReadOnlyCheckBox.Text = "Person Column";
		_columnReadOnlyCheckBox.CheckedChanged += new EventHandler (ColumnReadOnlyCheckBox_CheckChanged);
		_readOnlyGroupBox.Controls.Add (_columnReadOnlyCheckBox);
		// 
		// _cellReadOnlyCheckBox
		// 
		_cellReadOnlyCheckBox = new CheckBox ();
		_cellReadOnlyCheckBox.Location = new Point (8, 73);
		_cellReadOnlyCheckBox.Size = new Size (200, 20);
		_cellReadOnlyCheckBox.Text = "Peron Cell in 2nd row";
		_cellReadOnlyCheckBox.CheckedChanged += new EventHandler (CellReadOnlyCheckBox_CheckChanged);
		_readOnlyGroupBox.Controls.Add (_cellReadOnlyCheckBox);
		// 
		// MainForm
		// 
		ClientSize = new Size (350, 210);
		Location = new Point (150, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #81074";
		Load += new EventHandler (MainForm_Load);
	}
 // The class constructor
 public DataGridViewPrinter(DataGridView dataGridView, PrintDocument printDocument, string headerText, bool printPageNumbers)
 {
     _dataGridView = dataGridView;
     _printDocument = printDocument;
     _headerText = headerText;
     _cellHeight = _bodyFont.Height + 5;
     _pageNumber = 0;
     _currentRow = 0;
     _printPageNumbers = printPageNumbers;
 }