Change border : Border « Windows Presentation Foundation « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » Windows Presentation Foundation » BorderScreenshots 
Change border
Change border
  
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="AboutDialog" MouseRightButtonDown="AboutDialog_MouseRightButtonDown"
        Title="About WPF Unleashed" SizeToContent="WidthAndHeight"
        Background="OrangeRed">
  <StackPanel>
    <Label FontWeight="Bold" FontSize="20" Foreground="White">
      WPF
    </Label>
    <Label>License</Label>
    <Label>Installed Dll:</Label>
    <ListBox>
      <ListBoxItem>1</ListBoxItem>
      <ListBoxItem>2</ListBoxItem>
      <ListBoxItem>3</ListBoxItem>
      <ListBoxItem>4</ListBoxItem>
      <ListBoxItem>5</ListBoxItem>
      <ListBoxItem>6</ListBoxItem>
      <ListBoxItem>7</ListBoxItem>
      <ListBoxItem>8</ListBoxItem>
      <ListBoxItem>9</ListBoxItem>
      
    </ListBox>
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
      <Button MinWidth="75" Margin="10">Help</Button>
      <Button MinWidth="75" Margin="10">OK</Button>
    </StackPanel>
    <StatusBar>test</StatusBar>
  </StackPanel>
</Window>
//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Controls

Public Partial Class AboutDialog
  Inherits Window
  Public Sub New()
    InitializeComponent()
  End Sub

  Private Sub AboutDialog_MouseRightButtonDown(sender As Object, e As MouseButtonEventArgs)
    Console.WriteLine("Source = " & e.Source.[GetType]().Name)
    Console.WriteLine("OriginalSource = " & e.OriginalSource.[GetType]().Name & " @ " & e.Timestamp)
    Dim source As Control = TryCast(e.Source, Control)
    If source.BorderThickness <> New Thickness(5Then
      source.BorderThickness = New Thickness(5)
      source.BorderBrush = Brushes.Black
    Else
      source.BorderThickness = New Thickness(0)
    End If
  End Sub
End Class

   
    
  
Related examples in the same category
1.Rotation showing bounding boxRotation showing bounding box
2.Mouse Enter and leave a BorderMouse Enter and leave a Border
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.