Applying a background color to an entire Grid row in XAML Silverlight

В следующем примере из MSDN показано, как установить свойство ProcessorAffinity для экземпляра Notepad для первого процессора.

using System;
using System.Diagnostics;

namespace ProcessThreadIdealProcessor
{
    class Program
    {
     static void Main(string[] args)
        {
        // Make sure there is an instance of notepad running.
        Process[] notepads = Process.GetProcessesByName("notepad");
        if (notepads.Length == 0)
            Process.Start("notepad");
            ProcessThreadCollection threads;
            //Process[] notepads; 
            // Retrieve the Notepad processes.
            notepads = Process.GetProcessesByName("Notepad");
            // Get the ProcessThread collection for the first instance
            threads = notepads[0].Threads;
            // Set the properties on the first ProcessThread in the collection
            threads[0].IdealProcessor = 0;
            threads[0].ProcessorAffinity = (IntPtr)1;
        }
    }
}

23
задан Mike Cialowicz 27 October 2010 в 19:56
поделиться

1 ответ

Если вы хотите смоделировать два цвета в вертикальном порядке, вы также можете использовать свойство Смещение. Если вы установите эти два значения на одно и то же, вы получите симуляцию:

<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="Green" Offset="0.366" />
                <GradientStop Color="Red" Offset="0.366" />
            </LinearGradientBrush>
</Border.Background>

Вы можете сделать еще больше:)

<Border.Background>
   <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
     <GradientStop Color="Green" Offset="0.3" />
     <GradientStop Color="Red" Offset="0.3" />
     <GradientStop Color="Red" Offset="0.7" />
    <GradientStop Color="Yellow" Offset="0.7" />
    <GradientStop Color="Yellow" Offset="0.9" />
    <GradientStop Color="Blue" Offset="0.9" />
  </LinearGradientBrush>
</Border.Background>
0
ответ дан 29 November 2019 в 01:43
поделиться
Другие вопросы по тегам:

Похожие вопросы: