当前位置: 首页>>代码示例>>C#>>正文


C# Button.ModifyBg方法代码示例

本文整理汇总了C#中Button.ModifyBg方法的典型用法代码示例。如果您正苦于以下问题:C# Button.ModifyBg方法的具体用法?C# Button.ModifyBg怎么用?C# Button.ModifyBg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Button的用法示例。


在下文中一共展示了Button.ModifyBg方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        Random random = new Random ();

        List<Button> buttons = new List<Button> ();

        Table table = new Table (9, 10, true);

        //Opcion 1
        for (uint index = 0; index<90; index++) {

            Button button = new Button ();
            button.Label = (index+1).ToString();
            button.Visible = true;
            uint fila = index / 10;
            uint colum = index % 10;

            table.Attach (button, colum, colum+1, fila, fila+1);
            buttons.Add (button);
        }

        table.Visible = true;
        vbox5.Add (table);

        buttonNumero.Clicked += delegate {
            int indexAleatorio = random.Next(90)+1;
            Button button = buttons[indexAleatorio];
            button.ModifyBg(StateType.Normal, new Gdk.Color(0,255,0));
            indexAleatorio++;
            Process.Start("espeak", "-v es "+indexAleatorio);
        };
    }
开发者ID:jrenau,项目名称:ed,代码行数:35,代码来源:MainWindow.cs

示例2: MainWindow

	public MainWindow (): base (Gtk.WindowType.Toplevel)
	{
		Build ();

		random = new Random ();

		Table table = new Table (9, 10, true);

		List<int> numeros = new List<int> ();
		List<Button> ButtonsType = new List<Button> ();

//		for (uint row = 0; row < 9; row++)
//			for (uint column = 0; column < 10; column++)
//			{
//				uint index = row * 10 + column;
//				Button button = new Button ();
//				button.Label = (index + 1).ToString();
//				button.Visible = true;
//				table.Attach (button, column, column + 1, row, row + 1);
//			}

		for (uint index = 0; index < 90; index++) {
			uint row = index /10;
			uint column = index % 10;
			int numero = (int)index + 1;
			Button button = new Button ();
			button.Label = numero.ToString();
			button.Visible = true;
			table.Attach (button, column, column +1, row, row +1);
			Buttons.Add (button);
			numeros.Add (numero);

		Button button = new Button ();
		button.Label = "1";
		button.Visible = true;
		table.Attach (button, 0, 1, 0, 1);
		button.ModifyBg (StateType.Normal, new Gdk.Color (0, 255, 0));

		table.Visible = true;
		vbox1.Add (table);

		button.Clicked += delegate
		{
			int indexAleatorio = random.Next (numeros.Count);
			int numero = numeros[indexAleatorio];
			numeros.RemoveAt(indexAleatorio);

				//labelNumero.Text = numero.ToString;
			Button button = buttons[numero - 1];
			button.BodyfyBg (StateType.Normal, GREEN_COLOR);
			Process.start ("espeak", "-v es " + numero);
			buttonNumero.Sensitive = numeros.Count > 0;
			};
开发者ID:damdsanchez,项目名称:ed,代码行数:53,代码来源:MainWindow.cs

示例3: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        random = new Random ();

        Table table = new Table (9, 10, true);

        List<int> numeros = new List<int> ();
        List<Button> buttons = new List<Button> ();

        //Opción 1
        for (uint index = 0; index < 90; index++) {
            uint row = index / 10;
            uint column = index % 10;
            int numero = (int)index + 1;//el uint desborda el rangod de INT por eso le obligamos.
            Button button = new Button ();
            button.Label = numero.ToString();
            button.Visible = true;
            table.Attach (button, column, column + 1, row, row + 1);
            buttons.Add (button);
            numeros.Add (numero);
        }

        //Opción 2
        //for (uint row = 0; row < 9; row++)
        //for (uint column=0; column < 10; column++) {
        //uint index = row * 10 + column;
        //Button button = new Button ();
        //button.Label = (index + 1).ToString();
        //utton.Visible = true;
        //table.Attach (button, column, column + 1, row, row + 1);
        //}

        table.Visible = true;
        vbox1.Add (table);

        buttonNumero.Clicked += delegate {
            int indexAleatorio = random.Next (numeros.Count);
            int numero = numeros[indexAleatorio];
            numeros.RemoveAt(indexAleatorio);
            labelNumero.Text = numero.ToString();

            Button button = buttons[numero - 1];
            button.ModifyBg (StateType.Normal, GREEN_COLOR);
            Process.Start ("espeak", "-v es " + numero);
            buttonNumero.Sensitive= numeros.Count > 0; //Cuando todos los numeros han salido el boton "siguiente" se desactiva
            //DEVELOP BROKER
        };
    }
开发者ID:csobrino,项目名称:ed,代码行数:51,代码来源:MainWindow.cs

示例4: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();
        random = new Random ();
        random.Next(90)

        table = new Table (9, 10, true);
        List <int> numeros=new List <int> ();

        for (uint index=0;index<90; index++){
            uint row= index / 10;
            uint column = index %10;
            int numero = index+1;
            Button button = new Button();
            button.Label=numero.ToString();
            button.Visible = true;
            table.Attach (button, column, column +1, row, row+1);
            buttons.Add (button);
            numeros.Add (numero);
        }

        button = new Button ();
        button.Label = "1";
        button.Visible = true;

        table.Attach (button, 0, 1, 0, 1);
        table.Visible = true;
        vbox1.Add (table);
        vbox1.Add (button);

        Button b = new Button();
        b.ModifyBg(StateType.Normal, new Gdk.Color(0,255,0));
        Process.Start ("espeak", "-v es" + indexAleatorio);

        table.Visible = true;
        vbox1.Add (table);
    }
开发者ID:xavinavarro,项目名称:ed,代码行数:38,代码来源:MainWindow.cs

示例5: SetSelectedButtonColors

 void SetSelectedButtonColors(Button button)
 {
     button.ModifyBg (StateType.Active, new Gdk.Color (220, 220, 220));
     button.ModifyBg (StateType.Prelight, new Gdk.Color (160, 160, 180));
     button.ModifyBg (StateType.Normal, new Gdk.Color (160, 160, 160));
 }
开发者ID:turgaysenlet,项目名称:carry,代码行数:6,代码来源:MainWindow.cs


注:本文中的Button.ModifyBg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。