zoukankan      html  css  js  c++  java
  • c# windows编程控件学习-2

     1 using System;
     2 using System.Collections.Generic;
     3 using System.ComponentModel;
     4 using System.Data;
     5 using System.Drawing;
     6 using System.Linq;
     7 using System.Text;
     8 using System.Threading.Tasks;
     9 using System.Windows.Forms;
    10 
    11 namespace proj_92
    12 {
    13     public partial class Form1 : Form
    14     {
    15         public Form1()
    16         {
    17             InitializeComponent();
    18         }
    19 
    20         private void Form1_Load(object sender, EventArgs e)
    21         {
    22             checkedListBox1.Items.Add("中国"); checkedListBox1.Items.Add("美国");
    23             checkedListBox1.Items.Add("俄罗斯"); checkedListBox1.Items.Add("英国");
    24             checkedListBox1.Items.Add("法国"); checkedListBox1.CheckOnClick = true;
    25             textBox1.Text = DateTime.Now.ToString("h:mm:ss");
    26             timer1.Enabled = true;
    27             timer1.Interval = 2000;
    28 
    29             hScrollBar1.Maximum = 100; hScrollBar1.Minimum = 0;
    30             hScrollBar1.SmallChange = 2; hScrollBar1.LargeChange = 5;
    31             vScrollBar1.Maximum = 100; vScrollBar1.Minimum = 0;
    32             vScrollBar1.SmallChange = 2; vScrollBar1.LargeChange = 5;
    33             hScrollBar1.Value = 0; vScrollBar1.Value = 0;
    34 
    35             dateTimePicker1.Format = DateTimePickerFormat.Long;
    36             dateTimePicker1.ShowCheckBox = true;
    37             dateTimePicker1.ShowUpDown = false;
    38             textBox3.Text = "";
    39 
    40             linkLabel1.LinkColor = Color.Blue;
    41             linkLabel1.ActiveLinkColor = Color.Green;
    42 
    43 
    44         }
    45 
    46         private void button1_Click(object sender, EventArgs e)
    47         {
    48             foreach (object  item in checkedListBox1 .CheckedItems )
    49             {
    50                 listBox1.Items.Add(item);
    51             }
    52         }
    53 
    54         private void timer1_Tick(object sender, EventArgs e)
    55         {
    56             textBox1.Text = DateTime.Now.ToString("h:mm:ss");
    57 
    58         }
    59 
    60         private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
    61         {
    62             textBox2.Text = hScrollBar1.Value.ToString("d");
    63             vScrollBar1.Value = hScrollBar1.Value;
    64         }
    65 
    66         private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
    67         {
    68             textBox2.Text = vScrollBar1.Value.ToString("d");
    69             hScrollBar1.Value = vScrollBar1.Value;
    70         }
    71 
    72         private void button2_Click(object sender, EventArgs e)
    73         {
    74             if (Convert .ToInt16 (textBox2 .Text )>=0 && Convert .ToInt16 (textBox2 .Text )<=100 )
    75             {
    76                 hScrollBar1.Value = Convert.ToInt16(textBox2.Text);
    77                 vScrollBar1.Value = Convert.ToInt16(textBox2.Text);
    78             }
    79         }
    80 
    81         private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
    82         {
    83             textBox3.Text = dateTimePicker1.Value.ToString("yyyy.MM.dd hh:mm:ss");
    84         }
    85 
    86         private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    87         {
    88             System.Diagnostics.Process.Start("http://blog.sina.com.cn/s/articlelist_2379298071_0_1.html");
    89         }
    90     }
    91 }

    带复选框的列表控件,定时器控件,滚动条控件,月历控件,日期时间控件,超链接控件

  • 相关阅读:
    [Mise] Refetch API data when a state value changes with the `$watch` property in Alpine JS
    Android之用自定义的shape去实现shadow效果
    http抓包以及网速限定
    ios成长之每日一遍(day 7)
    ios成长之每日一遍(day 6)
    ios成长之每日一遍(day 5)
    ios成长之每日一遍(day 4)
    ios成长之每日一遍(day 3)
    ios成长之每日一遍(day 2)
    ios成长之每日一遍(day 1)
  • 原文地址:https://www.cnblogs.com/zhubinglong/p/5904578.html
Copyright © 2011-2022 走看看