SlideShare a Scribd company logo
1 of 28
 Image Control
 Pictures Box
 Adding A Picture Box To A Form
 Setting Or Getting The Picture
 Adding Text to a Picture Box
 Formatting Text In A Picture Box
 Handling Picture Box Events
 Drawing Lines And circles In A Picture Box
 Picture box animation
 Copying Pictures To And Pasting Pictures From The
  Clipboard
 Differences between Image and picture box controls
 Formatting Function
 Image Control is used to display the images.
 The image control also support the property of Stretch.
 When Strech propery is false It will automatically
  resize.
   When stretch property is set to true it will fit the image
    in image control box.
 Pictures Box are more complete controls than image
  controls.
 It is used for graphics and you can load images into a
  picture box.
 When you load an image into a picture box the picture
  does not resize itself by default to fit the image as the
  image control does but it will if you set its AutoSize
  property to True.
 Select the picture box tool on the toolbox and double
  click it to add a picture to your form.
 If you want the picture box to resize itself to fit the
  picture you will load into it , set its auto size property
  to true.
 If you don’t want a border on the control set its border
  style property to none.
 You can load the picture with two different ways:-
 At design time:- select the picture property and
  choose image.s
 At run time:- Create a command button and click on
  the picture property and load the image.
 Private Sub Command1_Click()
  Picture1.Picture=
  LoadPicture("C:UsershpDesktopLighthouse.jpg")
  End Sub
•   If you want to get the picture in a picture box, you also
    use the picture property.
•   For example:-Here we copy the picture from picture1
    to picture2 when the user clicks a command button:



    Private Sub Command1_Click()
    Picture2.Picture = Picture1.Picture
    End Sub
   You draw text in a picture box with its Print method
    passing that method the text you want to print.
   Where does that text appear? It appears at the location set
    by the picture box’s currentX and CurrentY properties.



 Private Sub Form_Load()
Picture1.ScaleMode = vbPixels
Picture1.CurrentX = 30
Picture1.CurrentY = 25
Picture1.Print ("It is displaying a content in picture box")
End Sub
 You can use format text in a picture box using the
  fontbold , fontitalic ,fontunderline properties.
 When you set a property to true that property applies
  the next time you use the print method in the picture
  box.
 Private Sub Form_Load()
Picture1.ScaleMode = vbPixels
Picture1.CurrentX = 30
Picture1.CurrentY = 25
Picture1.Print ("It is displaying a content in picture box")
Picture1.CurrentX = 30
Picture1.CurrentY = Picture1.CurrentY +
  Picture1.TextHeight("")
Picture1.FontUnderline = True
Picture1.Print ("It is displaying a content in picture box")
End Sub
 The click event is useful if you want to use picture
  boxes as sort of image bearing buttons.
 If you want to know where in a picture box the user
  clicked the mouse use mousedown.
  Private Sub Form_Load()
Picture1.ScaleMode = vbPixels
Picture1.CurrentX = 25
Picture1.CurrentY = 20
Picture1.Print ("Picture        Box")
End Sub




 Private Sub Picture1_MouseDown(Button As Integer, Shift As
  Integer, X As Single, Y As Single)
    If X > 16 And X < 83 And Y > 11 And Y < 36 Then
     MsgBox "you clicked the word ""picture"""
     End If
     If X > 83 And X < 125 And Y > 11 And Y < 36 Then
MsgBox "you clicked the word ""box"""
End If
End Sub
   In a Picture Box you can draw lines and circle and set
    points to particular colors in a picture box.

 To Draw Circle
 Private Sub Command1_Click()
Picture1.Circle (700, 800), 500, vbRed
 End Sub


 To Draw Line
 Private Sub Command2_Click()
