从Point获取行信息(CalcHitInfo,GridHitInfo,GridHitTest)

时间:2012-12-27 14:07:16

标签: c# winforms devexpress xtragrid

我的代码有问题,不会发送包含按下按钮的行的信息:

//This is the code that creates the button in the column.
else if (e.Column.Name == ActivePrescriptionGridFindReplaceButton.Name) {
    GetGridButton(true, "Replace", PrescriptionGridFindReplaceButton_Click, e);
}

//This is my event, (GetGridButton is a function that make this an event)
void PrescriptionGridFindReplaceButton_Click(object sender, ButtonPressedEventArgs e) {
    //My point have the information, it works and gives the correct coordinates
    DoShowMenu(ActivePrescriptionsGridView.CalcHitInfo(m_Point), MenuMode.Replace);
}

//This receives the information  
void DoShowMenu(DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi, MenuMode mode) {
    //Here the hi.HitTest says that does not have a value (NONE)
    if (hi.HitTest == DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitTest.RowCell) {
        //So RxMedication take the value of NULL    
        PatientPrescriptionEntity RxMedication = ActivePrescriptionsGridView.GetRow(hi.RowHandle) as PatientPrescriptionEntity;
        //Gets out of the event
        if (RxMedication != null) {
            RenewMenu menu = new RenewMenu(ActivePrescriptionsGridView, RxMedication, mode);
            menu.Init(hi);
            menu.OnReplaceMedication += menu_OnReplaceMedication;
            menu.Show(hi.HitPoint);
        }
    }
}  

有人有想法吗?请帮我 还有另一种方法吗?
我做错了什么?...

0 个答案:

没有答案