silverlight 5开发【vb版】(8)-checkbox和combobox
程序员文章站
2022-03-02 11:46:48
...
1、checkbox
选项控件
Checked和Unchecked事件最重要
2、combobox
下拉框控件
最重要的事件是
SelectionChanged 在当前选定项更改时发生
3、代码:
Partial Public Class MainPage Inherits UserControl Private currentlocation As Point Public Sub New() InitializeComponent() End Sub Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click ComboBox1.Items.Add(TextBox1.Text) End Sub Private Sub LayoutRoot_MouseMove(sender As System.Object, e As System.Windows.Input.MouseEventArgs) Handles LayoutRoot.MouseMove currentlocation = e.GetPosition(LayoutRoot) Label2.Content = "现在鼠标的坐标是:(" & currentlocation.X.ToString() & "," & currentlocation.Y.ToString() & ")" End Sub Private Sub CheckBox1_Checked(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles CheckBox1.Checked Label1.Content = "您好,您选中了!" End Sub Private Sub CheckBox1_Unchecked(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles CheckBox1.Unchecked Label1.Content = "您好,您没有选择!" End Sub Private Sub ComboBox1_SelectionChanged(sender As System.Object, e As System.Windows.Controls.SelectionChangedEventArgs) Handles ComboBox1.SelectionChanged Label4.Content = ComboBox1.SelectedValue End Sub End Class
上面这个代码,当在文本框中输入任何内容后,这些内容将做为下拉框的选项之一,也就是 说下拉框的选项是动态增加的
上一篇: Silverlight 5 轻松开启绚丽的网页3D世界
下一篇: 专业的网页测试工具 YSLOW
推荐阅读
-
silverlight 5开发【vb版】(6)-鼠标滚轮事件
-
silverlight 5开发【vb版】(11)- 样式与模板
-
silverlight 5开发【vb版】(12)-数据和RIA基础(2)
-
silverlight 5开发【vb版】(7)-silverlight 5开发工具包ISO
-
silverlight 5开发【vb版】(12)-数据和RIA基础(1)
-
silverlight 5开发【vb版】(5)-鼠标左右键事件
-
silverlight 5开发【vb版】(3)-简单鼠标事件处理
-
silverlight 5开发【vb版】(4)-容器
-
silverlight 5开发【vb版】(10)- 布局控件
-
silverlight 5开发【vb版】(3)-简单鼠标事件处理