Picture1.Line (1500, 1000)-(2500, 1000), vbRed
 End Sub
 1.Select the Project Components menu item.
 2.Select the Controls tab in the Components box.
 3.Select the Microsoft Windows Common Controls
  item in the Components box and click onOK to close
  that box.
 4.Add a new image list control to your program using
  the Image List tool in the toolbox.
 5.Right-click the new image list control and select the
  Properties item in the menu that opens.
 6.Click the Images tab in the Property Pages box that
  opens, and load the images you want touse in the
  image list using the Insert Picture button.
 7.Close the Property Pages box by clicking on OK.All
  that remains is to add the code you need. For
  example, here we’ve added a timer control,
 Timer1to the program, set its Enabled property to
  False, and set its Interval property to 1000 .
 You can copy the images to the clipboard , letting the
  user paste them into other programs.
 To place data in the clipboard you use Setdata() , and to
  retrieve data from the Clipboard you use getdata().
 Private Sub Command1_Click()
Clipboard.SetData Picture1.Picture
End Sub

 Private Sub Command2_Click()
Picture2.Picture = Clipboard.GetData()
End Sub
   As they change shape, image controls stretch the image they
    contain. Picture boxes and forms do not.

   Image controls are lightweight controls. This means that an
    image control will consume less memory and is faster to deal
    with than picture boxes.
 Graphics methods which allow you to draw graphics
  on the fly at run time, can not be used to draw on
  image controls but they can draw on top of picture box
  controls.
 A picture box’s can be used as container objects. This
  means other objects can be drawn and grouped inside
  them.
 The way a value is printed or displayed is called its
  formatting.
 Format Number
 Format Currency
 Format Percentage
 Format Date Time
 This function formats the number to two decimal
  places with commas.
Syntax:- Formatnumber(number)
Example:- formatnumber(87321.784)
Output:- 87,321.78
 This function formats a number as currency such as
  dollars and cents.
 The number will also include a dollar sign or other
  currency symbol.
Syntax:- Formatcurrency(number)
Example:- Formatcurrency(2384921.387)
Output:- “$2,384,921.39”
 This function format its numeric argument as percent.
Syntax:- Formatpercent(number)
Example:- Formatpercent(.784)
Output:- “78.40%”
 This function takes a date datatype argument and
  format it in various ways.
Syntax:- FormatDateTime(DateExpression [,Format])
Example:-FormatDateTime(now , vblongdate)
Output:- “Wednesday,september 5,2012”
Image contro, and format functions in vb

More Related Content

What's hot

Functioning of computer
Functioning of computerFunctioning of computer
Functioning of computerSunipa Bera
 
Introduction to MS Word
Introduction to MS WordIntroduction to MS Word
Introduction to MS Wordshivamgupta949
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language ProcessingHemant Sharma
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating SystemsMukesh Chinta
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxclassall
 
Computer System
Computer SystemComputer System
Computer Systemhajjaz
 
Software components
Software componentsSoftware components
Software componentsAmir_Mukhtar
 
Visual basic
Visual basicVisual basic
Visual basicDharmik
 
Toolbar, statusbar, coolbar in vb
Toolbar, statusbar, coolbar in vbToolbar, statusbar, coolbar in vb
Toolbar, statusbar, coolbar in vbAmandeep Kaur
 
toolbox and its properties in the visual basic
toolbox and its properties in the visual basictoolbox and its properties in the visual basic
toolbox and its properties in the visual basicadarsh-kaul
 

What's hot (20)

Managing Files
Managing FilesManaging Files
Managing Files
 
MS Excel 2013
MS Excel 2013MS Excel 2013
MS Excel 2013
 
Language processors
Language processorsLanguage processors
Language processors
 
Functioning of computer
Functioning of computerFunctioning of computer
Functioning of computer
 
Introduction to MS Word
Introduction to MS WordIntroduction to MS Word
Introduction to MS Word
 
Access ppt
Access ppt Access ppt
Access ppt
 
Vb basics
Vb basicsVb basics
Vb basics
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating Systems
 
loaders and linkers
 loaders and linkers loaders and linkers
loaders and linkers
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptx
 
Computer System
Computer SystemComputer System
Computer System
 
Understanding Subroutines and Functions in VB6
Understanding Subroutines and Functions in VB6Understanding Subroutines and Functions in VB6
Understanding Subroutines and Functions in VB6
 
Software components
Software componentsSoftware components
Software components
 
Visual basic
Visual basicVisual basic
Visual basic
 
Vb.net (loop structure)
Vb.net (loop structure)Vb.net (loop structure)
Vb.net (loop structure)
 
Toolbar, statusbar, coolbar in vb
Toolbar, statusbar, coolbar in vbToolbar, statusbar, coolbar in vb
Toolbar, statusbar, coolbar in vb
 
Ms powerpoint
Ms powerpointMs powerpoint
Ms powerpoint
 
toolbox and its properties in the visual basic
toolbox and its properties in the visual basictoolbox and its properties in the visual basic
toolbox and its properties in the visual basic
 
An introduction to vba and macros
An introduction to vba and macrosAn introduction to vba and macros
An introduction to vba and macros
 

Viewers also liked

Using the JPEG2000 image format for storage and access in biodiversity collec...
Using the JPEG2000 image format for storage and access in biodiversity collec...Using the JPEG2000 image format for storage and access in biodiversity collec...
Using the JPEG2000 image format for storage and access in biodiversity collec...Chris Freeland
 
.bmp image data format
.bmp image data format.bmp image data format
.bmp image data formatMahesh pawar
 
Analog to Digital , Digital to Analog Conversion
Analog to Digital , Digital to Analog ConversionAnalog to Digital , Digital to Analog Conversion
Analog to Digital , Digital to Analog ConversionKunj Patel
 
TYPES OF IMAGE FILE FORMAT - MATHANKUMAR.S - VMKVEC
TYPES OF IMAGE FILE FORMAT - MATHANKUMAR.S - VMKVECTYPES OF IMAGE FILE FORMAT - MATHANKUMAR.S - VMKVEC
TYPES OF IMAGE FILE FORMAT - MATHANKUMAR.S - VMKVECMathankumar S
 
Image file formats
Image file formatsImage file formats
Image file formatsBob Watson
 
File formats and its types
File formats and its typesFile formats and its types
File formats and its typesAnu Garg
 

Viewers also liked (9)

Using the JPEG2000 image format for storage and access in biodiversity collec...
Using the JPEG2000 image format for storage and access in biodiversity collec...Using the JPEG2000 image format for storage and access in biodiversity collec...
Using the JPEG2000 image format for storage and access in biodiversity collec...
 
Image File Fomat
Image File FomatImage File Fomat
Image File Fomat
 
Grade 8 image file format
Grade 8   image file formatGrade 8   image file format
Grade 8 image file format
 
.bmp image data format
.bmp image data format.bmp image data format
.bmp image data format
 
Analog to Digital , Digital to Analog Conversion
Analog to Digital , Digital to Analog ConversionAnalog to Digital , Digital to Analog Conversion
Analog to Digital , Digital to Analog Conversion
 
TYPES OF IMAGE FILE FORMAT - MATHANKUMAR.S - VMKVEC
TYPES OF IMAGE FILE FORMAT - MATHANKUMAR.S - VMKVECTYPES OF IMAGE FILE FORMAT - MATHANKUMAR.S - VMKVEC
TYPES OF IMAGE FILE FORMAT - MATHANKUMAR.S - VMKVEC
 
Image Files Formats
Image Files FormatsImage Files Formats
Image Files Formats
 
Image file formats
Image file formatsImage file formats
Image file formats
 
File formats and its types
File formats and its typesFile formats and its types
File formats and its types
 

Similar to Image contro, and format functions in vb

Photoshop key points
Photoshop key pointsPhotoshop key points
Photoshop key pointsJoe Nasr
 
Zooming an image in visual basic
Zooming an image in visual basicZooming an image in visual basic
Zooming an image in visual basicHotland Sitorus
 
On the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docxOn the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docxdunhamadell
 
