.NET

Reply
Valued Contributor
scluna
Posts: 61
Registered: ‎02-20-2007
Message 1 of 4 (182 Views)
Accepted Solution

Disable keyboard delete key on autocad loading

182 Views, 3 Replies
03-13-2014 01:49 PM

Hi,

 

Does anyone ehere knows how to disable keyboards keys (e.g. delete key, enter key, spacebar key) once autocad load.

 

Thanks and regards,

SCLuna
Valued Contributor
scluna
Posts: 61
Registered: ‎02-20-2007
Message 2 of 4 (149 Views)

Re: Disable keyboard delete key on autocad loading

03-14-2014 02:04 PM in reply to: scluna

I think I found the solutions to do this by implementing

ObjectOverrule

SCLuna
Valued Contributor
swaywood
Posts: 90
Registered: ‎08-22-2013
Message 3 of 4 (125 Views)

Re: Disable keyboard delete key on autocad loading

03-14-2014 11:37 PM in reply to: scluna
could you post your key code showing how to realize this?
Valued Contributor
scluna
Posts: 61
Registered: ‎02-20-2007
Message 4 of 4 (117 Views)

Re: Disable keyboard delete key on autocad loading

03-15-2014 07:47 AM in reply to: swaywood

Here is the code I got from reading an article from dev blog but I forgot the link.

 

Public Class CErase
        Inherits ObjectOverrule
        Public Overrides Sub [Erase](dbObject As DBObject, erasing As Boolean)
            MyBase.[Erase](dbObject, erasing)
            Throw New Autodesk.AutoCAD.Runtime.Exception(ErrorStatus.NotApplicable, "Use DrawingTool Delete command to delete Spaces.")
        End Sub
    End Class

    Shared objEraseOverRule As EraseOverrule = Nothing

    Public Shared Sub PreventErase()
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        If objEraseOverRule Is Nothing Then
            objEraseOverRule = New EraseOverrule()

            ObjectOverrule.AddOverrule(RXObject.GetClass(GetType(Entity)), objEraseOverRule, False)
            ObjectOverrule.Overruling = True
        Else
            ObjectOverrule.RemoveOverrule(RXObject.GetClass(GetType(Entity)), objEraseOverRule)
            objEraseOverRule.Dispose()
            objEraseOverRule = Nothing
        End If
    End Sub

SCLuna

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community