If you look at a part like thishttp://www.mpja.com/download/18460op.pdf
You will see lots of common connections.
If you a single LED on, you drive a left pin high (the anode connections) and a top pin low (the cathode connections).
Want a whole row? Anode high, all cathodes low.
Want a whole column? All anodes high, one cathode low.
Anything else requires switching them in a pattern repeatedly over time.
For instance, a diagonal line.
Switch A1C1, then A2C2, then A3C3, etc. each combination briefly & repeatedly so to the eye it looks they are all on.
Typically one would do something like set the columns, pulse the row on/off, & repeat thru the matrix.
write columns, pulse row 1
write columns, pulse row 2
write columns, pulse row 3
Chips like the MAX7221 do this cycling for you, and also control the current so no external current limit resistors are needed.