protected override void DrawRowCell(GridViewDrawArgs e, GridCellInfo cell)
 {
     cell.ViewInfo.MatchedStringUseContains = true;
     cell.ViewInfo.MatchedString = View.GetExtraFilterText;
     cell.State = GridRowCellState.Dirty;
     e.ViewInfo.UpdateCellAppearance(cell);
     base.DrawRowCell(e, cell);
 }
        protected override void DrawCellEdit(GridViewDrawArgs e, BaseEditViewInfo editInfo, GridCellInfo cell, AppearanceObject appearance, bool isSelectedCell)
        {
            IIconSelector iconSelector = cell.Editor as IIconSelector;

            if (iconSelector != null)
            {
                OnIconSelectionEventHandler EH = new OnIconSelectionEventHandler(iconSelector_OnIconSelection);
                iconSelector.OnIconSelection += EH;
                nowDrawingCellInfo            = cell;
                try
                {
                    base.DrawCellEdit(e, editInfo, cell, appearance, isSelectedCell);
                }
                finally
                {
                    iconSelector.OnIconSelection -= EH;
                }
            }
            else
            {
                base.DrawCellEdit(e, editInfo, cell, appearance, isSelectedCell);
            }
        }
Esempio n. 3
0
        private void DrawEditor(DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            GridCellInfo     cell       = e.Cell as GridCellInfo;
            Point            offset     = cell.CellValueRect.Location;
            BaseEditPainter  pb         = cell.ViewInfo.Painter as BaseEditPainter;
            AppearanceObject savedStyle = cell.ViewInfo.PaintAppearance;

            if (!offset.IsEmpty)
            {
                cell.ViewInfo.Offset(offset.X, offset.Y);
            }
            try
            {
                pb.Draw(new ControlGraphicsInfoArgs(cell.ViewInfo, e.Cache, cell.Bounds));
            }
            finally
            {
                if (!offset.IsEmpty)
                {
                    cell.ViewInfo.Offset(-offset.X, -offset.Y);
                }
            }
        }
        public void DrawMergedCell(MyMergedCell cell, PaintExEventArgs e)
        {
            int delta = cell.Column1.VisibleIndex - cell.Column2.VisibleIndex;

            if (Math.Abs(delta) > 1)
            {
                return;
            }
            GridViewInfo vi            = View.GetViewInfo() as GridViewInfo;
            GridCellInfo gridCellInfo1 = vi.GetGridCellInfo(cell.RowHandle, cell.Column1);
            GridCellInfo gridCellInfo2 = vi.GetGridCellInfo(cell.RowHandle, cell.Column2);

            if (gridCellInfo1 == null || gridCellInfo2 == null)
            {
                return;
            }
            Rectangle targetRect = Rectangle.Union(gridCellInfo1.Bounds, gridCellInfo2.Bounds);

            gridCellInfo1.Bounds        = targetRect;
            gridCellInfo1.CellValueRect = targetRect;
            gridCellInfo2.Bounds        = targetRect;
            gridCellInfo2.CellValueRect = targetRect;
            if (delta < 0)
            {
                gridCellInfo1 = gridCellInfo2;
            }
            Rectangle bounds = gridCellInfo1.ViewInfo.Bounds;

            bounds.Width  = targetRect.Width;
            bounds.Height = targetRect.Height;
            gridCellInfo1.ViewInfo.Bounds = bounds;
            gridCellInfo1.ViewInfo.CalcViewInfo(e.Cache.Graphics);
            IsCustomPainting = true;
            gridCellInfo1.Appearance.FillRectangle(e.Cache, gridCellInfo1.Bounds);
            DrawRowCell(new GridViewDrawArgs(e.Cache, vi, vi.ViewRects.Bounds), gridCellInfo1);
            IsCustomPainting = false;
        }
 protected override void UpdateCellAppearanceCore(GridCellInfo cell, bool allowCache = true, bool allowCondition = true, AppearanceObjectEx cellCondition = null)
 {
     base.UpdateCellAppearanceCore(cell, allowCache, allowCondition, cellCondition);
     if (cell.IsDataCell)
     {
         if ((cell.State & GridRowCellState.FocusedCell) == 0 || !View.IsEditing)
         {
             AppearanceObjectEx condition     = null;
             AppearanceObject   priorityStyle = ((CustomGridView)View).GetPriorityRowCellStyle(cell, cell.Appearance);
             if (priorityStyle != cell.Appearance)
             {
                 if (!((CustomGridView)View).OverrideFormatCondition)
                 {
                     condition = cell.RowInfo.ConditionInfo.GetCellAppearance(cell.Column);
                     if (condition != null)
                     {
                         priorityStyle = MergeAppearences(priorityStyle, condition, cell.Appearance);
                     }
                 }
                 cell.Appearance = priorityStyle;
             }
         }
     }
 }
Esempio n. 6
0
        public Cursor GetDragCellCursor(GridHitInfo hitInfo, Point e)
        {
            GridViewInfo info     = _View.GetViewInfo() as GridViewInfo;
            GridCellInfo cellinfo = info.GetGridCellInfo(hitInfo);

            Rectangle imageBounds = new Rectangle(new Point(0, 0), cellinfo.Bounds.Size);
            Rectangle totalBounds = new Rectangle(new Point(0, 0), info.Bounds.Size);
            Bitmap    bitmap      = new Bitmap(totalBounds.Width, totalBounds.Height);

            DevExpress.Utils.Drawing.GraphicsCache cache = new DevExpress.Utils.Drawing.GraphicsCache(Graphics.FromImage(bitmap));
            GridViewDrawArgs args = new GridViewDrawArgs(cache, info, totalBounds);

            base.DrawRowCell(args, cellinfo);

            Bitmap   result         = new Bitmap(imageBounds.Width, imageBounds.Height);
            Graphics resultGraphics = Graphics.FromImage(result);

            float[][] matrixItems =
            {
                new float[] { 1, 0, 0,    0, 0 },
                new float[] { 0, 1, 0,    0, 0 },
                new float[] { 0, 0, 1,    0, 0 },
                new float[] { 0, 0, 0, 0.7f, 0 },
                new float[] { 0, 0, 0,    0, 1 }
            };
            ColorMatrix     colorMatrix     = new ColorMatrix(matrixItems);
            ImageAttributes imageAttributes = new ImageAttributes();

            imageAttributes.SetColorMatrix(
                colorMatrix,
                ColorMatrixFlag.Default,
                ColorAdjustType.Bitmap);
            resultGraphics.DrawImage(bitmap, imageBounds, cellinfo.Bounds.X, cellinfo.Bounds.Y, cellinfo.Bounds.Width, cellinfo.Bounds.Height, GraphicsUnit.Pixel, imageAttributes);
            resultGraphics.DrawIcon(Icon.FromHandle(Cursors.Default.Handle), 0, 0);
            return(CreateCursor(result));
        }
 public CustomDrawLineEventArgs(GraphicsCache cache, AppearanceObject appearance, Rectangle bounds, GridCellInfo cellInfo)
 {
     this.cache      = cache;
     this.bounds     = bounds;
     this.cellInfo   = cellInfo;
     this.appearance = appearance;
 }
Esempio n. 8
0
 protected internal void GoAndUpdateCellAppearanceCore(GridCellInfo cell)
 {
     base.UpdateCellAppearanceCore(cell);
 }
 internal GridCellElement(IntPtr windowHandle, GridCellInfo cellInfo, GridTechnologyManager manager)
     : base(windowHandle, manager)
 {
     this.CellInfo = cellInfo;
 }
 public void DefaultDrawContent(RowCellCustomDrawEventArgs e)
 {
     GridCellInfo cellInfo = e.Cell as GridCellInfo;
     _ContainerHelper.DrawCellEdit(new GraphicsInfoArgs(e.Cache, e.Bounds), cellInfo.Editor, cellInfo.ViewInfo, e.Appearance, cellInfo.CellValueRect.Location);
 }
