Question

5
Replies
236
Views
Ryan Schofield (Ryan____)
Endsleigh

Endsleigh
GB
Ryan____ Member since 2016 21 posts
Endsleigh
Posted: September 16, 2016
Last activity: October 13, 2016
Posted: 16 Sep 2016 10:48 EDT
Last activity: 13 Oct 2016 8:53 EDT
Closed

Moving a borderless form

Hi,

I'm trying to program a way to move my borderless form by clicking and dragging the header labels. I'm working from within an Openspan project, not a C# project, so would anyone be able to help me do this?

I have the following script, which I was hoping to use in the Script component, but I get valiation errors:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

bool isMouseDown=false;
int xLast;
int yLast;
        
        private void lbxQualityTitle_MouseUp(object sender, MouseEventArgs e)
        {
            isMouseDown = false;
        }

        private void lbxQualityTitle_MouseMove(object sender, MouseEventArgs e)
        {
            if (isMouseDown)
            {
                int newY = this.Top + (e.Y - yLast);
                int newX = this.Left + (e.X - xLast);

                this.Location = new Point(newX, newY);
            }
        }

        private void lbxQualityTitle_MouseDown(object sender, MouseEventArgs e)
        {
            isMouseDown = true;
            xLast = e.X;
            yLast = e.Y;
        }

Are there certain references I need to use to get this code it to work? or is there a way I can get the desired affect using only toolbox components?

Thanks,

Ryan

***Updated by moderator: Marissa to update categories***

Low-Code App Development Robotic Process Automation
Moderation Team has archived post, This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.