CodePudding user response:
Don't use VB.NET to give you a method of operation reference in VB6, should do not have too big difference:In the TextBox control MouseMove event, to test whether the left mouse button press;
If it is left click and drag, check whether the TextBox SelLength attribute value greater than 0: if greater than 0 "copy button" available; Otherwise the disabled,
Other aspects, of course, there are still many details, let's talk about it when you consider that...
(HOOK message handling feels as though it is simple, don't have to think too much detail)
CodePudding user response:
Seems to be some truth, I try, thanksCodePudding user response:
The most brutal way:Use a timer, 500 ms judgment:
If the textbox. SelectionLength> 0, copy button Enabled=true;
If the Clipboard ContainsText=true, paste button Enabled=true,
If it's not this way, paste is very troublesome, this function must be content in the clipboard, and is a text to use, do not have the appropriate pre-defined event trigger, copy it is easy to handle, the two events judgment conditions after all not the same:
Write a way to judge whether the textbox SelectionLength greater than zero, if meet the conditions set copy button Enabled true; Then the mouseup event with very little brain, keyup event, mouseleave event, and you can think of other calls this method, all possible events don't need to consider the mouse drag or not to drag, because after the keyboard and mouse movements, there are only two results, or selected text, or selected text, didn't