0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Visual StudioのソリューションエクスプローラでFormとしての認識回避方法

Last updated at Posted at 2025-09-03

小ネタ

この内容は小ネタ的なものですので、簡単にまとめます。

何が嫌か

image.png

↑ これをダブルクリックすると、Formが生成されますよね。
MainFormならUIパーツを好きなように並べているのでよい。

しかし、他のcsファイルは必ずしもFormと連動している訳ではない。
つまり、他の
csファイルをクリックした時にForm生成して欲しくない。

方法

Form生成してほしくない*.csファイルに以下コードを1行追加

	public partial class Dummy{}	/* VisualStudio上でのForm認識回避コード */

例です。

namespace [Your Namespace Name]
{
	public partial class Dummy{}	/* VisualStudio上でのForm認識回避コード */
	public partial class MainForm : Form
	{

image.png
これが

image.png
こうなります

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?