A
Arun Bhalla
I've been dealing with this problem off and on for the past couple weeks,
and I'm stumped.
I have a Panel that I've been using as a desktop for my app, and on this
desktop are many custom controls I've also extended from Panel. I'm trying
to draw arrows between some of the custom controls. That has worked fine
until I had to deal with scrolling. I'd like for the arrows to be drawn
correctly on this virtual desktop, so if a custom control is barely outside
the viewport, the arrow should be pointing in exactly that custom control's
direction. Alas, I have arrows pointing in the wrong direction.
One of the problems is that the Location property doesn't seem to take into
account the virtual location, after scrolling. So, it seems that two
different controls can both be at Location (100, 0), even if they might be
1000 pixels apart in the virtual space. Somehow Windows Forms knows to
display only the controls that belong in that viewport, but I can't figure
out how to extract the virtual coordinates... and using them with DrawLine()
would be even more useful.
PointToScreen() and PointToClient() don't seem to help. AutoScrollPos seems
to be the way to go, maybe, but I haven't been able to do anything useful
with it.
Does anyone have any tips and tricks for working with GDI+ and custom
controls on a scrollable control (Panel)?
Thanks,
Arun
and I'm stumped.
I have a Panel that I've been using as a desktop for my app, and on this
desktop are many custom controls I've also extended from Panel. I'm trying
to draw arrows between some of the custom controls. That has worked fine
until I had to deal with scrolling. I'd like for the arrows to be drawn
correctly on this virtual desktop, so if a custom control is barely outside
the viewport, the arrow should be pointing in exactly that custom control's
direction. Alas, I have arrows pointing in the wrong direction.
One of the problems is that the Location property doesn't seem to take into
account the virtual location, after scrolling. So, it seems that two
different controls can both be at Location (100, 0), even if they might be
1000 pixels apart in the virtual space. Somehow Windows Forms knows to
display only the controls that belong in that viewport, but I can't figure
out how to extract the virtual coordinates... and using them with DrawLine()
would be even more useful.
PointToScreen() and PointToClient() don't seem to help. AutoScrollPos seems
to be the way to go, maybe, but I haven't been able to do anything useful
with it.
Does anyone have any tips and tricks for working with GDI+ and custom
controls on a scrollable control (Panel)?
Thanks,
Arun