Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
495
FormattedTextEditor - Check for image on click
posted

Is there a way to know if the user has clicked or right-clicked on an image in the FormattedTextEditor ?

 

Thanks

  • 4940
    Offline posted

    Use the MouseDown event of the UltraFormattedTextEditor, with code such as this:

     

    private void txtFormatted_MouseDown(object sender, MouseEventArgs e)
    {
        if (!(txtFormatted.UIElement.ElementFromPoint(e.Location) is ImageUIElement))
            return;
    
        if (e.Button == System.Windows.Forms.MouseButtons.Left)
        {
            MessageBox.Show("Left mouse down over image.");
        }
        else if (e.Button == System.Windows.Forms.MouseButtons.Right)
        {
            MessageBox.Show("Right mouse down over image.");
        }
    }