mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 05:23:24 -07:00
Fixed serialization issues with the StepLabelContainer and the SpeechbubbleContainer, they should now be in the correct shape/location when loading from the .greenshot file.
This commit is contained in:
parent
87406d90da
commit
fb993c2238
4 changed files with 213 additions and 159 deletions
|
@ -27,6 +27,7 @@ using System;
|
|||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Greenshot.Drawing {
|
||||
|
@ -35,7 +36,34 @@ namespace Greenshot.Drawing {
|
|||
/// </summary>
|
||||
[Serializable]
|
||||
public class SpeechbubbleContainer : TextContainer {
|
||||
public SpeechbubbleContainer(Surface parent) : base(parent) {
|
||||
|
||||
#region TargetGripper serializing code
|
||||
// Only used for serializing the TargetGripper location
|
||||
private Point _storedTargetGripperLocation;
|
||||
|
||||
/// <summary>
|
||||
/// Store the current location of the target gripper
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
[OnSerializing]
|
||||
private void SetValuesOnSerializing(StreamingContext context) {
|
||||
if (TargetGripper != null) {
|
||||
_storedTargetGripperLocation = TargetGripper.Location;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restore the target gripper
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
[OnDeserialized]
|
||||
private void SetValuesOnDeserialized(StreamingContext context) {
|
||||
InitTargetGripper(Color.Green, _storedTargetGripperLocation);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public SpeechbubbleContainer(Surface parent)
|
||||
: base(parent) {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue