博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2017-5-3 打印控件、MDI 窗体容器
阅读量:6341 次
发布时间:2019-06-22

本文共 3010 字,大约阅读时间需要 10 分钟。

打印控件:

要打印,第一步先要想到制作打印对象

PrintDocument - 默认事件

Font f = new Font("黑体",20);

Brush b = new SolidBrush(Color.Red);
e.Graphics.DrawString(textBox1.Text, f, b, 20, 50);

通过对于事件数据的绘制来制作要打印的内容

--------------------------------------------------------

MDI 窗体容器

 IsMdiContainer----------------确定该窗体是否是MDI容器

MenuStrip-------------------往MDI容器中放置的菜单

企业仓库,销售,财务三个模块的制作(用到MDI容器和唯一窗体):

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WindowsFormsApplication5{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        List
formlist = new List(); private void 仓库模块ToolStripMenuItem_Click(object sender, EventArgs e) { bool has = false; Form2 f2 = new Form2(); foreach(Form f in formlist) { if(f is Form2) { has = true; f2 = f as Form2; } } if (has == false) { f2.MdiParent = this; f2.WindowState = FormWindowState.Maximized; f2.Parent = panel1; f2.Show(); formlist.Add(f2); } else { foreach (Form f in formlist) { f.Hide(); } f2.Show(); } } private void 销售模块ToolStripMenuItem_Click(object sender, EventArgs e) { bool has = false; Form3 f3 = new Form3(); foreach (Form f in formlist) { if (f is Form3) { has = true; f3 = f as Form3; } } if (has == false) { f3.MdiParent = this; f3.WindowState = FormWindowState.Maximized; f3.Parent = panel1; f3.Show(); formlist.Add(f3); } else { foreach (Form f in formlist) { f.Hide(); } f3.Show(); } } private void 财务模块ToolStripMenuItem_Click(object sender, EventArgs e) { bool has = false; Form4 f4 = new Form4(); foreach (Form f in formlist) { if (f is Form4) { has = true; f4= f as Form4; } } if (has == false) { f4.MdiParent = this; f4.WindowState = FormWindowState.Maximized; f4.Parent = panel1; f4.Show(); formlist.Add(f4); } else { foreach (Form f in formlist) { f.Hide(); } f4.Show(); } } }}

 

 

转载于:https://www.cnblogs.com/zhengqian/p/6802650.html

你可能感兴趣的文章
艰困之道中学到的经验教训
查看>>
互联网生态建设落地五大挑战——保险科技生态建设 ...
查看>>
进行短视频app开发工作时,可以加入它来保护青少年 ...
查看>>
25G DAC无源高速线缆和25G光模块之间的区别
查看>>
乐乐茶完成近2亿元Pre-A轮融资,祥峰投资领投
查看>>
clickhouse修改时区
查看>>
CSS_定位
查看>>
第二十四章:页面导航(六)
查看>>
IP_VFR-4-FRAG_TABLE_OVERFLOW【cisco设备报错】碎片***
查看>>
Codeforces Round #256 (Div. 2) D. Multiplication Table 【二分】
查看>>
ARM汇编指令格式
查看>>
HDU-2044-一只小蜜蜂
查看>>
HDU-1394-Minimum Inversion Number
查看>>
京东基于Spark的风控系统架构实践和技术细节
查看>>
什么时候使用CountDownLatch
查看>>
C#之MemberwiseClone与Clone
查看>>
Android性能优化之利用Rxlifecycle解决RxJava内存泄漏
查看>>
转: 如何为你的开源项目选择一个合适的开源协议?
查看>>
Atitit 记录方法调用参数上下文arguments
查看>>
webstorm常用功能FTP,及常用快捷键
查看>>