Esempio n. 11
0
		private void GridView_MouseUp_Callback(object state)
		{
			ColumnMapMsx cm;
			QueryColumn qc;
			QnfEnum subColumn;
			DialogResult dr;
			string newSpotfireName;

			MouseEventArgs e = state as MouseEventArgs;

			if (e == null) return;

			Point p = new Point(e.X, e.Y);

			GridHitInfo gridHitInfo = FieldGridView.CalcHitInfo(p);
			GridViewInfo gridViewInfo = FieldGridView.GetViewInfo() as GridViewInfo;
			GridCellInfo gridCellInfo = gridViewInfo.GetGridCellInfo(gridHitInfo);

			int ri = gridHitInfo.RowHandle;
			if (ri < 0) return;
			GridColumn gc = gridHitInfo.Column;
			if (gc == null) return;
			int c = gc.AbsoluteIndex;

			if (SelectSingleColumn) // just do a simple single column selection
			{
				UpdateSelectSingleColumnData(ri);
				return;
			}

			DataRow dRow = FieldDataTable.Rows[ri];

			//DataMap.ColumnMapList.Items[ri];

			cm = dRow["ColumnMapMsxRefField"] as ColumnMapMsx; // get ColumnMap for current item

			if (cm == null) throw new Exception("Null ColumnMapMsxRefField");
			//if (cm == null) qc = null;
			//else qc = cm.QueryColumn;

			qc = cm.QueryColumn;
			subColumn = cm.SubColumn;

			// Rename column

			if (gc == SpotfireColNameCol)
			{
				RenameColumn(ri);
				return;
			}

			// Commands checked below are only available if editing of the mapping is allowed

			if (!CanEditMapping) return;

			// Select which Mobius column maps to a Spotfire Column

			if (gc == MobiusTableNameCol || gc == MobiusColNameCol) // select Mobius column to match if defining mapping
			{
				string role = dRow["OriginalSpotfireColNameField"] as string;
				if (Lex.IsUndefined(role)) return; // can only assign cols with "roles" from the original template analysis

				string spotfireName = "";
				FieldSelectorControl fieldSelector = new FieldSelectorControl();
				fieldSelector.QueryColumn = qc;

				SelectColumnOptions flags = new SelectColumnOptions();
				flags.ExcludeImages = true;
				flags.FirstTableKeyOnly = true;
				flags.SelectFromQueryOnly = true;
				flags.QnSubcolsToInclude = QnfEnum.Split | QnfEnum.Qualifier | QnfEnum.NumericValue | QnfEnum.NValue; // split QualifiedNumbers
				flags.IncludeNoneItem = true;

				flags.AllowedDataTypes = DataTableMapMsx.GetMetaColumnTypesCompatibleWithSpotfireColumn(cm.SpotfireColumn, allowCompoundId: (ri == 0));

				p = FieldGrid.PointToScreen(p);
				if (CurrentMap.QueryTable != null) // select from single query table only
					dr = fieldSelector.SelectColumnFromQueryTable(CurrentMap.QueryTable, qc, flags, p.X, p.Y, out qc, out subColumn);

				else // select from any table in the query
					dr = fieldSelector.SelectColumnFromQuery(Query, qc, flags, p.X, p.Y, out qc, out subColumn);

				if (dr != DialogResult.OK) return;

				cm.QueryColumn = qc; // new query column mapped to

				if (qc != null) // assigning a new QueryColumn 
				{
					dRow["MobiusTableNameField"] = qc.QueryTable.ActiveLabel;
					dRow["MobiusColNameField"] = qc.ActiveLabel;

					newSpotfireName = CurrentMap.AssignUniqueSpotfireColumnName(qc.ActiveLabel);
					dRow["SpotfireColNameField"] = newSpotfireName; // update grid

					cm.SpotfireColumnName = newSpotfireName; // store new name

					//if (Lex.Ne(cm.SpotfireColumnName, newSpotfireName)) // changing name?
					//{
					//	cm.NewSpotfireColumnName = newSpotfireName; // store new name
					//}

					cm.MobiusFileColumnName = qc.MetaTableDotMetaColumnName + ColumnMapParms.SpotfireExportExtraColNameSuffix;
				}

				else // set to none (e.g. null col)
				{
					dRow["MobiusTableNameField"] = "";
					dRow["MobiusColNameField"] = "";

					newSpotfireName = CurrentMap.AssignUniqueSpotfireColumnName("None");
					dRow["SpotfireColNameField"] = newSpotfireName; // update grid
					cm.SpotfireColumnName = newSpotfireName; // update map
					//cm.NewSpotfireColumnName = newSpotfireName; // update map

					cm.MobiusFileColumnName = ""; // not mapped to a col
				}

				FieldGrid.RefreshDataSource();

				SVM.RemapDataTable(CurrentMap); // update spotfire view accordingly

				UpdateFieldGridDataTable();

				cm.NewSpotfireColumnName = ""; // clear new name used for rename (needed?)
			}

			return;
		}
