How to encrypt strings and files using public key

I am new here, so if I ask something very simple, please forgive me. Before I post this topic, I also serched the forum, but can’t find solution.

How do I encrypt strings and files using public key, and after the one who has the private key received the message, he can use his private to decrypt the message.

Besides, one wallet have and address, and also have spend private key/spend public key/view private key/view public key. Can anyone tell me how to use this 4 keys, can I give the public key to others?