示例#1
0
 public LogReader(Form parent, string title)
 {
     InitializeComponent();
     this.WindowState   = FormWindowState.Maximized;
     this.StartPosition = FormStartPosition.CenterScreen;
     parentForm         = ((Main)parent);
     parentForm.loseFocus();
     currentPage     = 0;
     header.Text     = title.Replace(Environment.NewLine, "");
     Page            = LogOperations.getLog(parentForm.activeUser, title);
     LogText.TabStop = false;
     if (Page.Count > 0)
     {
         LogText.Text = Page[0];
     }
     else
     {
         Page.Add("");
     }
     label1.Text = Page.Count.ToString();
 }
示例#2
0
        public TextEditor(Form parent, string title)
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterScreen;
            parentForm         = ((Main)parent);
            parentForm.loseFocus();
            currentPage    = 0;
            header.Text    = title.Replace(Environment.NewLine, "");
            labelfont.Text = LogText.Font.FontFamily.Name;
            sizeLabel.Text = LogText.Font.Size.ToString();
            Page           = LogOperations.getLog(parentForm.activeUser, title);
            if (Page.Count > 0)
            {
                LogText.Text = Page[0];
            }
            else
            {
                Page.Add("");
            }
            LogText.SelectAll();
            List <string> style = LogOperations.getPageStyle(parentForm.activeUser, title);

            if (style.Count > 0)
            {
                string[] items;
                items                  = style[0].Split('@');
                LogText.BackColor      = Color.FromArgb(int.Parse(items[0]), int.Parse(items[1]), int.Parse(items[2]));
                items                  = style[1].Split('@');
                LogText.SelectionColor = LogText.ForeColor = Color.FromArgb(int.Parse(items[0]), int.Parse(items[1]), int.Parse(items[2]));
                LogText.SelectionFont  = LogText.Font = new Font(style[2], int.Parse(style[3]));

                labelfont.Text = style[2];
                sizeLabel.Text = style[3];
                if (style[4][0] == '1')
                {
                    Bold.BackColor = selectedColor; LogText.Font = new Font(LogText.Font, LogText.Font.Style ^ FontStyle.Bold);
                }
                if (style[4][1] == '1')
                {
                    Italic.BackColor = selectedColor; LogText.Font = new Font(LogText.Font, LogText.Font.Style ^ FontStyle.Italic);
                }
                if (style[4][2] == '1')
                {
                    underLine.BackColor = selectedColor; LogText.Font = new Font(LogText.Font, LogText.Font.Style ^ FontStyle.Underline);
                }
                alig = int.Parse(style[5]);
                if (alig == 1)
                {
                    alignLeft.BackColor   = selectedColor;
                    alignMiddle.BackColor = alignRight.BackColor = standartColor;
                }
                else if (alig == 2)
                {
                    alignMiddle.BackColor = selectedColor;
                    alignLeft.BackColor   = alignRight.BackColor = standartColor;
                }
                else
                {
                    alignRight.BackColor  = selectedColor;
                    alignMiddle.BackColor = alignMiddle.BackColor = standartColor;
                }
                changeAligment();
                LogText.DeselectAll();
            }
            LogText.SelectionStart = LogText.Text.Length;
            Dictionary <string, string> settings = RegisterLogin.getUserSettings();

            if (settings["AutoSave"] == "0")
            {
                autoSave = false;
            }
            else
            {
                autoSave = true;
            }
        }