[DotNetBar] ToolTip

2012. 7. 11. 14:35C#/DotNetBar

If you need to show custom tooltip for Appointments in WinForms (Windows Forms) CalendarView control you can do so by handling CalendarView.MouseEnter event to show tooltip and CalendarView.MouseLeave to hide tooltip. Following code illustrates how to show custom Balloon style tooltip:


private Balloon _AppointmentBalloon = null;
 
private void SetupAppointmentBalloon()
{
    _AppointmentBalloon = new Balloon();
    _AppointmentBalloon.AutoCloseTimeOut = 10;
    _AppointmentBalloon.Owner = this;
}
private void calendarView1_MouseEnter(object sender, EventArgs e)
{
    AppointmentView view = sender as AppointmentView;
    if (view == null) return;
 
    if (_AppointmentBalloon == null) SetupAppointmentBalloon();
 
    _AppointmentBalloon.CaptionText = "Balloon for Appointment";
    _AppointmentBalloon.Text = "This is custom balloon for my appointment: "
 + view.Appointment.Subject;
    _AppointmentBalloon.AutoResize();
    _AppointmentBalloon.Show(view, false);
}
 
private void calendarView1_MouseLeave(object sender, EventArgs e)
{
    if (_AppointmentBalloon != null && _AppointmentBalloon.Visible)
        _AppointmentBalloon.Hide()
} 


출처: http://www.devcomponents.com/kb2/?p=915