We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

metroform: button label on the form bar

 how to mimic the button label (file/studio/tools/help/updates) with metroform (or normal form)? (like in syncfusion control panel)
i need change color when mouse is over one of the captionlabel and if i click on it get event? is possible?

thanks

1 Reply

KR Kannan R Syncfusion Team October 25, 2017 06:59 AM UTC

Hi Mauro   
   
Thank you for contacting Syncfusion support.    
   
Yes, this reported requirement can be achieved by using Caption Label and its Mouse events in MetroForm. Please refer to below code example for your reference.   
 
Code snippet: [C#] 
 
 
                // Caption labels 
 
        for (int i = 0; i < this.CaptionLabels.Count; i++) 
        { 
              CaptionLabel item = this.CaptionLabels[i]; 
             item.LabelMouseEnter += new CaptionLabel.MouseEnter(item_LabelMouseEnter); 
             item.LabelMouseLeave += new CaptionLabel.MouseLeave(item_LabelMouseLeave); 
             item.LabelMouseDown += new CaptionLabel.MouseDown(item_LabelMouseDown); 
        } 
 
        /// <summary> 
        /// Occurs on Mouse Pointer down 
        /// </summary> 
        void item_LabelMouseDown(object sender, LabelMouseDownEventArgs e) 
        { 
            if ((sender as CaptionLabel) != null) 
            { 
                MessageBox.Show((sender as CaptionLabel).Text + " :" + "is Clicked"); 
            } 
        } 
 
        /// <summary> 
        /// Occurs on Mouse Pointer Leave 
        /// </summary> 
        void item_LabelMouseLeave(object sender, LabelMouseLeaveEventArgs e) 
        { 
            if ((sender as CaptionLabel) != null) 
            { 
                (sender as CaptionLabel).ForeColor = Color.White; 
            } 
        } 
 
        /// <summary> 
        /// Occurs on Mouse Pointer Enter 
        /// </summary> 
        void item_LabelMouseEnter(object sender, LabelMouseEnterEventArgs e) 
        { 
            if ((sender as CaptionLabel) != null) 
            { 
                (sender as CaptionLabel).ForeColor = Color.Yellow; 
            } 
        } 
 
 
Screenshot 
 
 
 
 
Kindly check with above solution and let us know if it is helpful. 
 
Regards 
Kannan 


Loader.
Live Chat Icon For mobile
Up arrow icon