示例#1
0
        private void PrintDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Bitmap bm = new Bitmap(this.CartdataGridView.Width, this.CartdataGridView.Height);

            CartdataGridView.DrawToBitmap(bm, new Rectangle(0, 0, CartdataGridView.Width, this.CartdataGridView.Height));
            e.Graphics.DrawImage(bm, 10, 10);
        }
示例#2
0
        private void CartdataGridView_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                //finding the click point!
                var hti = CartdataGridView.HitTest(e.X, e.Y);
                //finding out the row where is hitted/clicked!
                CartdataGridView.Rows[hti.RowIndex].Selected = true;

                //showing the menustript where the row is being clicked!
                contextMenuStrip1.Show(CartdataGridView, e.X, e.Y);
            }
        }