Skip to main content
A newer version of this page is available. .

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.v18.2.dll

Declaration

public virtual Rectangle ConvertToVisualBounds(
    Rectangle bounds
)

Parameters

Name Type Description
bounds Rectangle

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

Returns

Type Description
Rectangle

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

Example

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)
                    continue;
                Rectangle itemBounds = info.ConvertToVisualBounds(item.Bounds);
                if (itemBounds.Contains(e.Location)) {
                    MyMessageBox mb = new MyMessageBox(((ViewInfoImageItem)item).Image, "Got it!");
                    mb.ShowDialog();
                }
            }
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ConvertToVisualBounds(Rectangle) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also