I'm trying to make custom panels, but I can't even set the styles without getting errors

MainForm.SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);
			MainForm.SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint, false);
			MainForm.SetStyle(System.Windows.Forms.ControlStyles.ResizeRedraw, true);
			MainForm.SetStyle(System.Windows.Forms.ControlStyles.UserPaint, true);
			MainForm.SetStyle(System.Windows.Forms.ControlStyles.SupportsTransparentBackColor, true);

Throws errors saying

An object reference is required for the non-static field, method, or property 'System.Windows.Forms.Control.SetStyle(System.Windows.Forms.ControlStyles, bool)' (CS0120)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.