1

この例に従う:

http://msdn.microsoft.com/en-us/library/7tas5c80.aspx

ただし、実行時にDataGridViewに行を追加して表示すると、CalendarColumnを含む列はクリックするまで空白になります。次に、他の場所をクリックするとすぐに、列が再び空白になります。そのため、操作している正確な瞬間にのみ表示されます。

これを引き起こしている可能性のあるアイデアはありますか?

編集:コードの関連部分のみ。残りはデザイナーを通して行われます。

        private void LoadScheduleView()
    {
        // Get the keys
        var scheduleNames = _schedules.Current.Keys;

        // Get the current scheduled objects based on the keys (layoutnames).
        foreach (var scheduleName in scheduleNames)
        {
            var schedule = _schedules.Current[scheduleName];
            // Add the already existing schedule to the data grid view.
            schedulesDataGrid.Rows.Add(schedule.Date, schedule.Layout, schedule.CloseAllWindows);
        }
        //schedulesDataGrid.Sort(schedulesDataGrid.Columns[0], ListSortDirection.Ascending);

        DateTime scheduledTime = new DateTime();
        var rowsToLoop = schedulesDataGrid.Rows;
        foreach (DataGridViewRow row in rowsToLoop)
        {
            scheduledTime = (DateTime)row.Cells[0].Value;

            if (scheduledTime < DateTime.Now)
            {
                schedulesDataGrid.Rows.Remove(row);
            }

            //This will happen in sorted list order, therefore the first time it's after DateTime.Now, it will be the next layout to launch.
            else
            {
                var indexOfNextSchedule = schedulesDataGrid.Rows.IndexOf(row);
                schedulesDataGrid.FirstDisplayedScrollingRowIndex = indexOfNextSchedule;
                //schedulesDataGrid.Rows[indexOfNextSchedule].Selected = true;
                break;
            }
        }  
    }
4

1 に答える 1

1

問題は、が派生したものであり、CalendarCell派生したものではDataGridViewCellないという事実にあるようDataGridViewTextBoxCellです。これによりさらに問題が発生することがわかった場合は、報告します...

于 2012-09-14T16:15:01.300 に答える