If you are talking about the MyPage feature, as opposed to a CMS page, if your feature control inherits from SiteModuleControl, then there is a boolean property built in, ie you can access it with this.RenderInWebPartMode
It will be set to true when your control is loaded in MyPage as a WebPart otherwise it will always be false.
Hope that helps,
Joe