How can I Draw lines on UMG by C++ code?

Same way UWidgetBlueprintLibrary::DrawLine | Unreal Engine Documentation

You can get the Context by overriding the OnPaint Function as example.

1 Like