Change window cursor : Window Style « Windows Presentation Foundation « VB.Net Tutorial






<Window x:Class="EightBall.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Eight Ball Answer" Height="328" Width="412" >
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="*" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Grid.Background>
      <LinearGradientBrush>
        <LinearGradientBrush.GradientStops>
          <GradientStop Offset="0.00"  Color="Red" />
          <GradientStop Offset="0.50" Color="Indigo" />
          <GradientStop Offset="1.00" Color="Violet" />
        </LinearGradientBrush.GradientStops>
      </LinearGradientBrush>
    </Grid.Background>
    <TextBox VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10,10,13,10" Name="txtQuestion" 
             TextWrapping="Wrap" FontFamily="Verdana" FontSize="24"
             Grid.Row="0" >
      text
    </TextBox>
    <Button VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,0,0,20" Width="127" Height="23" Name="cmdAnswer"
            Click="cmdAnswer_Click" 
            Grid.Row="1">      
      Click
      </Button>
    <TextBox VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10,10,13,10" Name="txtAnswer" 
             TextWrapping="Wrap" IsReadOnly="True" FontFamily="Verdana" FontSize="24" Foreground="Green"
             Grid.Row="2">
      text
    </TextBox>    
  </Grid>
</Window>

//File:Window.xaml.vb

Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Imports System.Windows.Input

Namespace EightBall
  Public Partial Class Window1
    Inherits Window

    Public Sub New()
      InitializeComponent()
    End Sub

    Private Sub cmdAnswer_Click(sender As Object, e As RoutedEventArgs)
      Me.Cursor = Cursors.Wait
      System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1))

      txtAnswer.Text = "asdf"
      Me.Cursor = Nothing
    End Sub

  End Class
End Namespace
WPF Change Window Cursor








16.59.Window Style
16.59.1.Change window cursorChange window cursor
16.59.2.Non-Rectangular windowNon-Rectangular window
16.59.3.Transparent WindowTransparent Window
16.59.4.Create a non-rectangular windowCreate a non-rectangular window
16.59.5.Windows Transparent BackgroundWindows Transparent Background