AppointmentViewInfo.ConvertToVisualBounds(Rectangle) Method

Converts coordinates of the rectangle specifying ViewInfo item bounds to the client coordinates that are relative to the upper-left corner of the visible area of the Scheduler view.

Namespace: DevExpress.XtraScheduler.Drawing

Assembly: DevExpress.XtraScheduler.v20.2.dll


public virtual Rectangle ConvertToVisualBounds(
    Rectangle bounds
Public Overridable Function ConvertToVisualBounds(
    bounds As Rectangle
) As Rectangle


Name Type Description
bounds Rectangle

A Rectangle object which is the appointment's bounding rectangle in the client coordinate system (in pixels).


Type Description

A Rectangle object which is the appointment's bounding rectangle in the Scheduler view coordinate system (in pixels).


This example illustrates how to handle the SchedulerControl's MouseUp event and use the SchedulerViewInfoBase.CalcHitInfo method to determine the visual element being clicked. If an appointment is hit, the method returns the AppointmentViewInfo object. To obtain the element under the mouse cursor, the AppointmentViewInfo.Items collection is analyzed. The coordinates provided by the Bounds property of a collection item are mapped to the coordinate system used in mouse events and subsequently compared with the cursor position.

private void schedulerControl1_MouseUp(object sender, MouseEventArgs e) {
    if (e.Button == System.Windows.Forms.MouseButtons.Left) {
        SchedulerViewInfoBase viewInfo = schedulerControl1.ActiveView.ViewInfo;
        SchedulerHitInfo hitInfo = viewInfo.CalcHitInfo(e.Location, false);
        if (hitInfo.HitTest == SchedulerHitTest.AppointmentContent) {
            AppointmentViewInfo info = (AppointmentViewInfo)hitInfo.ViewInfo;
            foreach (ViewInfoItem item in info.Items) {
                ViewInfoImageItem imageItemInfo = item as ViewInfoImageItem;
                if (imageItemInfo == null)
                Rectangle itemBounds = info.ConvertToVisualBounds(item.Bounds);
                if (itemBounds.Contains(e.Location)) {
                    using(var mb = new MyMessageBox(((ViewInfoImageItem)item).Image, "Got it!"))
See Also