Ejemplo n.º 1
0
        private void viewSamplesAttachmets_DoubleClick(object sender, EventArgs e)
        {
            CardView view = (CardView)sender;
            Point    pt   = view.GridControl.PointToClient(Control.MousePosition);
            //    DoRowDoubleClick(view, pt);
            CardHitInfo info = view.CalcHitInfo(pt);

            if (info.InCard)
            {
                int sampleAttachmentID = (int)viewSamplesAttachmets.GetRowCellValue(info.RowHandle, "SampleAttachmentID");
                SampleAttachments sampleAttachments = db.SampleAttachments.First(x => x.SampleAttachmentID == sampleAttachmentID);

                if (Tools.FileIsPicture(sampleAttachments.FileExt))
                {
                    //                FrmShowSapmplesAttachments frmShowPicture = new FrmShowSapmplesAttachments(sampleAttachments.FileData, sampleAttachments.FileName + sampleAttachments.FileExt);
                    FrmShowSapmplesAttachments frmShowPicture = new FrmShowSapmplesAttachments(GetSamplesAttachmentsList(), sampleAttachmentID);
                    frmShowPicture.ShowDialog();
                }
                else
                {
                    Tools.openFilefromModel(new FileModel
                    {
                        Name      = sampleAttachments.FileName,
                        Extension = sampleAttachments.FileExt,
                        Data      = sampleAttachments.FileData
                    }
                                            );
                }
            }
        }
Ejemplo n.º 2
0
        private void gridControl1_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                point = e.GetPosition(null);
                GridControl         grid = sender as GridControl;
                GridViewHitInfoBase info;

                if (grid.View.GetType() == typeof(TableView))
                {
                    TableView view = grid.View as TableView;
                    info = view.CalcHitInfo(e.OriginalSource as DependencyObject);
                }
                else
                {
                    CardView view = grid.View as CardView;
                    info = view.CalcHitInfo(e.OriginalSource as DependencyObject);
                }

                if (info.RowHandle != GridControl.InvalidRowHandle)
                {
                    handler   = info.RowHandle;
                    e.Handled = true;
                }
            }
        }
        private void crdVwAdsCar_MouseDown(object sender, MouseEventArgs e)
        {
            CardView    cardView = sender as CardView;
            CardHitInfo hInfo    = cardView.CalcHitInfo(e.X, e.Y);

            if (hInfo.HitTest == CardHitTest.FieldCaption || hInfo.InCard)
            {
                int       rowHandle = hInfo.RowHandle;
                int       id        = (int)crdVwAdsCar.GetRowCellValue(rowHandle, "ID");
                FrmImages frmImages = new FrmImages(id);
                frmImages.ShowDialog();
            }
        }
        private void crdVwCars_MouseDown(object sender, MouseEventArgs e)
        {
            CardView    cardView = (CardView)sender;
            CardHitInfo hInfo    = cardView.CalcHitInfo(e.X, e.Y);

            if (hInfo.HitTest == CardHitTest.FieldValue || hInfo.HitTest == CardHitTest.FieldCaption || hInfo.InCard)
            {
                int        rowHandle  = hInfo.RowHandle;
                int        id         = (int)crdVwCars.GetRowCellValue(rowHandle, "ID");
                FrmCarInfo frmCarInfo = new FrmCarInfo(id);
                frmCarInfo.ShowDialog();
            }
        }
Ejemplo n.º 5
0
        private void cardView1_DoubleClick(object sender, EventArgs e)
        {
            CardView view = (CardView)sender;
            Point    pt   = view.GridControl.PointToClient(Control.MousePosition);
            //    DoRowDoubleClick(view, pt);
            CardHitInfo info = view.CalcHitInfo(pt);

            if (info.InCard)
            {
                int appid      = (int)cardView1.GetRowCellValue(info.RowHandle, "ID");
                var attachment = db.Attachments.First(x => x.ID == appid);

                Tools.openFilefromModel(new FileModel
                {
                    Name      = attachment.FileName,
                    Extension = attachment.FileExt,
                    Data      = attachment.FileData
                });
            }
        }
        private void gridView1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            CardView    view = sender as CardView;
            CardHitInfo info = view.CalcHitInfo(new Point(e.X, e.Y));
            GridCell    c    = new GridCell(info.RowHandle, info.Column);

            if (info.HitTest == CardHitTest.FieldValue)
            {
                HotTrackCell = new GridCell(info.RowHandle, info.Column);
                if (info.Column.RealColumnEdit is RepositoryItemPictureEdit)
                {
                    gridControl1.BeginInvoke(new MethodInvoker(delegate() { gridControl1.Cursor = Cursors.Hand; }));
                }
                else
                {
                    gridControl1.Cursor = Cursors.Default;
                }
            }
            else
            {
                HotTrackCell = null;
            }
        }