diff --git a/src/editors/xrSdkControls/Controls/MenuButton.cs b/src/editors/xrSdkControls/Controls/MenuButton.cs new file mode 100644 index 00000000000..dfba420f424 --- /dev/null +++ b/src/editors/xrSdkControls/Controls/MenuButton.cs @@ -0,0 +1,42 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace XRay.SdkControls +{ + public class MenuButton : Button + { + private ContextMenu menu = new ContextMenu(); + + protected override void OnClick(EventArgs e) + { + // for ContextMenuStrip + //var screenPoint = PointToScreen(new Point(Left, Bottom)); + //var currentScreen = Screen.FromPoint(screenPoint); + //var flip = screenPoint.Y + menu.Size.Height > currentScreen.WorkingArea.Height; + //menu.Show(this, new Point(0, flip ? -menu.Height : Height)); + menu.Show(this, new Point(0, Height)); + base.OnClick(e); + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + int arrowX = ClientRectangle.Width-14; + int arrowY = ClientRectangle.Height/2-1; + var brush = Enabled ? SystemBrushes.ControlText : SystemBrushes.ButtonShadow; + var arrowPoints = new [] + { + new Point(arrowX, arrowY), + new Point(arrowX+7, arrowY), + new Point(arrowX+3, arrowY+4) + }; + e.Graphics.FillPolygon(brush, arrowPoints); + } + + public ContextMenu Menu + { + get { return menu; } + } + } +} diff --git a/src/editors/xrSdkControls/xrSdkControls.csproj b/src/editors/xrSdkControls/xrSdkControls.csproj index e6b62491e8e..07d7cb43e7d 100644 --- a/src/editors/xrSdkControls/xrSdkControls.csproj +++ b/src/editors/xrSdkControls/xrSdkControls.csproj @@ -49,6 +49,9 @@ + + Component + UserControl