Unplanned
Last Updated: 29 Mar 2016 14:18 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 07 Mar 2016 07:54
Category: Form
Type: Bug Report
0
FIX. RadForm - the "Size" item in the context menu is enabled when the FormBorderStyle=FixedSingle
To reproduce:

public Form1()
{
    InitializeComponent();
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
}

Although the user is not allowed to resize the form from the form's borders, it is possible to do it by the context menu.

Workaround:

[DllImport("user32.dll")]
static extern bool EnableMenuItem(IntPtr hMenu, uint uIDEnableItem, uint uEnable);

internal const UInt32 MF_DISABLED = 0x00000002;

internal const UInt32 SC_SIZE = 0xF000;

internal const UInt32 WM_INITMENUPOPUP = 0x0117;

protected override void WndProc(ref Message m)
{
    if (m.Msg == WM_INITMENUPOPUP && (((int)m.LParam & 0x10000) != 0))
    {
        EnableMenuItem(m.WParam, SC_SIZE, MF_DISABLED);
    }

    base.WndProc(ref m);
}
0 comments