Layered drawing in a control?

G

Guest

Hi there,
I have developed a control which can do zoom in and out a design surface
where u can place objects.
Ok then. The problem is that the control has two zoom buttons that have to
be painted always in the same position ,even when we are scrolling the design
surface from one side to another. I have also a border for the control that
has to sorround its displayrectangle.
When I move the srollbars the Paint event is generated and the picture
which was in the display rectangle is scrolled leaving an invalid area. The
problem is that the border and the buttons are scrolled too because they were
painted before on top of the dsign surface and they dont have to because they
must remain in the same place always. I dont know how to manage a separate
layer which includes the border ans these two buttons having also other
layer behind the first one which has to be the scrolled one and which holds
the design surface and its elements
Any idea? thanks
 
B

Bob Powell [MVP]

I think that your idea of having the buttons on the same surface as the
designer is fundamentally flawed. The scrollable part should be a control on
it's own that scrolls, zooms etc and the things that manage those properties
should be in another part of the UI such as another panel, toolbar etc.

Rather than try to think up ways to manage this odd UI try to redesign your
application to follow more conventional user interface guide-lines.


--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
G

Guest

OK Thats all right for the buttons but what about the control border?? The
border must be there always despite of scrolling and it must not be scrolled
when the rest of the drawing is.This means i have nochance of putting a
border on my control?
 
B

Bob Powell [MVP]

Sure you can put a border. You can either use one of the standard borders by
setting a window style or you can go the whole hog and override the message
loop and provide handlers for the WM_NCCALCSIZE and WM_NCPAINT messages.

See Windows Forms Tips and Tricks for info on how to add a border using a
simple window style.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top