-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTagEditorDialog.cs
More file actions
38 lines (33 loc) · 1.19 KB
/
TagEditorDialog.cs
File metadata and controls
38 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright Bastian Eicher
// Licensed under the MIT License
using System;
using System.Drawing;
using System.Windows.Forms;
using NanoByte.Common.Controls;
namespace NanoByte.LightTag
{
public class TagEditorDialog : OKCancelDialog
{
private readonly PropertyGrid _propertyGrid = new PropertyGrid
{
ToolbarVisible = false,
HelpVisible = false,
Location = new Point(12, 12),
Size = new Size(259, 205),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
private TagEditorDialog(Tag element)
{
// ReSharper disable once VirtualMemberCallInConstructor
Text = "Tag";
FormBorderStyle = FormBorderStyle.Sizable;
_propertyGrid.SelectedObject = element ?? throw new ArgumentNullException(nameof(element));
Controls.Add(_propertyGrid);
}
public static bool Show(IWin32Window owner, Tag element)
{
using (var dialog = new TagEditorDialog(element))
return (dialog.ShowDialog(owner) == DialogResult.OK);
}
}
}