A short ppt - PowerPoint PPT Presentation

About This Presentation
Title:

A short ppt

Description:

Note: I didn't take time to figure out how to get it to look in the application directory ... Dim f As New System.Drawing.Font('SansSerif', 12) lbl1.Font = f ... – PowerPoint PPT presentation

Number of Views:14
Avg rating:3.0/5.0
Slides: 13
Provided by: higg2
Category:
Tags: drawing | figure | ppt | short

less

Transcript and Presenter's Notes

Title: A short ppt


1
A short ppt
  • Importing images
  • Changing fonts

2
Getting images
3
Combobox image.fromFile
4
Combo box
  • Select the collection property to populate the
    combo box
  • I used
  • Picturebox.imageimage.fromfile(C\penguin.gif)
  • My combobox selected index changed sub code is
    below
  • If cbbchoose.Text "dog" Then
  • pb.Image Image.FromFile("c\dog.gif"
    )
  • ElseIf cbbchoose.Text "bear" Then
  • pb.Image Image.FromFile("c\bear.gif
    ")
  • Else
  • pb.Image Image.FromFile("c\penguin.
    gif")
  • 'pb.Refresh()
  • End If
  • Note I didnt take time to figure out how to get
    it to look in the application directory

5
Changing fonts via button press
6
I didnt figure out how to get a font literal in
this application
7
code
  • Private Sub btnfont3_Click(ByVal sender As
    System.Object, ByVal e As System.EventArgs)
    Handles btnfont3.Click
  • lbldisplay.Font btnfont3.Font()
  • End Sub
  • Private Sub btnfont1_Click(ByVal sender As
    System.Object, ByVal e As System.EventArgs)
    Handles btnfont1.Click
  • lbldisplay.Font btnfont1.Font()
  • End Sub
  • Private Sub btnfont2_Click(ByVal sender As
    System.Object, ByVal e As System.EventArgs)
    Handles btnfont2.Click
  • lbldisplay.Font btnfont2.Font()
  • End Sub

8
Literal font names
9
Press button to change font
10
code
  • Private Sub btn3_Click(ByVal sender As
    System.Object, ByVal e As System.EventArgs)
    Handles btn3.Click
  • Dim f As New System.Drawing.Font("Arial",
    10)
  • ' Assign the font to the control
  • lbl1.Font f
  • ' To set additional properties, you must
    create a new Font object.
  • lbl1.Font f
  • 'lbl1.Font New System.Drawing.Font(lbl1.
    Font, FontStyle.Bold Or FontStyle.Italic)
  • End Sub
  • Private Sub Btn2_Click(ByVal sender As
    System.Object, ByVal e As System.EventArgs)
    Handles Btn2.Click
  • Dim f As New System.Drawing.Font("Symbol",
    12)
  • lbl1.Font f
  • ' or use...
  • 'lbl1.Font New System.Drawing.Font(f,
    FontStyle.Bold)
  • End Sub
  • Private Sub btn1_Click(ByVal sender As
    System.Object, ByVal e As System.EventArgs)
    Handles btn1.Click
  • Dim f As New System.Drawing.Font("SansSeri
    f", 12)
  • lbl1.Font f
  • lbl1.Font New System.Drawing.Font(lbl1.F
    ont, FontStyle.Underline)
  • End Sub

11
Image.fromfile(P\...) does work in F306 lab a
screenshot
12
Code for previous slide
  • Private Sub Form1_Load(ByVal sender As
    System.Object, ByVal e As System.EventArgs)
    Handles MyBase.Load
  • PictureBox1.Image Image.FromFile("p\afr
    ica1.jpg")
  • End Sub
Write a Comment
User Comments (0)
About PowerShow.com