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

小语种网站建设电商是做什么的

小语种网站建设,电商是做什么的,潜江网站搭建,游戏网站做关键字昨晚在stack overflow刷问题时看到有这个问题,今天早上刚好来尝试学习一下 stack overflow的链接如下: c# - How to render a WPF UserControl to a bitmap without creating a window - Stack Overflow 测试步骤如下: 1 新建.net frame…

昨晚在stack  overflow刷问题时看到有这个问题,今天早上刚好来尝试学习一下

stack overflow的链接如下:

c# - How to render a WPF UserControl to a bitmap without creating a window - Stack Overflow

测试步骤如下:

1  新建.net framework 3.5的wpf窗体程序

2 默认的窗体的xaml代码如下:

<Window x:Class="WpfDemo.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:WpfDemo"xmlns:s="clr-namespace:System;assembly=mscorlib"mc:Ignorable="d"Title="MainWindow" Height="450" Width="800"><Grid><StackPanel HorizontalAlignment="Left"><TextBox>123455</TextBox><Button x:Name="btnEnter" Click="BtnEnter_Click" Content="确定"></Button></StackPanel></Grid>
</Window>

窗体效果如下:

对应的后台代码如下:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;namespace WpfDemo
{/// <summary>/// MainWindow.xaml 的交互逻辑/// </summary>public partial class MainWindow : Window{public MainWindow(){InitializeComponent();}private void BtnEnter_Click(object sender, RoutedEventArgs e){RenderControl(this);MessageBox.Show("保存完成");}void RenderControl(Control renderControl){RenderTargetBitmap bmp = new RenderTargetBitmap((int)renderControl.Width, (int)renderControl.Height, 0, 0, PixelFormats.Pbgra32);bmp.Render(renderControl);var encoder = new PngBitmapEncoder();encoder.Frames.Add(BitmapFrame.Create(bmp));using (Stream stm = File.Create("test.png"))encoder.Save(stm);}}
}

3  运行程序,点击确定按钮,会在bin/Debug目录下生成MainWindow窗体对应的png图片,png图片名称为test.png,如下图:

http://www.wangmingla.cn/news/159789.html

相关文章:

  • 盐城专业网站建设哪家好个人怎么做网络推广
  • 各省网站备案时长营销战略
  • 建网站的手机软件免费建站系统
  • 用asp做网站题目网站怎么优化关键词快速提升排名
  • 做计算机题目的网站宁波网站推广营销
  • 新人做网站不懂设计版面怎么办淘宝指数在哪里查询
  • 网站建设的安全可行性seo网络推广公司
  • 制作xml网站地图文件百度免费推广有哪些方式
  • 在谷歌上做网站广告要多少钱百度指数峰值查询
  • 物联网 网站开发推广引流平台
  • 宝安的医院网站建设外链吧官网
  • 网络营销网站建设方案电商的推广方式有哪些
  • 金华做网站最专业的公司目前好的推广平台
  • 企业品牌网站建设公司哪家竞价托管专业
  • app手机网站建设黄重庆网页搜索排名提升
  • 电商有创意名字seo优化标题 关键词
  • 临沂网站排名深圳排名seo
  • 用自己的计算机做服务器建网站百度智能建站平台
  • wordpress 主题配置seo怎么发外链的
  • 许昌网站开发自己有货源怎么找客户
  • 服装购物商城网站建设seo咨询解决方案
  • 康复网站模板怎么做2023年8月疫情爆发
  • 政府网站建设指标体系河南关键词排名顾问
  • 无锡网站外包电池优化大师下载
  • 真么做网站全网推广系统
  • 成都优化网站厂家湖人最新消息
  • 郑州门户网站开发我要推广网
  • 商务网站建设与运营企业网站建设流程
  • 电子商务网站有哪些和网址百度小程序入口
  • wordpress怎样发询盘长沙seo运营