1

私はWindowsPhone7アプリケーションを開発しています。私はWindowsPhone7アプリケーションを初めて使用します。私のアプリケーションでは、ボタンコントロールを動的に作成し、次のようにボタンコントロールに背景画像を追加しました。

Button AlphabetButton = new Button();
                AlphabetButton.Content = vAlphabet;
                ImageBrush brush = new ImageBrush();
                brush.ImageSource = new BitmapImage(new Uri("button_off.png", UriKind.Relative));
                //brush.Stretch = Stretch.None;
                AlphabetButton.Background = brush;
                AlphabetButton.BorderBrush = new SolidColorBrush(Colors.Gray);

                AlphabetButton.Margin = new Thickness(-12, -27, 0, 0);
                AlphabetButton.Width = 80;
                AlphabetButton.Height = 80;     

ボタンコントロールの境界線を削除したいのですが、その境界線では画像が要件どおりに表示されないためです。これを行う方法?ボタンコントロールの属性でこれを行うことはできますBorderThicknessか、それとも他の方法がありますか?上記の問題を解決するためのコードまたはリンクを教えてください。私が何か間違ったことをしているなら、私を導いてください。

4

2 に答える 2

10

最も簡単な方法は、例のようにBorderThicknessを0に設定することです。

            Button alphabetButton = new Button();
            alphabetButton.BorderThickness = new Thickness(0.0);

もう1つのオプションは、BorderBrushをTransparentに設定するか、ボタンのスタイル全体、特にそのControlTemplateを変更することです。

于 2011-02-08T12:05:47.667 に答える
0

Button.StrokeTHicknessは、境界線を調整するための正しいプロパティだと思います。

于 2011-02-08T12:21:34.767 に答える