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

白云区网站建设mg126网址短码生成器

白云区网站建设mg126,网址短码生成器,诛仙3官方网站时竹任务荧灵怎么做,建筑网站排行榜C# WPF 打印机 打印机接口打印文本打印图片打印机属性对话框设置默认打印机搜索打印机 打印机接口 PrintServerPrintQueuePrintDocument 打印文本 /// summary /// 打印文本 /// /summary /// param nametext/param /// pa… C# WPF 打印机 打印机接口打印文本打印图片打印机属性对话框设置默认打印机搜索打印机 打印机接口 PrintServerPrintQueuePrintDocument 打印文本 /// summary /// 打印文本 /// /summary /// param nametext/param /// param namewidth/param /// param nameheight/param private void PrintText(string text, int width, int height) {// 创建一个PrintDocument对象PrintDocument pd new PrintDocument();// pd.DefaultPageSettings.Landscape true;// pd.DefaultPageSettings.PrinterSettings.PrinterName Gprinter GP-1134T; // 指定打印机// 设置打印机任务的事件处理pd.PrintPage (sender, e) {// 创建一个Bitmap对象用于绘制文本 using (Bitmap bitmap new Bitmap(width, height)){using (Graphics g Graphics.FromImage(bitmap)){// 使用白色填充背景g.FillRectangle(System.Drawing.Brushes.White, 0, 0, width, height);// 设置打印文本的格式StringFormat format new StringFormat();format.Alignment StringAlignment.Center;format.LineAlignment StringAlignment.Center;// 在位图上绘制文本g.DrawString(text, new Font(Arial, 12), System.Drawing.Brushes.Black, new RectangleF(0, 0, width, height), format);// 将位图发送到打印机e.Graphics.DrawImage(bitmap, 0, 0); }} };// 开始打印try{pd.Print();}catch (Exception ex){Console.WriteLine(ex.Message);} }打印图片 /// summary/// 打印图片/// /summary/// param nameimagePath图片文件路径/param/// param namewidth打印宽度像素/param/// param nameheight打印高度像素/paramprivate void PrintImage(string imagePath, int width, int height){if (File.Exists(imagePath)){PrintDocument pd new PrintDocument();pd.DefaultPageSettings.Landscape true;//pd.DefaultPageSettings.PrinterSettings.PrinterName Gprinter GP-1134T;Image image Image.FromFile(imagePath);// 设置打印机任务的事件处理pd.PrintPage (sender, e) {// 创建一个Bitmap对象用于绘制图片using (Bitmap bitmap new Bitmap(width, height)){using (Graphics g Graphics.FromImage(bitmap)){// 使用白色填充背景g.FillRectangle(System.Drawing.Brushes.Black, 0, 0, width, height);// 在位图上绘制图片g.DrawImage(image, 0, 0);// 将位图发送到打印机e.Graphics.DrawImage(bitmap, 0, 0);}} #if falseImage i Image.FromFile(imagePath);System.Drawing.Rectangle m e.MarginBounds;if ((double)i.Width / (double)i.Height (double)m.Width / (double)m.Height) // image is wider{m.Height (int)((double)i.Height / (double)i.Width * (double)m.Width);}else{m.Width (int)((double)i.Width / (double)i.Height * (double)m.Height);}e.Graphics.DrawImage(i, m); #endif};// 开始打印try{pd.Print();}catch (Exception ex){Console.WriteLine(ex.Message);}}}打印机属性对话框 private void btnPrintSettings_Click(object sender, RoutedEventArgs e) {// 打印机属性对话框PrintDialog printDialog new PrintDialog();if (printDialog.ShowDialog() true){// 用户点击了打印Console.WriteLine(打印);} }设置默认打印机 /// summary /// 设置默认打印机 /// /summary /// param nameprinterName/param public static void SetDefaultPrinter(string printerName) {PrintServer printServer new PrintServer(); // 默认的打印服务器PrintQueue printQueue new PrintQueue(printServer, printerName); // 根据打印机名称创建打印队列// 设置为默认打印机printQueue.Commit(); }搜索打印机 private void btnPrintSearch_Click(object sender, RoutedEventArgs e) {// 获取打印机列表并添加到ComboBoxPrintServer printServer new PrintServer();PrintQueueCollection printQueues printServer.GetPrintQueues();cmboxPrintList.Items.Clear(); // ComboBox控件foreach (PrintQueue p in printQueues){cmboxPrintList.Items.Add(p.Name);} }// 选择打印机 private void cmboxPrintList_SelectionChanged(object sender, SelectionChangedEventArgs e) {string pName cmboxPrintList.SelectedItem as string;Console.WriteLine(选择打印机);if (pName ! null){Console.WriteLine(默认打印机 pName);SetDefaultPrinter(pName);} }
http://www.zqtcl.cn/news/865947/

相关文章:

  • 郑州市建设工程造价信息网站浙江省建设工程质量管理协会网站
  • 乌兰浩特市建设局网站永州微网站建设
  • 做网站的用什么电脑好wordpress首页调用指定分类
  • 网站域名申请好了怎么建设网站室内设计培训班哪个学校好
  • 东莞厚街网站建设网页设计代码字号px
  • 网站建站免费淘宝优惠券网站建设总代
  • 茶叶网站设计建设工程监理招标网站
  • 网站建设发展历程做网站要多少钱 知乎
  • 丽江建设信息网站江门网站制作方案
  • 网站名注册移动端应用开发
  • 本地网站搭建流程短链接生成器app
  • 建网站需要哪些技术代做ppt网站
  • 在上海哪个网站比较好网站建设服务方案ppt模板
  • 天津网站优化流程uniapp微信小程序模板
  • 网站 搜索引擎 提交企业网站必须备案
  • 公司网站主页设计深圳搜索引擎
  • 织梦学校网站中国建设银行官方网站诚聘英才频道
  • 织梦网站去除技术支持网站建设热门吗
  • 手机自助网站建设电商首页设计
  • 个人做电影网站违法吗招标网站哪个好
  • 岱山县网站建设旅游网站制作
  • 深圳建网站三千哪些网站可以做微商品牌宣传
  • 做网站哪些软件比较好个人网站备案幕布
  • 用数据库代码做家乡网站专门做二维码的网站
  • 上海网站开发工程师招聘网网络维护公司需要什么资质
  • 迅速百度网站自然排名wordpress注册密码链接失效
  • 北京安慧桥网站建设金泉网做网站推广
  • 网站建设与管理书威海城乡与住房建设部网站
  • 邯郸网站设计公司设计师公司排名
  • 网站设计广州量计价格多少钱网站建设