Esempio n. 12
0
        private void lstDataView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            if (e.Column.Caption == "报警")
            {
                int rowhandle = e.RowHandle;
                if (lstDataView.GetRow(rowhandle) != null)
                {
                    string strcolors = lstDataView.GetRowCellValue(rowhandle, "Colors").ToString();
                    if (!string.IsNullOrEmpty(strcolors))
                    {
                        string[]   cols    = strcolors.Split(',');
                        List <int> lstcols = new List <int>();
                        if (cols != null && cols.Length > 0)
                        {
                            for (int i = 0; i < cols.Length; i++)
                            {
                                if (!string.IsNullOrEmpty(cols[i].Trim()))
                                {
                                    lstcols.Add(Convert.ToInt32(cols[i]));
                                }
                            }
                        }

                        if (lstcols.Count > 0)
                        {
                            e.Handled = true;
                            int width = (int)(e.Bounds.Width / lstcols.Count);

                            for (int i = 0; i < lstcols.Count; i++)
                            {
                                Rectangle rect = new Rectangle(e.Bounds.X + width * i, e.Bounds.Y, width, e.Bounds.Height);
                                Brush     b    = new SolidBrush(Colors[lstcols[i]]);
                                e.Graphics.FillRectangle(b, rect);
                            }

                            GridCellInfo    cell   = e.Cell as GridCellInfo;
                            Point           offset = cell.CellValueRect.Location;
                            BaseEditPainter pb     = cell.ViewInfo.Painter as BaseEditPainter;
                            if (!offset.IsEmpty)
                            {
                                cell.ViewInfo.Offset(offset.X, offset.Y);
                            }
                            try
                            {
                                pb.Draw(new ControlGraphicsInfoArgs(cell.ViewInfo, e.Cache, cell.Bounds));
                            }
                            finally
                            {
                                if (!offset.IsEmpty)
                                {
                                    cell.ViewInfo.Offset(-offset.X, -offset.Y);
                                }
                            }
                        }
                        else
                        {
                            e.Appearance.BackColor = cDefault;
                        }
                    }
                    else
                    {
                        e.Appearance.BackColor = cDefault;
                    }
                }
            }
        }
Esempio n. 13
0
        private void ColGridView_MouseDown(object sender, MouseEventArgs e)
        {
            Point     p;
            Rectangle rect;
            string    txt;
            int       qtCi, ri, ci;

            if (View == null)
            {
                return;
            }
            p = new Point(e.X, e.Y);
            GridHitInfo ghi = View.CalcHitInfo(p);

            if (ghi == null)
            {
                return;
            }
            ri = ghi.RowHandle;

            if (ghi.Column == null)
            {
                return;
            }
            GridColumn gc = ghi.Column;

            GridViewInfo viewInfo = View.GetViewInfo() as GridViewInfo;
            GridCellInfo gci      = viewInfo.GetGridCellInfo(ghi);

            if (gci == null)
            {
                return;
            }

            ri = ghi.RowHandle;
            if (ri == GridControl.NewItemRowHandle)             // click in virtual new row?
            {
                DataRow dr = ColGridDataTable.NewRow();
                ColGridDataTable.Rows.Add(dr);

                DelayedCallback.Schedule(ClickedInNewRow, gc);                 // schedule callback for after grid rendered with new row
                return;
            }

            if (ri >= ColGridDataTable.Rows.Count)
            {
                return;
            }

            CurrentRow = ri;

            if (Lex.Eq(gc.Name, "CustomFormat"))             // Show format col
            {
                MetaColumn mc = GetMetaColumnFromColGridDataTableRow(ColGridDataTable.Rows[ri]);
                if (mc == null)
                {
                    return;
                }

                ColumnFormattingContextMenu.Show(ColGrid, p);
                this.Refresh();
                return;
            }

            return;
        }
