msdn上的代码,有疑问
If Me.BackgroundImageLayout = ImageLayout.Stretch Then
Me.BackgroundImageLayout = ImageLayout.Center
Else
Me.BackgroundImageLayout = ImageLayout.Stretch
End If
为什么if后面跟的是赋值。。。。
而且根据msdn上的介绍,最后不能完成他所描述的功能
[解决办法]
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.BackgroundImage = Image.FromFile("c:\1.jpg")'加载一张图片,路径自己设置 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click'单击观查结果 If Me.BackgroundImageLayout = ImageLayout.Stretch Then Me.BackgroundImageLayout = ImageLayout.Center'显示在中央 Else Me.BackgroundImageLayout = ImageLayout.Stretch'拉伸满背景(form背景) End If End SubEnd Class