예제 #1
0
    static void Main() {
      // Only allow one instance of Stickies to run at a time
      Process[] stickiesProcesses = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
      if (stickiesProcesses.Length > 1) {
        StickiesAlreadyOpen();
        return;
      }

      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);
      MainForm mainForm = new MainForm();
      Application.Run();
    }
예제 #2
0
    /// <summary>
    /// Creates a NoteForm for the given Note instance. We load our settings
    /// from the given Note instance, and we bind ourselves to the instance,
    /// so as the user changes this NoteForm, we serialize the changes in the
    /// given Note. If fadeIn is true, we fade the note in rather than just
    /// showing it.
    /// </summary>
    public NoteForm(MainForm mainForm, Note note, bool fadeIn) {
      mainForm_ = mainForm;
      note_ = note;
      fadeIn_ = fadeIn;
      InitializeComponent();
      this.Icon = Media.StickiesIcon;
      preferencesMenuItem_.Text = Messages.NotePreferences;
      deleteMenuItem_.Text = Messages.NoteDelete;
      archiveMenuItem_.Text = Messages.NoteArchive;
      boldMenuItem_.Text = Messages.NoteBold;
      italicMenuItem_.Text = Messages.NoteItalic;
      strikethroughMenuItem_.Text = Messages.NoteStrikethrough;

      // Load the settings from the Note instance
      this.StartPosition = FormStartPosition.Manual;
      this.Location = new Point(note.Left, note.Top);
      this.Size = new Size(note.Width, note.Height);
      this.BackColor = Color.FromArgb(note.BorderColor);
      textBox_.BackColor = Color.FromArgb(note.BackColor);
      textBoxPaddingPanel_.BackColor = textBox_.BackColor;
      textBox_.ForeColor = Color.FromArgb(note.FontColor);
      textBox_.Rtf = note.Rtf;
      this.TopMost = note.AlwaysOnTop;
      this.Opacity = 1.0 - note_.Transparency;

      // Lock this note initially since it is not a new note
      Lock();
      UpdateTitle();

      // We are not dirty since the note just loaded
      dirty_ = false;
    }