Esempio n. 14
0
        public void DrawMergedCell(MyMergedCell cell, PaintEventArgs e)
        {
            int delta = cell.Column1.VisibleIndex - cell.Column2.VisibleIndex;

            if (Math.Abs(delta) > 1)
            {
                return;
            }
            GridViewInfo vi            = View.GetViewInfo() as GridViewInfo;
            GridCellInfo gridCellInfo1 = vi.GetGridCellInfo(cell.RowHandle, cell.Column1);
            GridCellInfo gridCellInfo2 = vi.GetGridCellInfo(cell.RowHandle, cell.Column2);

            if (gridCellInfo1 != null && gridCellInfo2 == null)
            {
                gridCellInfo2 = gridCellInfo1;
            }
            if (gridCellInfo1 == null || gridCellInfo2 == null)
            {
                return;
            }
            Rectangle targetRect = Rectangle.Union(gridCellInfo1.Bounds, gridCellInfo2.Bounds);

            gridCellInfo1.Bounds        = targetRect;
            gridCellInfo1.CellValueRect = targetRect;
            gridCellInfo2.Bounds        = targetRect;
            gridCellInfo2.CellValueRect = targetRect;
            if (delta < 0)
            {
                gridCellInfo1 = gridCellInfo2;
            }
            if (gridCellInfo1.ViewInfo == null)
            {
                return;
            }
            int       prevX  = gridCellInfo1.Bounds.X;
            Rectangle bounds = gridCellInfo1.ViewInfo.Bounds;

            bounds.Width  = targetRect.Width;
            bounds.Height = targetRect.Height;
            gridCellInfo1.ViewInfo.Bounds = bounds;
            gridCellInfo1.ViewInfo.CalcViewInfo(e.Graphics);
            IsCustomPainting = true;
            GraphicsCache cache = new GraphicsCache(e.Graphics);
            int           width = gridCellInfo1.Bounds.Width;

            if (gridCellInfo1.Bounds.Right >= vi.View.GridControl.Width)
            {
                width -= gridCellInfo1.Bounds.Right - vi.View.GridControl.Width + 2;
            }

            int cellX        = 0;
            int columnIndent = vi.ColumnsInfo[0].Type == GridColumnInfoType.Indicator ? vi.ColumnsInfo[0].Bounds.Right : vi.ColumnsInfo[0].Bounds.X;

            cellX = Math.Max(gridCellInfo1.Bounds.X, columnIndent);
            if (vi.View.OptionsView.ShowIndicator && gridCellInfo1.Bounds.X < vi.ViewRects.IndicatorWidth)
            {
                width += gridCellInfo1.Bounds.X - vi.ViewRects.IndicatorWidth - 1;
            }
            gridCellInfo1.Bounds = new Rectangle(cellX, gridCellInfo1.Bounds.Y, width, gridCellInfo1.Bounds.Height);

            gridCellInfo1.Appearance.FillRectangle(cache, gridCellInfo1.Bounds);
            gridCellInfo1.CellValueRect.Location = new Point(gridCellInfo1.CellValueRect.Location.X + gridCellInfo1.Bounds.X - prevX, gridCellInfo1.CellValueRect.Location.Y);
            DrawRowCell(new GridViewDrawArgs(cache, vi, vi.ViewRects.Bounds), gridCellInfo1);
            IsCustomPainting = false;;
        }
Esempio n. 15
0
        /// <summary>
        /// 向上查找输入的信息
        /// </summary>
        private void btnExpand_Click(object sender, EventArgs e)
        {
            try
            {
                if (textContent.Text.Trim() == "")
                {
                    return;
                }

                if (browseXtraGridView.DataRowCount == 0 || browseXtraGridView.Columns.Count == 0)
                {
                    MessageHandler.ShowMessageBox("请查询信息后再进行查找定位操作。");
                    return;
                }

                int locationRowNo    = browseXtraGridView.FocusedRowHandle;
                int locationColumnNo = browseXtraGridView.FocusedColumn.AbsoluteIndex;

                textContent.Focus();
                browseXtraGridView.Focus();
                for (int i = locationRowNo; i >= 0; i--)
                {
                    for (int j = locationColumnNo - 1; j >= 0; j--)
                    {
                        if (!browseXtraGridView.Columns[j].Visible)
                        {
                            continue;
                        }
                        string cellValue = DataTypeConvert.GetString(browseXtraGridView.GetRowCellDisplayText(i, browseXtraGridView.Columns[j]));
                        if (cellValue.Contains(textContent.Text.Trim()))
                        {
                            browseXtraGridView.FocusedRowHandle = i;
                            browseXtraGridView.FocusedColumn    = browseXtraGridView.Columns[j];

                            GridViewInfo    vi      = browseXtraGridView.GetViewInfo() as GridViewInfo;
                            GridDataRowInfo rowInfo = vi.RowsInfo.GetInfoByHandle(i) as GridDataRowInfo;
                            if (rowInfo == null || rowInfo.Cells.Count == 0)
                            {
                                continue;
                            }
                            GridCellInfo cellInfo = rowInfo.Cells[0];
                            if (cellInfo != null)
                            {
                                cellInfo.State = GridRowCellState.FocusedCell;
                            }
                            return;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    locationColumnNo = browseXtraGridView.Columns.Count;
                }

                MessageHandler.ShowMessageBox(string.Format("向上未查询到包含【{0}】的记录。", textContent.Text.Trim()));
            }
            catch (Exception ex)
            {
                //ExceptionHandler.HandleException(this.Text + "--向上查找输入的信息错误。", ex);
                ExceptionHandler.HandleException(this.Text + "--" + f.tsmiXsczsrdxxcw.Text, ex);
            }
        }
 protected internal virtual AppearanceObject GetPriorityRowCellStyle(GridCellInfo cellInfo, AppearanceObject appearance)
 {
     return(RaisePriorityRowCellStyle(cellInfo, appearance, false));
 }
 protected internal void SetCellInfo(GridCellInfo cellInfo)
 {
     this.cellInfo = cellInfo;
 }
Esempio n. 18
0
 public SmartIconSelectionEventArgs(Image image, GridCellInfo cellInfo, bool isActiveEditor)
     : base(image)
 {
     this.cellInfo       = cellInfo;
     this.isActiveEditor = isActiveEditor;
 }
 public OnSmartIconSelectionEventArgs(object iconCollection, int iconIndex, GridCellInfo cellInfo, bool isActiveEditor)
     : base(iconCollection, iconIndex)
 {
     this.cellInfo       = cellInfo;
     this.isActiveEditor = isActiveEditor;
 }
Esempio n. 20
0
        public DialogResult ShowKeyboard(GridView view, int rowhandle, int columnindex)
        {
            if (view == null)
            {
                return(DialogResult.Abort);
            }

            DataRowView dr = (DataRowView)view.GetRow(rowhandle);

            DevExpress.XtraGrid.Columns.GridColumn col = view.Columns[columnindex];
            Type   type  = col.ColumnType;
            object value = dr[columnindex];

            GridViewInfo info = (GridViewInfo)view.GetViewInfo();
            //GridCellInfo cell = info.GetGridCellInfo(rowhandle, col);
            GridCellInfo cell = info.GetGridCellInfo(rowhandle, col.AbsoluteIndex); //Tuugii
            Rectangle    r;

            if (cell != null)
            {
                r = cell.Bounds;
            }
            else
            {
                r = Rectangle.Empty;
            }

            DialogResult res = DialogResult.OK;

            switch (type.Name)
            {
            case "String":
                frmKeyboard frm1 = new frmKeyboard(null);
                frm1.Location = GetVisiblePosition(r, frm1);
                frm1.Value    = value == null ? "" : Convert.ToString(value);
                res           = frm1.ShowDialog();
                if (res == DialogResult.OK)
                {
                    view.SetRowCellValue(rowhandle, col, frm1.Value);
                }
                break;

            case "DateTime":
                frmDatepad frm2 = new frmDatepad(null);
                frm2.Location = GetVisiblePosition(r, frm2);
                frm2.Value    = value == null ? DateTime.Today : Convert.ToDateTime(value);
                res           = frm2.ShowDialog();
                if (res == DialogResult.OK)
                {
                    view.SetRowCellValue(rowhandle, col, frm2.Value);
                }
                break;

            default:
                frmNumpad frm3 = new frmNumpad(null);
                frm3.Location = GetVisiblePosition(r, frm3);
                frm3.Value    = value == null ? 0 : Convert.ToDecimal(value);

                res = frm3.ShowDialog();
                if (res == DialogResult.OK)
                {
                    view.SetRowCellValue(rowhandle, col, frm3.Value);
                }
                break;
            }
            return(res);
        }
Esempio n. 21
0
        protected override GridCellInfo CalcRowCellDrawInfoCore(GridDataRowInfo ri, GridColumnInfoArgs ci, GridCellInfo cell, GridColumnInfoArgs nextColumn, bool calcEditInfo, GridRow nextRow, bool allowCache, Rectangle cellBounds)
        {
            GridCellInfo result;

            result = base.CalcRowCellDrawInfoCore(ri, ci, cell, nextColumn, calcEditInfo, nextRow, allowCache, cellBounds);
            if (result.CellButtonRect == Rectangle.Empty)
            {
                return(result);
            }

            MyGridView view = View as MyGridView;

            if (view == null)
            {
                return(result);
            }


            if (view.OptionsView.DetailButtonsVAlignment == VertAlignment.Top)
            {
                result.CellButtonRect.Y = result.CellValueRect.Y + CellVertIndent + CellValueVIndent;
                return(result);
            }

            if (view.OptionsView.DetailButtonsVAlignment == VertAlignment.Bottom)
            {
                result.CellButtonRect.Y = result.CellValueRect.Bottom - result.CellButtonRect.Height - CellVertIndent - CellValueVIndent;
                return(result);
            }
            return(result);
        }
        private void OnGridViewCustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (selectedArea.X == int.MaxValue)
            {
                return;
            }
            Rectangle drawingArea = Rectangle.Empty;

            if (e.RowHandle == selectedArea.Top && IsPointInRange(e.Column.VisibleIndex, false))
            {
                drawingArea = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, selectionBorderWidth);
                if (e.Column.VisibleIndex == selectedArea.Left)
                {
                    drawingArea.X     += selectionBorderWidth;
                    drawingArea.Width -= selectionBorderWidth;
                }
            }
            if (drawingArea != Rectangle.Empty)
            {
                DrawArea(e.Cache, drawingArea);
                drawingArea = Rectangle.Empty;
            }
            if (e.RowHandle == selectedArea.Bottom && IsPointInRange(e.Column.VisibleIndex, false))
            {
                drawingArea = new Rectangle(e.Bounds.X, e.Bounds.Bottom - selectionBorderWidth, e.Bounds.Width, selectionBorderWidth);
                if (e.Column.VisibleIndex == selectedArea.Right)
                {
                    drawingArea.Width -= selectionBorderWidth;
                }
            }
            if (drawingArea != Rectangle.Empty)
            {
                DrawArea(e.Cache, drawingArea);
                drawingArea = Rectangle.Empty;
            }
            if (e.Column.VisibleIndex == selectedArea.Left && IsPointInRange(e.RowHandle, true))
            {
                drawingArea = new Rectangle(e.Bounds.X, e.Bounds.Y, selectionBorderWidth, e.Bounds.Height);
                if (e.RowHandle == selectedArea.Bottom)
                {
                    drawingArea.Height -= selectionBorderWidth;
                }
            }
            if (drawingArea != Rectangle.Empty)
            {
                DrawArea(e.Cache, drawingArea);
                drawingArea = Rectangle.Empty;
            }
            if (e.Column.VisibleIndex == selectedArea.Right && IsPointInRange(e.RowHandle, true))
            {
                drawingArea = new Rectangle(e.Bounds.Right - selectionBorderWidth, e.Bounds.Y, selectionBorderWidth,
                                            e.Bounds.Height);
                if (e.RowHandle == selectedArea.Top)
                {
                    drawingArea.Y      += selectionBorderWidth;
                    drawingArea.Height -= selectionBorderWidth;
                }
            }
            if (drawingArea != Rectangle.Empty)
            {
                DrawArea(e.Cache, drawingArea);
            }
            if (IsPointInRange(e.RowHandle, true) && IsPointInRange(e.Column.VisibleIndex, false))
            {
                GridCellInfo info = e.Cell as GridCellInfo;
                e.Appearance.DrawString(e.Cache, e.DisplayText, info.CellValueRect);
                e.Handled = true;
            }
        }