ImageList.ImageCollection.Add 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 개체를 .에 ImageList추가합니다.
오버로드
| Name | Description |
|---|---|
| Add(Icon) |
지정한 아이콘을 .에 ImageList추가합니다. |
| Add(Image) |
지정된 이미지를 .에 ImageList추가합니다. |
| Add(Image, Color) |
지정된 색을 사용하여 마스크를 ImageList생성하여 지정된 이미지를 추가합니다. |
| Add(String, Icon) |
지정된 키가 있는 아이콘을 컬렉션의 끝에 추가합니다. |
| Add(String, Image) |
지정된 키가 있는 이미지를 컬렉션의 끝에 추가합니다. |
Add(Icon)
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
지정한 아이콘을 .에 ImageList추가합니다.
public:
void Add(System::Drawing::Icon ^ value);
public void Add(System.Drawing.Icon value);
member this.Add : System.Drawing.Icon -> unit
Public Sub Add (value As Icon)
매개 변수
예외
예제
다음 코드 예제에서는 생성 하는 방법을 ImageList보여 줍니다., 속성에 Images 이미지를 추가, 속성을 설정 ImageSize 하 고 메서드를 Draw 사용 하 여 합니다. 이 예제를 실행하려면 이름이 지정된 Button1단추가 포함된 폼에 배치합니다. 이 예제에서는 c:\Windows\에서 FeatherTexture.bmp 및 Gone Fishing.bmp 있다고 가정합니다. 비트맵이 시스템에 없거나 다른 위치에 있는 경우 이에 따라 예제를 변경합니다.
internal:
System::Windows::Forms::ImageList^ ImageList1;
private:
// Create an ImageList Object, populate it, and display
// the images it contains.
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
// Construct the ImageList.
ImageList1 = gcnew ImageList;
// Set the ImageSize property to a larger size
// (the default is 16 x 16).
ImageList1->ImageSize = System::Drawing::Size( 112, 112 );
// Add two images to the list.
ImageList1->Images->Add( Image::FromFile( "c:\\windows\\FeatherTexture.bmp" ) );
ImageList1->Images->Add( Image::FromFile( "C:\\windows\\Gone Fishing.bmp" ) );
// Get a Graphics object from the form's handle.
Graphics^ theGraphics = Graphics::FromHwnd( this->Handle );
// Loop through the images in the list, drawing each image.
for ( int count = 0; count < ImageList1->Images->Count; count++ )
{
ImageList1->Draw( theGraphics, Point(85,85), count );
// Call Application.DoEvents to force a repaint of the form.
Application::DoEvents();
// Call the Sleep method to allow the user to see the image.
System::Threading::Thread::Sleep( 1000 );
}
}
internal System.Windows.Forms.ImageList ImageList1;
// Create an ImageList Object, populate it, and display
// the images it contains.
private void Button1_Click(System.Object sender,
System.EventArgs e)
{
// Construct the ImageList.
ImageList1 = new ImageList();
// Set the ImageSize property to a larger size
// (the default is 16 x 16).
ImageList1.ImageSize = new Size(112, 112);
// Add two images to the list.
ImageList1.Images.Add(
Image.FromFile("c:\\windows\\FeatherTexture.bmp"));
ImageList1.Images.Add(
Image.FromFile("C:\\windows\\Gone Fishing.bmp"));
// Get a Graphics object from the form's handle.
Graphics theGraphics = Graphics.FromHwnd(this.Handle);
// Loop through the images in the list, drawing each image.
for(int count = 0; count < ImageList1.Images.Count; count++)
{
ImageList1.Draw(theGraphics, new Point(85, 85), count);
// Call Application.DoEvents to force a repaint of the form.
Application.DoEvents();
// Call the Sleep method to allow the user to see the image.
System.Threading.Thread.Sleep(1000);
}
}
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
' Create an ImageList Object, populate it, and display
' the images it contains.
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
' Construct the ImageList.
ImageList1 = New ImageList
' Set the ImageSize property to a larger size
' (the default is 16 x 16).
ImageList1.ImageSize = New Size(112, 112)
' Add two images to the list.
ImageList1.Images.Add(Image.FromFile _
("c:\windows\FeatherTexture.bmp"))
ImageList1.Images.Add _
(Image.FromFile("C:\windows\Gone Fishing.bmp"))
Dim count As System.Int32
' Get a Graphics object from the form's handle.
Dim theGraphics As Graphics = Graphics.FromHwnd(Me.Handle)
' Loop through the images in the list, drawing each image.
For count = 0 To ImageList1.Images.Count - 1
ImageList1.Draw(theGraphics, New Point(85, 85), count)
' Call Application.DoEvents to force a repaint of the form.
Application.DoEvents()
' Call the Sleep method to allow the user to see the image.
System.Threading.Thread.Sleep(1000)
Next
End Sub
설명
Icon 목록에 추가되기 Bitmap 전에 a로 변환됩니다.
적용 대상
Add(Image)
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
지정된 이미지를 .에 ImageList추가합니다.
public:
void Add(System::Drawing::Image ^ value);
public void Add(System.Drawing.Image value);
member this.Add : System.Drawing.Image -> unit
Public Sub Add (value As Image)
매개 변수
예외
추가되는 이미지는 .입니다 null.
추가되는 이미지는 .가 Bitmap아닙니다.
적용 대상
Add(Image, Color)
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
지정된 색을 사용하여 마스크를 ImageList생성하여 지정된 이미지를 추가합니다.
public:
int Add(System::Drawing::Image ^ value, System::Drawing::Color transparentColor);
public int Add(System.Drawing.Image value, System.Drawing.Color transparentColor);
member this.Add : System.Drawing.Image * System.Drawing.Color -> int
Public Function Add (value As Image, transparentColor As Color) As Integer
매개 변수
반품
새로 추가된 이미지의 인덱스이거나 이미지를 추가할 수 없는 경우 -1.
예외
추가되는 이미지는 .입니다 null.
추가되는 이미지는 .가 Bitmap아닙니다.
적용 대상
Add(String, Icon)
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
지정된 키가 있는 아이콘을 컬렉션의 끝에 추가합니다.
public:
void Add(System::String ^ key, System::Drawing::Icon ^ icon);
public void Add(string key, System.Drawing.Icon icon);
member this.Add : string * System.Drawing.Icon -> unit
Public Sub Add (key As String, icon As Icon)
매개 변수
- key
- String
아이콘의 이름입니다.
예외
icon은 null입니다.
설명
이미지의 이름은 .의 키에 ImageList.ImageCollection해당합니다. 이미지 키는 대/소문자를 구분하지 않습니다.
적용 대상
Add(String, Image)
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
- Source:
- ImageList.ImageCollection.cs
지정된 키가 있는 이미지를 컬렉션의 끝에 추가합니다.
public:
void Add(System::String ^ key, System::Drawing::Image ^ image);
public void Add(string key, System.Drawing.Image image);
member this.Add : string * System.Drawing.Image -> unit
Public Sub Add (key As String, image As Image)
매개 변수
- key
- String
이미지의 이름입니다.
예외
image은 null입니다.
설명
이미지의 이름은 .의 키에 ImageList.ImageCollection해당합니다. 이미지 키는 대/소문자를 구분하지 않습니다.