Display results as :

Rechercher Advanced Search

Latest topics
» Tuyệt Kỹ Đong Giai Chân Kinh (tuyệt Kỹ cua trai)
Thu Aug 23, 2012 5:38 am by Admin

» Tuyệt kỹ cua giai
Thu Aug 23, 2012 5:36 am by Admin

» NETCAT.........
Mon Aug 13, 2012 6:35 am by Admin

» Bảo mật CSDL bằng phương pháp mã hóa.
Tue Apr 17, 2012 10:04 pm by Admin

» Hàm mã hóa MD5 bằng JavaScript
Tue Apr 17, 2012 10:03 pm by Admin

» Giá của món quà
Fri Apr 13, 2012 6:01 am by Admin

» Sẽ chỉ yêu ai?
Fri Apr 13, 2012 6:01 am by Admin

» Cách đọc bảng chữ cái!
Thu Apr 12, 2012 10:37 pm by Admin

» Gắn trojan, keylog, virus vào website, forum
Tue Apr 10, 2012 1:14 am by Admin


free forum

PictureBox Class

Go down

PictureBox Class

Post  Admin on Tue Apr 10, 2012 1:10 am

Represents a Windows picture box control for displaying an image.
For a list of all members of this type, see PictureBox Members.
[Visual Basic]
Public Class PictureBox
Inherits Control
public class PictureBox : Control
public __gc class PictureBox : public Control
public class PictureBox extends Control
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Typically the PictureBox is used to display graphics from a bitmap, metafile, icon, JPEG, GIF or PNG file.
Set the Image property to the Image you want to display, either at design time or at run time. Clipping and positioning of the image in the display area is controlled by the SizeMode property which is set to values in the PictureBoxSizeMode enumeration. You can change the size of the display area at run time with the ClientSize property.
The PictureBox control is displayed by default without any borders. You can provide a standard or three-dimensional border using the BorderStyle property to distinguish the picture box from the rest of the form, even if it contains no image.
[Visual Basic, C#, C++] The following example illustrates how you can set an image and resize the display area of the picture box. This example assumes that ShowMyImage is called from within an existing form, and that the System.Drawing namespace has been added to the source code for your form.
[Visual Basic]
Private MyImage As Bitmap

Public Sub ShowMyImage(fileToDisplay As String, xSize As Integer, _
ySize As Integer)
' Sets up an image object to be displayed.
If Not (MyImage Is Nothing) Then
End If

' Stretches the image to fit the pictureBox.
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
MyImage = New Bitmap(fileToDisplay)
pictureBox1.ClientSize = New Size(xSize, ySize)
pictureBox1.Image = CType(MyImage, Image)
End Sub

private Bitmap MyImage ;
public void ShowMyImage(String fileToDisplay, int xSize, int ySize)
// Sets up an image object to be displayed.
if (MyImage != null)

// Stretches the image to fit the pictureBox.
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ;
MyImage = new Bitmap(fileToDisplay);
pictureBox1.ClientSize = new Size(xSize, ySize);
pictureBox1.Image = (Image) MyImage ;

Bitmap^ MyImage ;
void ShowMyImage(String^ fileToDisplay, int xSize, int ySize)
// Sets up an image object to be displayed.
if (MyImage != 0)

// Stretches the image to fit the pictureBox.
pictureBox1->SizeMode = PictureBoxSizeMode::StretchImage ;
MyImage = new Bitmap(fileToDisplay);
pictureBox1->ClientSize = System::Drawing::Size(xSize, ySize);
pictureBox1->Image = dynamic_cast(MyImage);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button in the upper-left corner of the page.
Namespace: System.Windows.Forms
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)

Tổng số bài gửi : 782
Join date : 2009-08-15

View user profile

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum