[Solved] - How to Change arrowbutton to normal button?
Hi,
after setting arrowbutton image I want to delete the arrow, How i can do this?
Thanks!
SIGN IN To post a reply.
5 Replies
SS
Susmitha Sundar
Syncfusion Team
May 28, 2020 12:19 PM UTC
Hi Khanh Dang,
Thank you for using Syncfusion controls.
We are not clear with your requirement. Can you please provide the below things?
1. Which control you are using?
2. Which place or property you set the arrow image?
3. Please provide any image reference.
It will be helpful for us to check on it and provide you the solution at the earliest.
Regards,
Susmitha S
TG
The GridLock
May 29, 2020 08:38 AM UTC
Hi, 
i want to remove this arrow and replace by another image or any char !
Edit: oops, Sorry.
maybe I didn't pay attention when choosing topic, it was about combobox!
NI
Ninja
Syncfusion Team
May 29, 2020 10:13 AM UTC
Hi Khanh,
Thanks for your update.
We have checked your query “Need to change the drop down button image of SfComboBox” and it can be achieved by using the Paint event of DropDown button in SfComboBox control. Please refer the below code snippet for same.
C# for Drawing char:
|
public Form1()
{
InitializeComponent();
sfComboBox1.DropDownButton.Paint += DropDownButton_Paint;
}
private void DropDownButton_Paint(object sender, PaintEventArgs e)
{
Font myFont = new System.Drawing.Font("Helvetica",16, FontStyle.Italic);
e.Graphics.Clear(Color.White);
e.Graphics.FillRectangle(Brushes.LightGray, new RectangleF(0, 0, sfComboBox1.DropDownButton.Width, sfComboBox1.DropDownButton.Height));
e.Graphics.DrawString("#", myFont, Brushes.Black, 1, 3);
} |
Screenshot:
C# for image:
|
private void DropDownButton_Paint(object sender, PaintEventArgs e)
{
Image image = Image.FromFile( Path.Combine( Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images/icon.png"));
Font myFont = new System.Drawing.Font("Helvetica",16, FontStyle.Italic);
e.Graphics.Clear(Color.White);
e.Graphics.FillRectangle(Brushes.WhiteSmoke, new RectangleF(0, 0, sfComboBox1.DropDownButton.Width, sfComboBox1.DropDownButton.Height));
//e.Graphics.DrawString("#", myFont, Brushes.Black, 1, 3);
e.Graphics.DrawImage(image, 1, 7,sfComboBox1.DropDownButton.Height-17,sfComboBox1.DropDownButton.Height-15);
} |
Screenshot:
Sample : https://www.syncfusion.com/downloads/support/forum/154645/ze/ComboBox_DropDownImage1093117495
Regards,
Niranjan Kumar Gopalan
TG
The GridLock
May 29, 2020 11:43 AM UTC
Hi Niranjan,
Although the arrowbutton is not highlighted, but your code is enough for me now /
Thanks!
NI
Ninja
Syncfusion Team
June 1, 2020 10:11 AM UTC
Hi Khanh,
Thanks for your update.
We are glad to know that the reported requirement has been resolved at your end. And the highlighting of the SfCombobox DropDown button can be achieved by refreshing the DropDownButton on MouseHover and MouseLeave events to invoke the paint event and fil the button rectangle with required color based on condition check. Please check the below video and sample for same.
Video : https://www.syncfusion.com/downloads/support/forum/154645/ze/SfComboBox_ButtonVideo1556967874
Sample : https://www.syncfusion.com/downloads/support/forum/154645/ze/ComboBox_DropDownImage1234883401
Regards,
Niranjan Kumar Gopalan
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
-
TG The GridLock
- May 27, 2020 05:03 PM UTC
- Jun 1, 2020 10:11 AM UTC