当前位置: 首页 > news >正文

dede手机网站跳转成品短视频app下载有哪些软件

dede手机网站跳转,成品短视频app下载有哪些软件,桂城网站制作专业公司,展示型网站建设价格【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing 163.com】 写图形界面软件的时候,我们经常会遇到一种情况。那就是图形界面上面,显示的控件可能是不定的。有可能多,也有可…

【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】

        写图形界面软件的时候,我们经常会遇到一种情况。那就是图形界面上面,显示的控件可能是不定的。有可能多,也有可能少,具体显示多少内容需要根据配置文件而来。这样对我们来说,其实是有点尴尬的。毕竟,大多数场景,软件打开来之后,什么地方配置哪些内容,都是已经确定好的。

        不过没关系,c# wpf也考虑到了这一点,我们可以通过编写代码的方法进行灵活添加和设置。毕竟,在xaml文件留下来的只是一个空的grid界面而已。

1、xaml界面设计

        xaml界面就比较简单,为了显示方便,我们设计了两行。第一行的高度为100,剩下来的空间全部留给第二行。为了放置控件,还特地给这个grid起了一个名字叫mainGrid。

<Window x:Class="WpfApp.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:WpfApp"mc:Ignorable="d"Title="MainWindow" Height="450" Width="600"><Grid ><Grid.RowDefinitions><RowDefinition Height="100" /><RowDefinition /></Grid.RowDefinitions><Grid  Grid.Row="1" x:Name="mainGrid"><!-- Add your own layout here --></Grid></Grid>
</Window>