Picture box control
Picture box controlPicture box control
Picture box controlchauhankapil
 
Procedure of animation in 3 d autodesk maya tools &amp; techniques
Procedure of animation in 3 d autodesk maya tools &amp; techniquesProcedure of animation in 3 d autodesk maya tools &amp; techniques
Procedure of animation in 3 d autodesk maya tools &amp; techniquesijcga
 
Programming in matlab lesson5
Programming in matlab lesson5Programming in matlab lesson5
Programming in matlab lesson5najmah17
 
Complete Tutorial for 3d Text on Photos
Complete Tutorial for 3d Text on PhotosComplete Tutorial for 3d Text on Photos
Complete Tutorial for 3d Text on PhotosPj Dhanoa
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxfredharris32
 
Libre Office Impress Lesson 3: Adding and Formatting pictures
Libre Office Impress Lesson 3: Adding and Formatting picturesLibre Office Impress Lesson 3: Adding and Formatting pictures
Libre Office Impress Lesson 3: Adding and Formatting picturesSmart Chicago Collaborative
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)noorcon
 
Lighting with Photoshop
Lighting with PhotoshopLighting with Photoshop
Lighting with PhotoshopNYCCTfab
 
AUTOCAD Report
AUTOCAD ReportAUTOCAD Report
AUTOCAD ReportAMIT RAJ
 

Similar to Image contro, and format functions in vb (20)

M14 overview
M14 overviewM14 overview
M14 overview
 
Photoshop key points
Photoshop key pointsPhotoshop key points
Photoshop key points
 
Zooming an image in visual basic
Zooming an image in visual basicZooming an image in visual basic
Zooming an image in visual basic
 
Graphics
GraphicsGraphics
Graphics
 
On the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docxOn the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docx
 
Picture box control
Picture box controlPicture box control
Picture box control
 
Procedure of animation in 3 d autodesk maya tools &amp; techniques
Procedure of animation in 3 d autodesk maya tools &amp; techniquesProcedure of animation in 3 d autodesk maya tools &amp; techniques
Procedure of animation in 3 d autodesk maya tools &amp; techniques
 
Programming in matlab lesson5
Programming in matlab lesson5Programming in matlab lesson5
Programming in matlab lesson5
 
Toolbar
ToolbarToolbar
Toolbar
 
Photoshop basics
Photoshop basicsPhotoshop basics
Photoshop basics
 
Complete Tutorial for 3d Text on Photos
Complete Tutorial for 3d Text on PhotosComplete Tutorial for 3d Text on Photos
Complete Tutorial for 3d Text on Photos
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
 
Maya
MayaMaya
Maya
 
Maya
MayaMaya
Maya
 
Ppt lesson 03
Ppt lesson 03Ppt lesson 03
Ppt lesson 03
 
Libre Office Impress Lesson 3: Adding and Formatting pictures
Libre Office Impress Lesson 3: Adding and Formatting picturesLibre Office Impress Lesson 3: Adding and Formatting pictures
Libre Office Impress Lesson 3: Adding and Formatting pictures
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
 
Presentation1
Presentation1Presentation1
Presentation1
 
Lighting with Photoshop
Lighting with PhotoshopLighting with Photoshop
Lighting with Photoshop
 
AUTOCAD Report
AUTOCAD ReportAUTOCAD Report
AUTOCAD Report
 

More from Amandeep Kaur

Video/ Graphics cards
Video/ Graphics  cardsVideo/ Graphics  cards
Video/ Graphics cardsAmandeep Kaur
 
Menu pop up menu mdi form and playing audio in vb
Menu pop up menu mdi form and playing audio in vbMenu pop up menu mdi form and playing audio in vb
Menu pop up menu mdi form and playing audio in vbAmandeep Kaur
 
Data base connectivity and flex grid in vb
Data base connectivity and flex grid in vbData base connectivity and flex grid in vb
Data base connectivity and flex grid in vbAmandeep Kaur
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphicsAmandeep Kaur
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphicsAmandeep Kaur
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphicsAmandeep Kaur
 
