Ok. I think I figured. There's a property I didn't knew called TopItem.
Code: ags
int VisibleItemCount(this ListBox*){
int d = this.ItemCount - this.TopItem-1;
if(d < this.RowCount){
return d;
}
return this.RowCount;
}