3
Change Background Image and Style In this tutorial, you will learn how to change a form background, and choose a style. For this tutorial you need a button, 5 radio buttons and OpenFileDialog Change Background button click event: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim OpenFileDialog1 As New OpenFileDialog With OpenFileDialog1 .CheckFileExists = True .ShowReadOnly = False .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg" .FilterIndex = 2 If .ShowDialog = DialogResult.OK Then Me.BackgroundImage = Image.FromFile(.FileName) End If

Change Background Image and DA

Embed Size (px)

DESCRIPTION

SADASD

Citation preview

Change Background Image and StyleIn this tutorial, you will learn how to change a form background, and choose a style.

For this tutorial you need a button, 5 radio buttons and OpenFileDialog

Change Background button click event:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickDim OpenFileDialog1 As New OpenFileDialogWith OpenFileDialog1.CheckFileExists = True.ShowReadOnly = False.Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg".FilterIndex = 2If .ShowDialog = DialogResult.OK ThenMe.BackgroundImage = Image.FromFile(.FileName)End IfEnd WithEnd Sub

Tile Style radio button code:Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChangedMe.BackgroundImageLayout = ImageLayout.TileEnd Sub

Center:Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChangedMe.BackgroundImageLayout = ImageLayout.CenterEnd Sub

Stretch:Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChangedMe.BackgroundImageLayout = ImageLayout.StretchEnd Sub

Zoom:Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChangedMe.BackgroundImageLayout = ImageLayout.ZoomEnd Sub

To remove background image:Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChangedMe.BackgroundImage = NothingEnd Su