Question

5
Replies
229
Views
Ryan____ Member since 2016 21 posts
Endsleigh
Posted: 4 years ago
Last activity: 4 years ago
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
Share this page LinkedIn