Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» NewBlueFx TotalFX Windows-FL | 1.11 GB
Tue Dec 17, 2013 12:42 pm by titquarra

» NewBlueFx TotalFX Windows-FL | 1.11 GB
Tue Dec 17, 2013 12:42 pm by titquarra

» Celebrity.Sex.Tape.UNCUT.&.UNRATED.2012.720p.BRrip.x264.YIFY.mp4
Tue Dec 17, 2013 8:32 am by titquarra

» Maya Autodesk Personal Learning Edition 8.5
Tue Dec 17, 2013 7:47 am by titquarra

» 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

Shopmotion


Affiliates
free forum


PictureBox Class

View previous topic View next topic 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.
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.PictureBox
[Visual Basic]
Public Class PictureBox
Inherits Control
[C#]
public class PictureBox : Control
[C++]
public __gc class PictureBox : public Control
[JScript]
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.
Remarks
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.
Example
[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
MyImage.Dispose()
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


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

// 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 ;
}


[C++]
private:
Bitmap^ MyImage ;
public:
void ShowMyImage(String^ fileToDisplay, int xSize, int ySize)
{
// Sets up an image object to be displayed.
if (MyImage != 0)
{
MyImage->Dispose();
}

// 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.
Requirements
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)

Admin
Admin

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

View user profile http://hackis.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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