![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#11
| |||
| |||
|
#12
| |||
| |||
|
|
But (unless I'm misunderstanding things?) the problem isn't to do with the transformation of the image, it's related to the AutoScrollPosition? Surely if I start applying TranslateTransform's to the Graphic the auto-scroll bars won't be in sync with the location I'm looking at? As I said before, the only way I can think of doing it is by calculating the new centered viewport co-ordinates and moving the AutoScrollPosition to the scaled position once the ScaleTransform and TranslateTransform have been performed? |
#13
| |||
| |||
|
|
Hi, I'm currently trying to write a custom UserControl which (essentially) is a drawing canvas and allows zooming and panning. The functionality I'm trying to implement relates to zooming. I've currently implemented something along the lines of Bob Powell's example at http://www.bobpowell.net/zoompicbox.htm, however, what I'm trying to achieve is zooming to the center point of the control, rather than to the top left hand (i.e. the co-ordinate location). I can't quite get my head around how to do this cleanly. Can anyone offer an advice or pointers? The only way I can think of doing it at the moment, is by manually setting the AutoScrollPosition by calculating the new position before scaling, and then setting that position after the scaling. However I'm not sure this is the best way to achieve what I what? Kind Regards Doug |
#14
| |||
| |||
|
|
Try that, this is my own ScrollView.... |
#15
| |||
| |||
|
|
You could remove the dragging code. But just if you want to keep it, I copy here the DraggingForm. I also attached the Alignment file |
#16
| |||
| |||
|
|
"Lloyd Dupont" <net.galador@ld> wrote in message news:OPjW728IHHA.1248 (AT) TK2MSFTNGP03 (DOT) phx.gbl... You could remove the dragging code. But just if you want to keep it, I copy here the DraggingForm. I also attached the Alignment file The dragging form is missing some constants but removing all references to it fixed the problem. What is this control meant to do? Is it a replacement for the standard scrolling features of controls? Michael |
#17
| |||
| |||
|
|
This is a ScrollView which also zoom. It is ideally suited for subclassing, where you could ovewrite OnPaint() as follow: /// protected override void OnPaint(PaintEventArgs e) /// { /// // prepare the client space (standart in ScrollView) /// Matrix m = e.Graphics.Transform; /// m.Multiply(ClientTransform()); /// e.Graphics.Transform = m; /// /// // ... normal drawing code ... /// } "Michael C" <nospam (AT) nospam (DOT) com> wrote in message news:%23IwzVG9IHHA.4848 (AT) TK2MSFTNGP04 (DOT) phx.gbl... "Lloyd Dupont" <net.galador@ld> wrote in message news:OPjW728IHHA.1248 (AT) TK2MSFTNGP03 (DOT) phx.gbl... You could remove the dragging code. But just if you want to keep it, I copy here the DraggingForm. I also attached the Alignment file The dragging form is missing some constants but removing all references to it fixed the problem. What is this control meant to do? Is it a replacement for the standard scrolling features of controls? Michael |
#18
| |||
| |||
|
|
This is a ScrollView which also zoom. It is ideally suited for subclassing, where you could ovewrite OnPaint() as follow: /// protected override void OnPaint(PaintEventArgs e) /// { /// // prepare the client space (standart in ScrollView) /// Matrix m = e.Graphics.Transform; /// m.Multiply(ClientTransform()); /// e.Graphics.Transform = m; /// /// // ... normal drawing code ... /// } |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |