[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Drawing coordinate system : question for Usercontrol/GDI+ expert

bobby

11/3/2004 12:54:00 PM

I am hacking on a usercontrol that creates a drawing surface with a
coordinate system but the design is not there yet. What I mean by coordinate
system is that it should have a ruler both horisontally and vertically. That
is no problem to draw. Also when implementing a zoom function it will not be
difficult to redraw the rulers with new values. But the problem arises when
it comes to scrolling because the rulers disappear out of the viewport which
is no good.

I would like to use the AutoScroll feature of a scrollable control, but
rulers are the problem. In the current design I use a single usercontrol
drawing directly on the surface. So the question is: How do I design so
rulers stay visible???

(What really should happen in the scroll is that the horisontal ruler can
scroll horisontally and likewise the vertical ruler. Drawing surface scrolls
in both directions)

Should I create three usercontrols (rulerX, rulerY, drawSurface) and then
place them all on an encapsulating usercontrol or what?

The design goal is to create a single control.

Any design ideas?


2 Answers

Bob Powell

11/3/2004 5:29:00 PM

0

Windows Forms Tips and Tricks has an article on understanding autoscroll
that will show you how to get the panning right.

I would suggest a control for the rulers that is drawn separately to the
control that does the panning and zooming. You just have to make sure that
both rulers and the zoomed control know the current scale and pan settings.
There would be three controls in the container, a left ruler, top ruler and
the drawing surface.

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

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

The GDI+ FAQ RSS feed: http://www.bobpowell.net/f...
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tips...
Bob's Blog: http://bobpowelldotnet.blogspot.co...






"bobby" <bobby@bobbys.com> wrote in message
news:eZFk4QawEHA.2568@TK2MSFTNGP11.phx.gbl...
> I am hacking on a usercontrol that creates a drawing surface with a
> coordinate system but the design is not there yet. What I mean by
coordinate
> system is that it should have a ruler both horisontally and vertically.
That
> is no problem to draw. Also when implementing a zoom function it will not
be
> difficult to redraw the rulers with new values. But the problem arises
when
> it comes to scrolling because the rulers disappear out of the viewport
which
> is no good.
>
> I would like to use the AutoScroll feature of a scrollable control, but
> rulers are the problem. In the current design I use a single usercontrol
> drawing directly on the surface. So the question is: How do I design so
> rulers stay visible???
>
> (What really should happen in the scroll is that the horisontal ruler can
> scroll horisontally and likewise the vertical ruler. Drawing surface
scrolls
> in both directions)
>
> Should I create three usercontrols (rulerX, rulerY, drawSurface) and then
> place them all on an encapsulating usercontrol or what?
>
> The design goal is to create a single control.
>
> Any design ideas?
>
>


bobby

11/3/2004 10:15:00 PM

0

Thanks for your comments. Works like a charm.

Great FAQ you've got there!

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:e6DF7qcwEHA.1392@tk2msftngp13.phx.gbl...
> Windows Forms Tips and Tricks has an article on understanding autoscroll
> that will show you how to get the panning right.
>
> I would suggest a control for the rulers that is drawn separately to the
> control that does the panning and zooming. You just have to make sure that
> both rulers and the zoomed control know the current scale and pan
> settings.
> There would be three controls in the container, a left ruler, top ruler
> and
> the drawing surface.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/gdipl...
>
> The GDI+ FAQ RSS feed: http://www.bobpowell.net/f...
> Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tips...
> Bob's Blog: http://bobpowelldotnet.blogspot.co...
>
>
>
>
>
>
> "bobby" <bobby@bobbys.com> wrote in message
> news:eZFk4QawEHA.2568@TK2MSFTNGP11.phx.gbl...
>> I am hacking on a usercontrol that creates a drawing surface with a
>> coordinate system but the design is not there yet. What I mean by
> coordinate
>> system is that it should have a ruler both horisontally and vertically.
> That
>> is no problem to draw. Also when implementing a zoom function it will not
> be
>> difficult to redraw the rulers with new values. But the problem arises
> when
>> it comes to scrolling because the rulers disappear out of the viewport
> which
>> is no good.
>>
>> I would like to use the AutoScroll feature of a scrollable control, but
>> rulers are the problem. In the current design I use a single usercontrol
>> drawing directly on the surface. So the question is: How do I design so
>> rulers stay visible???
>>
>> (What really should happen in the scroll is that the horisontal ruler can
>> scroll horisontally and likewise the vertical ruler. Drawing surface
> scrolls
>> in both directions)
>>
>> Should I create three usercontrols (rulerX, rulerY, drawSurface) and then
>> place them all on an encapsulating usercontrol or what?
>>
>> The design goal is to create a single control.
>>
>> Any design ideas?
>>
>>
>
>