This should do the trick as long as your web part inherits from CMSAbstractWebPart
if(Visible)
{
}
The other option is to simply use the StopProcessing
property:
protected void SetupControl()
{
if (this.StopProcessing)
{
// Do not process
}
else
{
// Continue on
}
}