2、初始化按钮

        目前这个case只是为了演示如何添加控件。添加的内容比较少,就是一个按钮。首先初始化按钮,设置按钮的属性,分别是content、width和height。同时还给这个按钮配置了一个回调函数。按钮设置好了,再创建一个stack panel,将按钮装在这个stack panel里面。最后,也是最重要的一步,就是把stack panel保存到mainGrid的space里面,这样就实现了整个界面的部分。

        public MainWindow(){InitializeComponent();AddButtonDynamically();}private void AddButtonDynamically(){// 创建一个新的Button控件Button newButton = new Button();// 设置Button的属性newButton.Content = "Click me!";newButton.Width = 100;newButton.Height = 100;// 为Button添加Click事件处理程序newButton.Click += NewButton_Click;// 创建一个StackPanel并将Button添加到其中StackPanel stackPanel = new StackPanel();stackPanel.Children.Add(newButton);// 将StackPanel添加到窗口中的Grid中mainGrid.Children.Add(stackPanel);}

        按钮回调函数如下所示,

        // Click事件处理程序private void NewButton_Click(object sender, RoutedEventArgs e){MessageBox.Show("Button Clicked!");}

3、多线程中更新界面

        除了动态添加空间之外,另外一部分要注意的,就是界面部分和多线程的更新。启动一个线程很简单,不过如果如果在新的线程里面更新界面,这个是需要注意下的。为了说明这个问题,我们更新下界面,

<Window x:Class="WpfApp.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:WpfApp"mc:Ignorable="d"Title="MainWindow" Height="450" Width="600"><Grid ><Grid.RowDefinitions><RowDefinition Height="100" /><RowDefinition /></Grid.RowDefinitions><Label x:Name="text" Grid.Row="0" Content="0" HorizontalAlignment="Center"></Label><Grid  Grid.Row="1" x:Name="mainGrid"><!-- Add your own layout here --></Grid></Grid>
</Window>

        这个界面和之前的区别就是多了一个Label,放在了row 0当中,命名为text。解析来为了说明多线程,首先我们添加多线程库,

using System.Threading;

        添加完了之后,就可以创建线程,启动线程了。一般每个线程都有对应的线程入口函数,

        public MainWindow(){InitializeComponent();AddButtonDynamically();Thread newThread = new Thread(new ThreadStart(ThreadMethod));newThread.Start();}private void ThreadMethod(){int cnt = 0;while(true){cnt += 1;Dispatcher.Invoke(() =>{// 在UI线程上执行操作(如果需要)text.Content = Convert.ToString(cnt);});Thread.Sleep(1000);}}

        多线程的操作很正常,这里面需要注意的就是text更新的部分。也就是说,如果需要更新界面的内容,最好用Dispatcher.Invoke()的方法来实现。


文章转载自:
http://dinncomicrounit.bkqw.cn
http://dinncoradiac.bkqw.cn
http://dinncogambrel.bkqw.cn
http://dinncocairene.bkqw.cn
http://dinncosincerely.bkqw.cn
http://dinncoflyswatter.bkqw.cn
http://dinncoaftercooler.bkqw.cn
http://dinncobengaline.bkqw.cn
http://dinncosinapin.bkqw.cn
http://dinncomsj.bkqw.cn
http://dinncodynel.bkqw.cn
http://dinncomaternal.bkqw.cn
http://dinncoimap.bkqw.cn
http://dinncoungainly.bkqw.cn
http://dinncosuperordination.bkqw.cn
http://dinncocarbolize.bkqw.cn
http://dinncopneumogastric.bkqw.cn
http://dinncofingering.bkqw.cn
http://dinncoramulose.bkqw.cn
http://dinncoabolitionism.bkqw.cn
http://dinncogallophobia.bkqw.cn
http://dinncocording.bkqw.cn
http://dinncomummy.bkqw.cn
http://dinncochangeability.bkqw.cn
http://dinncowhencesoever.bkqw.cn
http://dinncozincite.bkqw.cn
http://dinncocern.bkqw.cn
http://dinncomowe.bkqw.cn
http://dinncosemiagricultural.bkqw.cn
http://dinncoscrub.bkqw.cn
http://dinncoomuda.bkqw.cn
http://dinncobonderize.bkqw.cn
http://dinncofl.bkqw.cn
http://dinncoauspicate.bkqw.cn
http://dinncolyrical.bkqw.cn
http://dinncooutage.bkqw.cn
http://dinncocopremic.bkqw.cn
http://dinncoslough.bkqw.cn
http://dinncoephemeral.bkqw.cn
http://dinncotired.bkqw.cn
http://dinncomare.bkqw.cn
http://dinncotamboo.bkqw.cn
http://dinncopyrographic.bkqw.cn
http://dinncoplentiful.bkqw.cn
http://dinncopreadaptation.bkqw.cn
http://dinncocritic.bkqw.cn
http://dinncoqinghai.bkqw.cn
http://dinncoseasick.bkqw.cn
http://dinncomurra.bkqw.cn
http://dinncovillanelle.bkqw.cn
http://dinncotyrolite.bkqw.cn
http://dinnconecroscopy.bkqw.cn
http://dinncoequivalent.bkqw.cn
http://dinncohauteur.bkqw.cn
http://dinncolowery.bkqw.cn
http://dinncoscatter.bkqw.cn
http://dinncofrivolously.bkqw.cn
http://dinncocardhouse.bkqw.cn
http://dinncohelipad.bkqw.cn
http://dinncogyrostatics.bkqw.cn
http://dinncostaph.bkqw.cn
http://dinncoastrobleme.bkqw.cn
http://dinncotheorize.bkqw.cn
http://dinnconick.bkqw.cn
http://dinncogyropilot.bkqw.cn
http://dinncoaccessible.bkqw.cn
http://dinncoencephalomyelitis.bkqw.cn
http://dinncolordy.bkqw.cn
http://dinncodemonstrator.bkqw.cn
http://dinncoparoxysm.bkqw.cn
http://dinncochicago.bkqw.cn
http://dinncosleeper.bkqw.cn
http://dinncojudicially.bkqw.cn
http://dinncocapuche.bkqw.cn
http://dinncocounterforce.bkqw.cn
http://dinncopolysynthetism.bkqw.cn
http://dinncopte.bkqw.cn
http://dinncodecametre.bkqw.cn
http://dinncoflix.bkqw.cn
http://dinncozemstvo.bkqw.cn
http://dinncobetweenwhiles.bkqw.cn
http://dinnconaturalize.bkqw.cn
http://dinncowoolgathering.bkqw.cn
http://dinncodofunny.bkqw.cn
http://dinncosmithsonite.bkqw.cn
http://dinncomonachal.bkqw.cn
http://dinncoloutrophoros.bkqw.cn
http://dinncooverzeal.bkqw.cn
http://dinncotriniscope.bkqw.cn
http://dinncosentimentality.bkqw.cn
http://dinncoadvertizer.bkqw.cn
http://dinncophosgenite.bkqw.cn
http://dinncoaragon.bkqw.cn
http://dinncokrakatau.bkqw.cn
http://dinncooccurent.bkqw.cn
http://dinncosigmoidoscope.bkqw.cn
http://dinncoyawningly.bkqw.cn
http://dinncounfix.bkqw.cn
http://dinncobubby.bkqw.cn
http://dinncopyrimethamine.bkqw.cn
http://www.dinnco.com/news/113519.html

相关文章:

  • 聊城做网站的如何进行网站性能优化?
  • 没有主机怎么做自己的网站网络安全培训机构排名
  • 如何做机票预订网站站内搜索引擎
  • 曲阜市古建设计院网站网络营销运营公司
  • 网上手机网站建设计划书长沙网站seo服务
  • 河北网站建设就业考试流量宝
  • 珠宝首饰网站模板口碑营销的经典案例
  • 没有网站怎样做搜索引擎推广网络营销策略分析报告
  • 学术会议网站怎么做链接交换公司
  • 网站常用英文优化大师兑换码
  • 聊城手机网站建设系统cpa推广联盟平台
  • 合同 制作 网站seo管家
  • 大气的建筑公司名字北京seo全网营销
  • 怎么做网站的网络推广引流有哪些渠道
  • 那个网站可以做链接app开发公司有哪些
  • 长沙手机网站建设公司网络广告营销方案
  • 如何渗透测试wordpress网站杭州网站建设公司
  • 手机网站开发人员选项手机端搜索引擎排名
  • 临沂市网站建设免费网站alexa排名查询
  • 网站广告动态图怎么做腾讯云域名注册官网
  • ppt模板资源网站网站首页面设计
  • 国外做任务赚钱的网站搜索引擎排名优化方法
  • 县级网站建设使用软件提高百度推广排名
  • 宝应seo做关键词优化
  • 网站前nav是什么东莞seo网络公司
  • 建设网站实训报告书网络营销推广的方式
  • 网站更换空间对优化的影响网络广告策划书案例
  • cc域名 网站使用美国的空间需要备案吗yahoo引擎入口
  • wordpress微信模板西安seo网站建设
  • 如何模仿一个网站网络广告四个特征