There is a picture box and its onto a lable and when mouse enters the picture box's visibility is turned to false so that the label is shown the problem is I want to make the lable clickable but it's not working ..... I think the mouse enter event is blocking the click every thing is coded I didn't use the drag and drop thing.
If you double click on the label in Winform designer that should take you to the OnClick method for the label. There you can specify what you want to do when the user clicks on it. If you have done this and cant click or see the label. In designer place the label on top of the image, make the label not visible until the picture is hovered then click label.
Related
I need to create a combo box with an overlayed button like the one in the Toolbox panel of Visual Studio:
I created a control derived from System.Windows.Forms.UserControl with a PictureBox onto a System.Windows.Forms.ComboBox.
The problem is that when the text is too long, it starts scrolling after the PictureBox, going under it. I tried setting the MaxLength property of the ComboBox appropriately, but in this way the user would be limited in the number of characters he could enter because the text doesn't scroll.
What can I do to achieve the desired functionality?
I've been trying to get to make the whole area clickable, in the picture you can see the size of the linklabel, but only text is clickable, I want to make the background of the link label(the whole area) clickable too, is that possible? How can I do that?
I've tried using
linklabel.LinkArea = new LinkArea();
But it only works for the text that i have. I've checked out StackOverflow Posts such as this or this but i couldn't get something out of it.
You can use a panel, with a mouseclick event on it, after that you can add a label or whatever you want
Panel
I want to drag button on table layout panel that consist 4 row and 4 button each inside, when dragging over the panel I want the other button automatically move up or down depend on location the current button being drag over.
Example : if I drag new button to button2 , automatically button 2,3,4 move down empty the button2 place. I have tried out mouseUp, mouseDown, MouseMove events of control, but that is not what I am looking for.
Can I do this? If you can give me an idea it will be great.
I have a Windows Form in C# with 4 buttons with different states that I use as a menu.
What is the best way to use/implement the different button states.
Normal --> Mouse Enter, Mouse Leave and Mouse click. On click, that specific button should stay the clicked color and only change back to normal once a different button is clicked. Clicked color should also not change again on mouse enter or mouse leave. Should be flat buttons.
Thanks
change background of all buttons to default on click.
Then apply the Required backrgound to the button which triggered the click event by using the sender variable of the event
I am developing a Custom Editable Text Block for my Application. So when the User clicks on the Control, TextBox swaps in for the User to edit the Text. Everything is fine till now, Now my requirement is I want the caret index of TextBox to exactly where the user had clicked on the TextBlock.
So the user won't feel about the swap from UI Point of View.
What approach would be more appropriate? Considering the above factors?!
I am lost in ideas for this thing.
I assume you have a UserControl/Customcontrol with its own Mouse handling support, and a way to tell when to switch the content from TextBlock to TextBox.
In the mousedown event you could store the clicked position, swap to the textbox and in the Loaded event you could use GetCharacterIndexFromPoint to tell which is the position of the click and set the CaretIndex to that position. You might have to adjust your margins if you use any.