FrontPage

ウインドウタイトルをなくすには、こんな記述がいいみたい。

<Window x:Name="w1" x:Class="clock1.MainWindow"
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       Title="MainWindow" VerticalAlignment="Center" VerticalContentAlignment="Center" Height="231" Width="221" WindowStyle="None">
 <Canvas x:Name="canvas1" Width="200" Height="200" MouseLeftButtonDown="canvasleftdown">
 :
 :
 </Canvas>
</Window>

そう、ここね。

WindowStyle="None"

ここを書き換えればいいのね。ちなみに意味はこんな感じ。→ WindowStyle

タイトルバーがない以上、ウインドウの移動をどこかでしなくちゃだけど、それはここでやるの。

<Canvas x:Name="canvas1" Width="200" Height="200"MouseLeftButtonDown="canvasleftdown">

マウス左ボタン押下(MouseLeftButtonDown)の時に、 canvasleftdown を呼べって書いてあるでしょう?で、コードの方は以下ね。

      private void canvasleftdown(object sender, MouseButtonEventArgs e)
       {
           this.DragMove();
       }

これで、このウインドウはタイトルバーなしで移動できるわ。


トップ   編集 凍結解除 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-02-04 (木) 13:16:32