示例#1
0
        private void StartCardDrag(LayoutView view, Point clickLocation, int rowHandle, Rectangle rowBounds)
        {
            string id = view.GetRowCellValue(rowHandle, view.Columns["TaskId"]).ToString();

            // Create a cursor from the card bitmap.
            using (var gridBitmap = new Bitmap(view.GridControl.Width, view.GridControl.Height)) {
                view.GridControl.DrawToBitmap(gridBitmap,
                                              new Rectangle(0, 0, view.GridControl.Width,
                                                            view.GridControl.Height));
                using (var cardBitmap = CropBitmap(gridBitmap, rowBounds))
                {
                    this.customCursorWrapper =
                        CustomCursorWrapper.CreateFromBitmap(cardBitmap,
                                                             Point.Subtract(clickLocation, new Size(rowBounds.Location)));
                }
            }

            // Start drag and drop
            view.GridControl.DoDragDrop(id, DragDropEffects.Move);
        }
示例#2
0
        /// <summary>
        /// Reset the filter text in the label
        /// </summary>
        public void ResetFilterText(BaseView view)
        {
            if (this.DesignMode)
            {
                this.Text = "< Design Mode - No Count >";
                return;
            }

            StringBuilder itemText = new StringBuilder();

            try
            {
                int  visibleRows = 0, totalRows = 0;
                bool checkPresent = false;
                int  checkedRows  = -1;
                if (view is GridView)
                {
                    GridView vw = (GridView)view;
                    // When the filter control changes, change the text at the bottom
                    visibleRows  = vw.DataRowCount;
                    totalRows    = (vw.DataSource != null ? (vw.DataSource as IList).Count : 0);            //((System.Data.DataView)view.DataSource).Count;
                    checkPresent = (vw.VisibleColumns.Count > 0 &&
                                    vw.VisibleColumns[0].ColumnType == typeof(System.Boolean));             // _dt.Columns.Contains("check");
                    checkedRows = -1;
                    if (checkPresent)
                    {
                        // Reset the null data if need be
                        int count = 0;
                        for (int i = 0; i < view.RowCount; i++)
                        {
                            if (vw.VisibleColumns.Count > 0 &&
                                vw.GetRowCellValue(i, vw.VisibleColumns[0]) != null &&
                                vw.VisibleColumns[0].ColumnType.ToString().Contains("System.Boolean") &&
                                !String.IsNullOrEmpty(vw.GetRowCellValue(i, vw.VisibleColumns[0]).ToString()) &&
                                bool.Parse(vw.GetRowCellValue(i, vw.VisibleColumns[0]).ToString()))
                            {
                                count++;
                            }
                        }
                        checkedRows = count;
                    }
                }
                else if (view is CardView)
                {
                    CardView vw = (CardView)view;
                    // When the filter control changes, change the text at the bottom
                    visibleRows  = vw.DataRowCount;
                    totalRows    = (vw.DataSource != null ? (vw.DataSource as IList).Count : 0);            //((System.Data.DataView)view.DataSource).Count;
                    checkPresent = (vw.VisibleColumns.Count > 0 &&
                                    vw.VisibleColumns[0].ColumnType == typeof(System.Boolean));             // _dt.Columns.Contains("check");
                    checkedRows = -1;
                    if (checkPresent)
                    {
                        // Reset the null data if need be
                        int count = 0;
                        for (int i = 0; i < view.RowCount; i++)
                        {
                            if (vw.VisibleColumns.Count > 0 &&
                                vw.GetRowCellValue(i, vw.VisibleColumns[0]) != null &&
                                vw.VisibleColumns[0].ColumnType.ToString().Contains("System.Boolean") &&
                                !String.IsNullOrEmpty(vw.GetRowCellValue(i, vw.VisibleColumns[0]).ToString()) &&
                                bool.Parse(vw.GetRowCellValue(i, vw.VisibleColumns[0]).ToString()))
                            {
                                count++;
                            }
                        }
                        checkedRows = count;
                    }
                }
                else if (view is LayoutView)
                {
                    LayoutView vw = (LayoutView)view;
                    // When the filter control changes, change the text at the bottom
                    visibleRows  = vw.DataRowCount;
                    totalRows    = (vw.DataSource != null ? (vw.DataSource as IList).Count : 0);            //((System.Data.DataView)view.DataSource).Count;
                    checkPresent = (vw.VisibleColumns.Count > 0 &&
                                    vw.VisibleColumns[0].ColumnType == typeof(System.Boolean));             // _dt.Columns.Contains("check");
                    checkedRows = -1;
                    if (checkPresent)
                    {
                        // Reset the null data if need be
                        int count = 0;
                        for (int i = 0; i < view.RowCount; i++)
                        {
                            if (vw.VisibleColumns.Count > 0 &&
                                vw.GetRowCellValue(i, vw.VisibleColumns[0]) != null &&
                                vw.VisibleColumns[0].ColumnType.ToString().Contains("System.Boolean") &&
                                !String.IsNullOrEmpty(vw.GetRowCellValue(i, vw.VisibleColumns[0]).ToString()) &&
                                bool.Parse(vw.GetRowCellValue(i, vw.VisibleColumns[0]).ToString()))
                            {
                                count++;
                            }
                        }
                        checkedRows = count;
                    }
                }

                if (view.GridControl is mgDevX_GridControl &&
                    ((mgDevX_GridControl)view.GridControl).DBCount > -1)
                {
                    _loadedCountText = _loadedCountText.Replace("Rows ", "");
                    itemText.Append(((mgDevX_GridControl)view.GridControl).DBCount.ToString("###,###,##0") +
                                    " " + _dbCountText + ", ");
                }
                itemText.Append(totalRows.ToString("###,###,##0") + " " + _loadedCountText + ", " +
                                visibleRows.ToString("###,###,##0") + " " + _visibleCountText + "" +
                                (checkPresent ? ", " + checkedRows.ToString("###,###,##0") + " " + _checkedCountText + "" : ""));
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" +
                                                     ex.StackTrace, "Error",
                                                     System.Windows.Forms.MessageBoxButtons.OK,
                                                     System.Windows.Forms.MessageBoxIcon.Error);
            }
            this.Text = itemText.ToString();
        }