mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 06:23:24 -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.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls.Primitives;
|
||||
|
@ -87,9 +88,7 @@ namespace Greenshot.Editor.Drawing
|
|||
{
|
||||
_currentContainer = this;
|
||||
|
||||
CreatePickerControl();
|
||||
|
||||
_parent.Controls.Add(_emojiPickerHost);
|
||||
GetOrCreatePickerControl();
|
||||
|
||||
var absRectangle = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
|
||||
var displayRectangle = Parent.ToSurfaceCoordinates(absRectangle);
|
||||
|
@ -102,8 +101,10 @@ namespace Greenshot.Editor.Drawing
|
|||
_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)
|
||||
{
|
||||
_emojiPicker = new Picker();
|
||||
|
@ -116,6 +117,9 @@ namespace Greenshot.Editor.Drawing
|
|||
_emojiPickerHost = new ElementHost();
|
||||
_emojiPickerHost.Dock = DockStyle.None;
|
||||
_emojiPickerHost.Child = _emojiPicker;
|
||||
_emojiPickerHost.Name = "EmojiPickerHost";
|
||||
|
||||
_parent.Controls.Add(_emojiPickerHost);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue