The B-25 was an incredible ship destroyer in the Pacific.  The B-25H was even equipped with a radar guided gunsight for it's 75mm in an experimental form.  It was extremely accurate.  In one test, the radar locked onto the steel mast of a ship, and it was severed with a direct hit from the 75mm.
But it still wasn't as effective as bombing.  A long straight cannon run left the B-25 vulnerable and at most allowed about 7 rounds to be fired.  The goal was to put out as much ordnance in the least amount of time possible.  Skip-bombing, para-frags, and 8 forward firing 50 cals were the best for that.  No reason to linger around the enemy too long.