Report on browser war
Report on browser warReport on browser war
Report on browser warAmandeep Kaur
 
Report of internet connections
Report of internet connectionsReport of internet connections
Report of internet connectionsAmandeep Kaur
 
How to configure dns server(2)
How to configure dns server(2)How to configure dns server(2)
How to configure dns server(2)Amandeep Kaur
 

More from Amandeep Kaur (20)

Video/ Graphics cards
Video/ Graphics  cardsVideo/ Graphics  cards
Video/ Graphics cards
 
Menu vb
Menu vbMenu vb
Menu vb
 
Menu pop up menu mdi form and playing audio in vb
Menu pop up menu mdi form and playing audio in vbMenu pop up menu mdi form and playing audio in vb
Menu pop up menu mdi form and playing audio in vb
 
Active x control
Active x controlActive x control
Active x control
 
Data base connectivity and flex grid in vb
Data base connectivity and flex grid in vbData base connectivity and flex grid in vb
Data base connectivity and flex grid in vb
 
Richtextbox
RichtextboxRichtextbox
Richtextbox
 
Treeview listview
Treeview listviewTreeview listview
Treeview listview
 
Progress bar
Progress barProgress bar
Progress bar
 
Filehandling
FilehandlingFilehandling
Filehandling
 
Socket
SocketSocket
Socket
 
Ppt of socket
Ppt of socketPpt of socket
Ppt of socket
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
Internet
InternetInternet
Internet
 
Internet working
Internet workingInternet working
Internet working
 
Report on browser war
Report on browser warReport on browser war
Report on browser war
 
Report of internet connections
Report of internet connectionsReport of internet connections
Report of internet connections
 
Report on intranet
Report on intranetReport on intranet
Report on intranet
 
How to configure dns server(2)
How to configure dns server(2)How to configure dns server(2)
How to configure dns server(2)
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 

Recently uploaded (20)

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 

