Windows Forms Panel 컨트롤은 배경색과 배경 이미지를 모두 표시할 수 있습니다. BackColor 속성은 레이블 및 라디오 단추와 같은 포함된 컨트롤의 배경색을 설정합니다. BackgroundImage 속성이 설정되지 않은 경우 BackColor 선택 영역이 전체 패널을 채웁니다. BackgroundImage 속성이 설정되면 포함된 컨트롤 뒤에 이미지가 표시됩니다.
프로그래밍 방식으로 배경을 설정하려면
패널의 BackColor 속성을 형식 System.Drawing.Color 값으로 설정합니다.
Panel1.BackColor = Color.AliceBlue
panel1.BackColor = Color.AliceBlue;
panel1->BackColor = Color::AliceBlue;
System.Drawing.Image 클래스의 FromFile 메서드를 사용하여 패널의 BackgroundImage 속성을 설정합니다.
' You should replace the bolded image ' in the sample below with an image of your own choosing. Panel1.BackgroundImage = Image.FromFile _ (System.Environment.GetFolderPath _ (System.Environment.SpecialFolder.Personal) _ & "\Image.gif")
// You should replace the bolded image // in the sample below with an image of your own choosing. // Note the escape character used (@) when specifying the path. panel1.BackgroundImage = Image.FromFile (System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal) + @"\Image.gif");
// You should replace the bolded image // in the sample below with an image of your own choosing. panel1->BackgroundImage = Image::FromFile(String::Concat( System::Environment::GetFolderPath (System::Environment::SpecialFolder::Personal), "\\Image.gif"));
참고 항목
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET Desktop feedback