.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Disable keyboard delete key on autocad loading

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
scluna
611 Views, 3 Replies

Disable keyboard delete key on autocad loading

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
3 REPLIES 3
Message 2 of 4
scluna
in reply to: scluna

I think I found the solutions to do this by implementing

ObjectOverrule

SCLuna
Message 3 of 4
swaywood
in reply to: scluna

could you post your key code showing how to realize this?
Message 4 of 4
scluna
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost