📄 gonggaowindow.cs
字号:
using System;
using System.Windows.Forms;
using System.ComponentModel;
using System.Data;
using System.Resources;
using System.Drawing;
using System.Diagnostics;
using Word;
using System.Reflection;
using System.Threading;
namespace InstMsnger
{
/// <summary>
/// GongGaoWindow 的摘要说明。
/// </summary>
public class GongGaoWindow : Form
{
// Fields
private ColorDialog ColorSt;
private IContainer components;
private ContextMenu contextMenu1;
private DateTimePicker DateSt;
private SqlDBb Db;
private ComboBox FcListST;
private FontDialog FontSt;
public DataTable ggDt;
private ComboBox GGListSt;
private ComboBox GroupIdST;
private ImageList imageList1;
private Label label1;
private Label label2;
private Label label3;
private Label label4;
private MenuItem menuItem1;
private MenuItem menuItem2;
private MenuItem menuItem3;
public MainHome MT;
private RichTextBox NrSt;
private OpenFileDialog openFil;
private OpenFileDialog OpenMBST;
private Panel panel1;
private Panel panel2;
private SaveFileDialog SaveST;
private TextBox TitleSt;
private ToolBar toolBar1;
private ToolBarButton toolBarButton1;
private ToolBarButton toolBarButton10;
private ToolBarButton toolBarButton11;
private ToolBarButton toolBarButton12;
private ToolBarButton toolBarButton13;
private ToolBarButton toolBarButton14;
private ToolBarButton toolBarButton2;
private ToolBarButton toolBarButton3;
private ToolBarButton toolBarButton4;
private ToolBarButton toolBarButton5;
private ToolBarButton toolBarButton6;
private ToolBarButton toolBarButton7;
private ToolBarButton toolBarButton8;
private ToolBarButton toolBarButton9;
private TextBox UsIdSt;
// Methods
public GongGaoWindow()
{
this.Db = new SqlDBb();
this.ggDt = new DataTable();
this.InitializeComponent();
}
private void colorstt()
{
if (this.ColorSt.ShowDialog() == DialogResult.OK)
{
this.NrSt.SelectionColor = this.ColorSt.Color;
}
this.NrSt.Focus();
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void FcListST_SelectedIndexChanged(object sender, EventArgs e)
{
this.LodGp();
}
private void Fontst()
{
if (this.FontSt.ShowDialog() == DialogResult.OK)
{
this.NrSt.SelectionFont = this.FontSt.Font;
}
this.NrSt.Focus();
}
private void GGListSt_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
DataRow[] rowArray1 = this.ggDt.Select("Id=" + this.GGListSt.SelectedValue);
if (rowArray1.Length > 0)
{
this.TitleSt.Text = rowArray1[0]["Title"].ToString();
this.DateSt.Value = (DateTime) rowArray1[0]["FbDate"];
this.NrSt.Rtf = rowArray1[0]["Nr"].ToString();
this.UsIdSt.Text = rowArray1[0]["UsId"].ToString();
}
this.savetouslook();
}
catch
{
}
}
private void GongGaoWindow_Load(object sender, EventArgs e)
{
this.UsTypeSet();
this.LoadFclist();
this.LoadGGInfo();
this.label4.Text = "授权用户:" + this.MT.reg.CompanyName();
try
{
this.GGListSt.SelectedIndex = 0;
}
catch
{
}
this.savetouslook();
}
private void InitializeComponent()
{
this.components = new Container();
ResourceManager manager1 = new ResourceManager(typeof(GongGaoWindow));
this.toolBar1 = new ToolBar();
this.toolBarButton1 = new ToolBarButton();
this.toolBarButton10 = new ToolBarButton();
this.toolBarButton11 = new ToolBarButton();
this.toolBarButton12 = new ToolBarButton();
this.toolBarButton2 = new ToolBarButton();
this.toolBarButton5 = new ToolBarButton();
this.toolBarButton3 = new ToolBarButton();
this.toolBarButton13 = new ToolBarButton();
this.toolBarButton6 = new ToolBarButton();
this.toolBarButton7 = new ToolBarButton();
this.toolBarButton9 = new ToolBarButton();
this.contextMenu1 = new ContextMenu();
this.menuItem1 = new MenuItem();
this.menuItem2 = new MenuItem();
this.menuItem3 = new MenuItem();
this.toolBarButton8 = new ToolBarButton();
this.toolBarButton14 = new ToolBarButton();
this.toolBarButton4 = new ToolBarButton();
this.imageList1 = new ImageList(this.components);
this.label1 = new Label();
this.GGListSt = new ComboBox();
this.DateSt = new DateTimePicker();
this.panel1 = new Panel();
this.panel2 = new Panel();
this.NrSt = new RichTextBox();
this.label4 = new Label();
this.FcListST = new ComboBox();
this.UsIdSt = new TextBox();
this.label2 = new Label();
this.TitleSt = new TextBox();
this.label3 = new Label();
this.GroupIdST = new ComboBox();
this.ColorSt = new ColorDialog();
this.OpenMBST = new OpenFileDialog();
this.SaveST = new SaveFileDialog();
this.FontSt = new FontDialog();
this.openFil = new OpenFileDialog();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
base.SuspendLayout();
this.toolBar1.Appearance = ToolBarAppearance.Flat;
this.toolBar1.Buttons.AddRange(new ToolBarButton[] { this.toolBarButton1, this.toolBarButton10, this.toolBarButton11, this.toolBarButton12, this.toolBarButton2, this.toolBarButton5, this.toolBarButton3, this.toolBarButton13, this.toolBarButton6, this.toolBarButton7, this.toolBarButton9, this.toolBarButton8, this.toolBarButton14, this.toolBarButton4 });
this.toolBar1.ButtonSize = new Size(80, 0x16);
this.toolBar1.DropDownArrows = true;
this.toolBar1.ImageList = this.imageList1;
this.toolBar1.Location = new Point(0, 0);
this.toolBar1.Name = "toolBar1";
this.toolBar1.ShowToolTips = true;
this.toolBar1.Size = new Size(0x2de, 0x1c);
this.toolBar1.TabIndex = 0;
this.toolBar1.TextAlign = ToolBarTextAlign.Right;
this.toolBar1.ButtonClick += new ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
this.toolBarButton1.Style = ToolBarButtonStyle.Separator;
this.toolBarButton10.ImageIndex = 7;
this.toolBarButton10.Text = "新建";
this.toolBarButton11.ImageIndex = 6;
this.toolBarButton11.Text = "另存";
this.toolBarButton12.Style = ToolBarButtonStyle.Separator;
this.toolBarButton2.ImageIndex = 1;
this.toolBarButton2.Text = "发布";
this.toolBarButton2.ToolTipText = "确定发布之后,信息便无法收回,也无法修改。请您认真审核。";
this.toolBarButton5.ImageIndex = 2;
this.toolBarButton5.Text = "导入";
this.toolBarButton5.ToolTipText = "导入您在别处编辑的公告内容。注:系统仅支持RTF格式。";
this.toolBarButton3.Style = ToolBarButtonStyle.Separator;
this.toolBarButton13.ImageIndex = 8;
this.toolBarButton13.Text = "图片";
this.toolBarButton13.ToolTipText = "插入图片";
this.toolBarButton6.ImageIndex = 3;
this.toolBarButton6.Text = "字体";
this.toolBarButton7.ImageIndex = 4;
this.toolBarButton7.Text = "颜色";
this.toolBarButton9.DropDownMenu = this.contextMenu1;
this.toolBarButton9.ImageIndex = 5;
this.toolBarButton9.Style = ToolBarButtonStyle.DropDownButton;
this.toolBarButton9.Text = "对齐";
this.contextMenu1.MenuItems.AddRange(new MenuItem[] { this.menuItem1, this.menuItem2, this.menuItem3 });
this.menuItem1.Index = 0;
this.menuItem1.Text = "居左";
this.menuItem1.Click += new EventHandler(this.menuItem1_Click);
this.menuItem2.Index = 1;
this.menuItem2.Text = "居中";
this.menuItem2.Click += new EventHandler(this.menuItem2_Click);
this.menuItem3.Index = 2;
this.menuItem3.Text = "居右";
this.menuItem3.Click += new EventHandler(this.menuItem3_Click);
this.toolBarButton8.Style = ToolBarButtonStyle.Separator;
this.toolBarButton14.ImageIndex = 9;
this.toolBarButton14.Text = "打印";
this.toolBarButton4.ImageIndex = 0;
this.toolBarButton4.Text = "关闭";
this.imageList1.ImageSize = new Size(0x10, 0x10);
this.imageList1.ImageStream = (ImageListStreamer) manager1.GetObject("imageList1.ImageStream");
this.imageList1.TransparentColor = Color.Transparent;
this.label1.AutoSize = true;
this.label1.BackColor = Color.Transparent;
this.label1.Location = new Point(0x18, 12);
this.label1.Name = "label1";
this.label1.Size = new Size(0x23, 0x11);
this.label1.TabIndex = 1;
this.label1.Text = "查看:";
this.GGListSt.DropDownStyle = ComboBoxStyle.DropDownList;
this.GGListSt.Location = new Point(60, 8);
this.GGListSt.Name = "GGListSt";
this.GGListSt.Size = new Size(0xb8, 20);
this.GGListSt.TabIndex = 2;
this.GGListSt.SelectedIndexChanged += new EventHandler(this.GGListSt_SelectedIndexChanged);
this.DateSt.Enabled = false;
this.DateSt.Location = new Point(0xfc, 8);
this.DateSt.Name = "DateSt";
this.DateSt.Size = new Size(0x6c, 0x15);
this.DateSt.TabIndex = 3;
this.panel1.BackColor = Color.White;
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.FcListST);
this.panel1.Controls.Add(this.UsIdSt);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.TitleSt);
this.panel1.Controls.Add(this.DateSt);
this.panel1.Controls.Add(this.GGListSt);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.GroupIdST);
this.panel1.Dock = DockStyle.Fill;
this.panel1.Location = new Point(0, 0x1c);
this.panel1.Name = "panel1";
this.panel1.Size = new Size(0x2de, 0x183);
this.panel1.TabIndex = 4;
this.panel2.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
this.panel2.BorderStyle = BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.NrSt);
this.panel2.Location = new Point(12, 0x48);
this.panel2.Name = "panel2";
this.panel2.Size = new Size(0x2c8, 0x134);
this.panel2.TabIndex = 8;
this.NrSt.AllowDrop = true;
this.NrSt.BorderStyle = BorderStyle.None;
this.NrSt.Dock = DockStyle.Fill;
this.NrSt.Location = new Point(0, 0);
this.NrSt.Name = "NrSt";
this.NrSt.ReadOnly = true;
this.NrSt.Size = new Size(710, 0x132);
this.NrSt.TabIndex = 1;
this.NrSt.TabStop = false;
this.NrSt.Text = "请在此输入您的公告内容";
this.NrSt.LinkClicked += new LinkClickedEventHandler(this.NrSt_LinkClicked);
this.label4.Anchor = AnchorStyles.Right | AnchorStyles.Top;
this.label4.AutoSize = true;
this.label4.ForeColor = Color.Blue;
this.label4.Location = new Point(0x210, 40);
this.label4.Name = "label4";
this.label4.Size = new Size(0, 0x11);
this.label4.TabIndex = 7;
this.label4.Click += new EventHandler(this.label4_Click);
this.FcListST.DropDownStyle = ComboBoxStyle.DropDownList;
this.FcListST.Location = new Point(0x218, 8);
this.FcListST.Name = "FcListST";
this.FcListST.Size = new Size(0x58, 20);
this.FcListST.TabIndex = 6;
this.FcListST.Visible = false;
this.FcListST.SelectedIndexChanged += new EventHandler(this.FcListST_SelectedIndexChanged);
this.UsIdSt.BorderStyle = BorderStyle.None;
this.UsIdSt.Font = new System.Drawing.Font("宋体", 10.5f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
this.UsIdSt.Location = new Point(420, 12);
this.UsIdSt.Name = "UsIdSt";
this.UsIdSt.ReadOnly = true;
this.UsIdSt.Size = new Size(0x34, 0x10);
this.UsIdSt.TabIndex = 5;
this.UsIdSt.Text = "";
this.label2.AutoSize = true;
this.label2.Location = new Point(0x1dc, 12);
this.label2.Name = "label2";
this.label2.Size = new Size(60, 0x11);
this.label2.TabIndex = 4;
this.label2.Text = "接收单位:";
this.label2.Visible = false;
this.TitleSt.Anchor = AnchorStyles.Top;
this.TitleSt.BackColor = Color.LightSteelBlue;
this.TitleSt.BorderStyle = BorderStyle.None;
this.TitleSt.Font = new System.Drawing.Font("宋体", 15f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
this.TitleSt.ForeColor = Color.Blue;
this.TitleSt.Location = new Point(0xe0, 0x24);
this.TitleSt.Name = "TitleSt";
this.TitleSt.ReadOnly = true;
this.TitleSt.Size = new Size(0x120, 0x17);
this.TitleSt.TabIndex = 0;
this.TitleSt.TabStop = false;
this.TitleSt.Text = "请在此输入您的公告标题";
this.TitleSt.TextAlign = HorizontalAlignment.Center;
this.label3.AutoSize = true;
this.label3.Location = new Point(0x174, 12);
this.label3.Name = "label3";
this.label3.Size = new Size(0x30, 0x11);
this.label3.TabIndex = 4;
this.label3.Text = "公告人:";
this.GroupIdST.DropDownStyle = ComboBoxStyle.DropDownList;
this.GroupIdST.Location = new Point(0x274, 8);
this.GroupIdST.Name = "GroupIdST";
this.GroupIdST.Size = new Size(0x60, 20);
this.GroupIdST.TabIndex = 6;
this.GroupIdST.Visible = false;
this.OpenMBST.Filter = "所有支持的格式|*.rtf;*.txt;*.htm;*.html|Word格式|*.rtf|文本格式(*.txt)|*.txt|htm格式|*.htm;*.html|*.*|*.*";
this.SaveST.Filter = "RTF格式|*.rtf";
this.openFil.Filter = "所有支持的格式|*.jpg;*.gif;*.bmp;*.png|*.jpg|*.jpg|*.gif|*.gif|*.bmp|*.bmp|*.png|*.png|*.*|*.*";
this.AutoScaleBaseSize = new Size(6, 14);
this.BackgroundImage = (Image) manager1.GetObject("$this.BackgroundImage");
base.ClientSize = new Size(0x2de, 0x19f);
base.Controls.Add(this.panel1);
base.Controls.Add(this.toolBar1);
base.Icon = (Icon) manager1.GetObject("$this.Icon");
base.Name = "GongGaoWindow";
base.StartPosition = FormStartPosition.CenterScreen;
this.Text = "查看及发布公告(通知)";
base.WindowState = FormWindowState.Maximized;
base.Load += new EventHandler(this.GongGaoWindow_Load);
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
base.ResumeLayout(false);
}
private void InsertImage()
{
this.openFil.Filter = "所有支持的格式|*.jpg;*.gif;*.bmp;*.png|*.jpg|*.jpg|*.gif|*.gif|*.bmp|*.bmp|*.png|*.png|*.*|*.*";
if (this.openFil.ShowDialog() == DialogResult.OK)
{
try
{
this.NrSt.SelectedRtf = this.Db.ImageToRichTextBox(this.openFil.FileName);
}
catch
{
}
}
}
private void label4_Click(object sender, EventArgs e)
{
regsqinfo regsqinfo1 = new regsqinfo();
regsqinfo1.ShowDialog();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -