zoukankan      html  css  js  c++  java
  • Winform 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.Windows.Forms;
    using WindowsFormsApplication1.App_Code;
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1(Users u)
            {
                InitializeComponent();
    
                if (!u.pre.Contains("1"))
                {
                    销售ToolStripMenuItem.Visible = false;
                }
    
                if (!u.pre.Contains("2"))
                {
                    仓库ToolStripMenuItem.Visible = false;
                }
    
                if (!u.pre.Contains("3"))
                {
                    财务ToolStripMenuItem.Visible = false;
                }
    
                if (!u.pre.Contains("4"))
                {
                    综合管理ToolStripMenuItem.Visible = false;
                }
    
    
            }
    
            private void 销售ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form2 f2 = new Form2();
    
                f2.WindowState = FormWindowState.Maximized;
    
                f2.FormBorderStyle = FormBorderStyle.None;
    
                f2.MdiParent = this;
    
                f2.Parent = panel1;
    
                f2.Show();
            }
    
            private void Form1_SizeChanged(object sender, EventArgs e)
            {
                foreach (var c in panel1.Controls)
                {
                    if (c is Form2)
                    {
                        (c as Form2).WindowState = FormWindowState.Normal;
                        (c as Form2).WindowState = FormWindowState.Maximized;
                    }
                
                }
            }
    
            private void 仓库ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form3 f2 = new Form3();
    
                f2.WindowState = FormWindowState.Maximized;
    
                f2.FormBorderStyle = FormBorderStyle.None;
    
                f2.MdiParent = this;
    
                f2.Parent = panel1;
    
                f2.Show();
            }
    
        }
    }
    复制代码

    简单通讯

    复制代码
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using tongxun.App_Code;
    using WindowsFormsApplication1.App_Code;
    
    namespace tongxun
    {
        public partial class Form3 : Form
        {
            Users F = null;
            Users T = null;
    
            public Form3(Users from, Users to)
            {
                InitializeComponent();
    
                label1.Text = from.UserName;
                label2.Text = to.UserName;
    
                F = from;
                T = to;
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                Context c = new Context();
                c.from = label1.Text;
                c.to = label2.Text;
                c.txt = richTextBox2.Text;
                c.state = false;
    
                new ContextData().Insert(c);
    
                richTextBox1.Text += F.NickName + "对" + T.NickName + "说:
    ";
                richTextBox1.Text += richTextBox2.Text + "
    ";
                richTextBox2.Text = "";
            }
            List<Context> cclist = new List<Context>();
            private void timer1_Tick(object sender, EventArgs e)
            {
                cclist = new ContextData().Select(T.UserName, F.UserName);
    
                if (cclist.Count > 0)
                {
                    foreach (var c in cclist)
                    {
                        richTextBox1.Text += c.from + "对" + c.to + "说:
    ";
                        richTextBox1.Text += c.txt + "
    ";
    
                        new ContextData().Update(c);
                    }
                }
            }
    
    
    
    
    
        }
    }
    复制代码
  • 相关阅读:
    终于明白迅雷使用积分制的真正作用和目的了(教大家改迅雷)
    免费搞QQ空间
    终于明白迅雷使用积分制的真正作用和目的了(教大家改迅雷)
    终于明白迅雷使用积分制的真正作用和目的了(教大家改迅雷)
    免费搞QQ空间
    免费搞QQ空间
    如何配置Windows Live Writer
    求PI的近似值,用公式PI/4=11/3+1/51/7+...
    求31000之间的素数
    通过Office 2007发布Blog
  • 原文地址:https://www.cnblogs.com/baimangguo/p/6233310.html
Copyright © 2011-2022 走看看