关于WPF中控件的一些疑惑,求指导(急急急!!!)

simon1990 2012-07-24 04:45:44
我用的环境是vs2010 现在想用wpf实现一个功能就是点击一个button,当前界面会变成灰色透明的,并且灰色的界面上还有一些新的button出现,这类似于2012的popup控件里添加一些button,不知道vs2010中有没有对应的控件提供,还是2010中本来就有popup(但是我在toolbox里没有找到啊。。。),初学者,求指导
...全文
140 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ohkuy 2012-07-24
  • 打赏
  • 举报
回复
在布局时将要新加的那几个button隐藏
<Button Height="25" Visibility="Hidden">OK</Button>
点击后将Hidden改为Visible即可
sxs12000 2012-07-24
  • 打赏
  • 举报
回复
namespace test
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

private void button1_Click(object sender, RoutedEventArgs e)
{
this.textBox1.Text = "点击按钮随机改变颜色";
Random rand1 = new Random();
this.gird.Background = new SolidColorBrush
(Color.FromRgb(Convert.ToByte(rand1.Next(0, 255)),
Convert.ToByte(rand1.Next(0, 255)),
Convert.ToByte(rand1.Next(0, 255))));
}
}
}




<Window x:Class="test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid Name="gird">
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="311,203,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="192,118,0,0" Name="textBox1" VerticalAlignment="Top" Width="212" />
</Grid>
</Window>

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