mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 14:24:43 -07:00
One picker by surface
This commit is contained in:
parent
238a43f216
commit
8d1ac3b4ba
1 changed files with 8 additions and 4 deletions
|
@ -22,6 +22,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
|
@ -87,9 +88,7 @@ namespace Greenshot.Editor.Drawing
|
||||||
{
|
{
|
||||||
_currentContainer = this;
|
_currentContainer = this;
|
||||||
|
|
||||||
CreatePickerControl();
|
GetOrCreatePickerControl();
|
||||||
|
|
||||||
_parent.Controls.Add(_emojiPickerHost);
|
|
||||||
|
|
||||||
var absRectangle = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
|
var absRectangle = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
|
||||||
var displayRectangle = Parent.ToSurfaceCoordinates(absRectangle);
|
var displayRectangle = Parent.ToSurfaceCoordinates(absRectangle);
|
||||||
|
@ -102,8 +101,10 @@ namespace Greenshot.Editor.Drawing
|
||||||
_emojiPicker.ShowPopup(true);
|
_emojiPicker.ShowPopup(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreatePickerControl()
|
private void GetOrCreatePickerControl()
|
||||||
{
|
{
|
||||||
|
// Create one picker control by surface
|
||||||
|
_emojiPickerHost = _parent.Controls.Find("EmojiPickerHost", false).OfType<ElementHost>().FirstOrDefault();
|
||||||
if (_emojiPickerHost == null)
|
if (_emojiPickerHost == null)
|
||||||
{
|
{
|
||||||
_emojiPicker = new Picker();
|
_emojiPicker = new Picker();
|
||||||
|
@ -116,6 +117,9 @@ namespace Greenshot.Editor.Drawing
|
||||||
_emojiPickerHost = new ElementHost();
|
_emojiPickerHost = new ElementHost();
|
||||||
_emojiPickerHost.Dock = DockStyle.None;
|
_emojiPickerHost.Dock = DockStyle.None;
|
||||||
_emojiPickerHost.Child = _emojiPicker;
|
_emojiPickerHost.Child = _emojiPicker;
|
||||||
|
_emojiPickerHost.Name = "EmojiPickerHost";
|
||||||
|
|
||||||
|
_parent.Controls.Add(_emojiPickerHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue