I am trying to show a small form when you hover over this label. A image is on this form and thats it (form is borderless). When you hover over the label it comes up, when you move the mouse left or right or up or down it moves with it. Problem is it keeps flashing! What am I doing wrong?
Now obviously that is for web design but I want the same effect in Windows.
You hover over a label, when you do a image comes up showing the users signature (which is saved in the database). The reason I am doing it in another form rather than drawing it on the current form is because where the label is positioned. The size of the images vary (which explains the popup rather than just resizing the panel or picturebox on the form). Doing it in another form shows it outside that parent form. Which means it can be shown ontop of the parent form and not cut any of the image off because it went to far to the right or whatever...
On the link you provided, I see both a tooltip and an enlarged image when hovering a thumbnail, however they both are NOT located at the hotspot of the cursor, so you never leave the thumbnail. Hence, change your MouseEnter handler to include:
sigForm.Location = new Point(Cursor.Position.X+3, Cursor.Position.Y+3);
or whatever you prefer that keeps sigForm away from the cursor position itself.
And now for the advanced solution: make your sigForm a rectangle with a tiny hole in it, and make it appear so that the cursor points through the hole to the underlying label... That will keep you busy for a while, but I think it is doable (haven't seen it yet though).
not necessarily. You could try and explain the form really isn't a solid rectangle, probably using regions (I haven't ever begun to try it). The easier way would probably be to keep the sigForm disabled, i.e. visible but not available for user interaction.
And then there is an alternative where you don't really put up a new Form, instead you paint things yourself on top of everything that is already on the screen, see e.g. the ControlPaint class; mind you, I haven't been very successful in using it, there seem to be lots of unwanted side effects.
I've developed a client/server application and now I want to send an custom object through TCP/IP.
I've developed a solution for this, that worked, but I'm not shore it is the best. My solution was to convert the object to byte array and then send it to the server; the server convert the byte array to object and this is it!
Note a pattern as such, there's serialization (binary, XML), transmission using the TcpClient[^].
You came to ask for a pattern - So I guess that you'd like to compare your solution to the design pattern. I have no design-pattern, but some questions to ponder over.
* Sometimes you want to try and connect in a different way. E.g., SQL Express usually babbles over TCP/IP, but it can also babble over pipes.
* Sometimes the data is sensitive. Have you considered encryption?
* Sometimes larger transmissions get interrupted for different reasons. Can you send the serialized object in multiple pieces, say, a 100? It would be nice if the sender than could send a list with the pieces it wants' and to resend them. That way you could also show a progres-indication of what's sent.