Image contro, and format functions in vb

  • 1.
  • 2.  Image Control  Pictures Box  Adding A Picture Box To A Form  Setting Or Getting The Picture  Adding Text to a Picture Box  Formatting Text In A Picture Box  Handling Picture Box Events  Drawing Lines And circles In A Picture Box  Picture box animation  Copying Pictures To And Pasting Pictures From The Clipboard  Differences between Image and picture box controls  Formatting Function
  • 3.  Image Control is used to display the images.  The image control also support the property of Stretch.  When Strech propery is false It will automatically resize.
  • 4. When stretch property is set to true it will fit the image in image control box.
  • 5.  Pictures Box are more complete controls than image controls.  It is used for graphics and you can load images into a picture box.  When you load an image into a picture box the picture does not resize itself by default to fit the image as the image control does but it will if you set its AutoSize property to True.
  • 6.  Select the picture box tool on the toolbox and double click it to add a picture to your form.  If you want the picture box to resize itself to fit the picture you will load into it , set its auto size property to true.  If you don’t want a border on the control set its border style property to none.  You can load the picture with two different ways:-  At design time:- select the picture property and choose image.s
  • 7.  At run time:- Create a command button and click on the picture property and load the image.  Private Sub Command1_Click() Picture1.Picture= LoadPicture("C:UsershpDesktopLighthouse.jpg") End Sub
  • 8. If you want to get the picture in a picture box, you also use the picture property. • For example:-Here we copy the picture from picture1 to picture2 when the user clicks a command button: Private Sub Command1_Click() Picture2.Picture = Picture1.Picture End Sub
  • 9. You draw text in a picture box with its Print method passing that method the text you want to print.  Where does that text appear? It appears at the location set by the picture box’s currentX and CurrentY properties.  Private Sub Form_Load() Picture1.ScaleMode = vbPixels Picture1.CurrentX = 30 Picture1.CurrentY = 25 Picture1.Print ("It is displaying a content in picture box") End Sub
  • 10.
  • 11.  You can use format text in a picture box using the fontbold , fontitalic ,fontunderline properties.  When you set a property to true that property applies the next time you use the print method in the picture box.
  • 12.  Private Sub Form_Load() Picture1.ScaleMode = vbPixels Picture1.CurrentX = 30 Picture1.CurrentY = 25 Picture1.Print ("It is displaying a content in picture box") Picture1.CurrentX = 30 Picture1.CurrentY = Picture1.CurrentY + Picture1.TextHeight("") Picture1.FontUnderline = True Picture1.Print ("It is displaying a content in picture box") End Sub
  • 13.  The click event is useful if you want to use picture boxes as sort of image bearing buttons.  If you want to know where in a picture box the user clicked the mouse use mousedown.
  • 14.  Private Sub Form_Load() Picture1.ScaleMode = vbPixels Picture1.CurrentX = 25 Picture1.CurrentY = 20 Picture1.Print ("Picture Box") End Sub  Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If X > 16 And X < 83 And Y > 11 And Y < 36 Then MsgBox "you clicked the word ""picture""" End If If X > 83 And X < 125 And Y > 11 And Y < 36 Then MsgBox "you clicked the word ""box""" End If End Sub
  • 15. In a Picture Box you can draw lines and circle and set points to particular colors in a picture box.  To Draw Circle  Private Sub Command1_Click() Picture1.Circle (700, 800), 500, vbRed  End Sub  To Draw Line  Private Sub Command2_Click() Picture1.Line (1500, 1000)-(2500, 1000), vbRed  End Sub
  • 16.
  • 17.  1.Select the Project Components menu item.  2.Select the Controls tab in the Components box.  3.Select the Microsoft Windows Common Controls item in the Components box and click onOK to close that box.  4.Add a new image list control to your program using the Image List tool in the toolbox.  5.Right-click the new image list control and select the Properties item in the menu that opens.
  • 18.  6.Click the Images tab in the Property Pages box that opens, and load the images you want touse in the image list using the Insert Picture button.  7.Close the Property Pages box by clicking on OK.All that remains is to add the code you need. For example, here we’ve added a timer control,  Timer1to the program, set its Enabled property to False, and set its Interval property to 1000 .
  • 19.  You can copy the images to the clipboard , letting the user paste them into other programs.  To place data in the clipboard you use Setdata() , and to retrieve data from the Clipboard you use getdata().
  • 20.  Private Sub Command1_Click() Clipboard.SetData Picture1.Picture End Sub  Private Sub Command2_Click() Picture2.Picture = Clipboard.GetData() End Sub
  • 21. As they change shape, image controls stretch the image they contain. Picture boxes and forms do not.  Image controls are lightweight controls. This means that an image control will consume less memory and is faster to deal with than picture boxes.
  • 22.  Graphics methods which allow you to draw graphics on the fly at run time, can not be used to draw on image controls but they can draw on top of picture box controls.  A picture box’s can be used as container objects. This means other objects can be drawn and grouped inside them.
  • 23.  The way a value is printed or displayed is called its formatting.  Format Number  Format Currency  Format Percentage  Format Date Time
  • 24.  This function formats the number to two decimal places with commas. Syntax:- Formatnumber(number) Example:- formatnumber(87321.784) Output:- 87,321.78
  • 25.  This function formats a number as currency such as dollars and cents.  The number will also include a dollar sign or other currency symbol. Syntax:- Formatcurrency(number) Example:- Formatcurrency(2384921.387) Output:- “$2,384,921.39”
  • 26.  This function format its numeric argument as percent. Syntax:- Formatpercent(number) Example:- Formatpercent(.784) Output:- “78.40%”
  • 27.  This function takes a date datatype argument and format it in various ways. Syntax:- FormatDateTime(DateExpression [,Format]) Example:-FormatDateTime(now , vblongdate) Output:- “Wednesday,september 5,2012”