Element.CanBeLocked() returns an bool value.It wont lock/pin the element but it identifies if the element can be locked/Pinned.
Elements can be pinned to prevent them from moving. The Element.Pinned property can be used to check if an Element is pinned or to pin or unpin an element.
When Element.Pinned is set to true, the element is Pinned so the element cannot be moved or rotated.
e.Pinned= true;