Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5462


Ignore:
Timestamp:
02/15/11 11:01:30 (14 years ago)
Author:
mkommend
Message:

Corrected positition of context menu in ViewHost to support multiple monitors (ticket #1410).

Location:
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/ViewHost.Designer.cs

    r5445 r5462  
    6666      //
    6767      this.viewsLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    68       this.viewsLabel.ContextMenuStrip = this.viewContextMenuStrip;
    6968      this.viewsLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Windows;
    7069      this.viewsLabel.Location = new System.Drawing.Point(211, 0);
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/ViewHost.cs

    r5445 r5462  
    263263    private bool startDragAndDrop;
    264264    private void viewsLabel_MouseDown(object sender, MouseEventArgs e) {
    265       if (!Locked) {
     265      if (e.Button == System.Windows.Forms.MouseButtons.Right) {
     266        Screen screen = Screen.FromControl(viewsLabel);
     267        int rightBorder = viewsLabel.PointToScreen(viewsLabel.Location).X + viewContextMenuStrip.Width; //
     268        rightBorder = rightBorder - screen.Bounds.X; //pixel position on active screen
     269
     270        if (rightBorder < screen.Bounds.Width)
     271          viewContextMenuStrip.Show(viewsLabel, viewsLabel.Margin.Left, viewsLabel.Margin.Top);
     272        else
     273          viewContextMenuStrip.Show(screen.Bounds.X + screen.Bounds.Width - viewContextMenuStrip.Width, viewsLabel.PointToScreen(viewsLabel.Location).Y - viewsLabel.Margin.Top);
     274      } else if (!Locked) {
    266275        startDragAndDrop = true;
    267276        viewsLabel.Capture = false;
Note: See TracChangeset for help on using the changeset viewer.