I am trying to set up printing in my application. I have a WinformsMap control on my main form. I want to open up a print preview form and I need a WinformsMap control on it to display the map data. I don't want to have to remember all of the data I have open but I need a duplicate of the dataset in the control on the print preview form. I also don't want changes to the extent, or size of the print preview control to effect the main display control.
Is there a way of duplicating everything in one WinformsMap control in another?
Is there a better way of duplicating the capabilities I need to send a data set to a printer?
The winformsMaps inherts from Control which do not support Serialization. So, I think you might need to write your own copy logic. Following is a simple code snippet, hope it can give you some inspirations. private WinformsMap GetCopiedWinformsMap(WinformsMap sourceWinforms) { WinformsMap targetMap = new WinformsMap(); targetMap.Width = sourceWinforms.Width; targetMap.Height = sourceWinforms.Height;
foreach (Overlay overlay in sourceWinforms.Overlays) { targetMap.Overlays.Add(overlay); }