本文介绍了[已解决]使IDataGridViewEditingControl在DataGridViewCell外部显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.
我想做一个像DataGridViewNumericUpDownCell
这样的自定义DataGridViewCell
我有以下课程:

Hi.
I want to make a custom DataGridViewCell like a DataGridViewNumericUpDownCell

I have the following classes:

public class DataGridViewNumericUpDownColumn : DataGridViewTextBoxColumn
{
    //...
}
public class DataGridViewNumericUpDownCell : DataGridViewTextBoxCell
{
    //...
}
class NumericEditingControl : NumericUpDown, IDataGridViewEditingControl
{
    //...
}



一切工作都很好,除了编辑控件不会扩展到单元格边界之外.我该怎么办?

此图像可以使您更好地理解我的问题: http://yfrog.com/12idatagridvieweditingconj



Everything works great, except for the fact that the editing control doesn''t expand beyond the cell bounds. How could I do this?

This image can make you better understand my issue: http://yfrog.com/12idatagridvieweditingconj

推荐答案

public override void PositionEditingControl(bool setLocation, bool setSize, System.Drawing.Rectangle cellBounds, System.Drawing.Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow)
{
    cellBounds = new System.Drawing.Rectangle(cellBounds.X, cellBounds.Y, cellBounds.Width + 16, cellBounds.Height);
    cellClip = new System.Drawing.Rectangle(cellClip.X, cellClip.Y, cellClip.Width + 16, cellClip.Height);
    base.PositionEditingControl(true, true, cellBounds, cellClip, cellStyle, singleVerticalBorderAdded, singleHorizontalBorderAdded, isFirstDisplayedColumn, isFirstDisplayedRow);
}


这篇关于[已解决]使IDataGridViewEditingControl在DataGridViewCell外部显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 07:40