Nov 22, 2009

How To Make A Window Form Smooth Snap To Desktop Edge ?

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > C# .NET

How To Make A Window Form Smooth Snap To Desktop Edge ?

magiccode9
Hi, All,

Now I got another issues that I wanted to implment a window that will snap to desktop edge.
What I'am do now was creating it with timer and some windows api to check positions
say if within a range then move the form window to any edge.

But this has an issue with it the window will flicker.
Any ideas with this issue ?



Thanks,

---
Magiccode9

Comment/Reply (w/o sign-up)

faulty.lee
Why not listen for Form.Move event, since you would only want to snap the form when it's moving right?

Then in the event handler just compare Form.Bound against Screen.PrimaryScreen.Bounds. Do take into consideration of pc with multiple display.

Btw, if you just need this feature for your own use, take a look at Pitaschio. It does what you're looking for to all windows and form, plus added some more great features, good for daily use.

Comment/Reply (w/o sign-up)

magiccode9
Faulty, Thanks your help !

I have been tested it with Form.Move event and related bounds.
But this still has flicker when I assign the top property of a form to 0.

Also, I have found a vb6 sample that does somethings similar to what I want to do.
That is a sample that restricted a window won't over the screen bound with a smooth moving.

With this example, it is much harder to get it works.
It basically work with windows message directly by intercept some messages.

I'am looking for this to see how it work.

Actually, it is used for my own small app that I build to get RSS feed and store some structure data.

I still looking for some sample code for this.

Thanks,

P.S. I'am using the RapidTools as a reference.
---
Magiccode9

Comment/Reply (w/o sign-up)

faulty.lee
Have you try to enable doublebuffering?
Do this inside your form's constructor after InitializeComponent()
CODE
this.SetStyle(
  ControlStyles.AllPaintingInWmPaint |
  ControlStyles.UserPaint |
  ControlStyles.DoubleBuffer,true);

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Snap Desktop


    Looking for make, window, form, smooth, snap, desktop, edge,

See Also,

*SIMILAR VIDEOS*
Searching Video's for make, window, form, smooth, snap, desktop, edge,
advertisement



How To Make A Window Form Smooth Snap To Desktop Edge ?

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com