Lag when resizing

Hey all,

I am currently making a simple text editor (Still learning). When I use a canvas with MouseDown, MouseDrag and MouseEnter event to drag between a listbox and textarea, i am getting what i would call lag lines. As seen below.

In the following events i have the following code.

Mouse Enter:
me.MouseCursor = system.Cursors.ArrowEastWest

Mouse Drag:

dim offset as integer
offset = x - mStartX

ListArea.width = listarea.width + offset
txt_document.left = txt_document.left + offset
txt_document.Width = txt_document.width - offset

me.left = me.left + offset

txt_document = TextArea
ListArea = Listbox

Mouse Down:

mStartX = X

Return True

Is there something I should be doing to help resolve this or is it a bug?

You should paint the background of the canvas. Use g.FillRectangle (0, 0, g.Width, g.Height) before you draw anything other in the canvas.

1 Like

If you upload a simple example showing the problem I’ll take a look.

1 Like

your calculation is wrong
use lastx = x in mousedown
and in drag

Dim offset As Integer

offset = x - lastx
lastx = x

Listbox1.width = Listbox1.width + offset
TextArea1.Left = TextArea1.Left + offset
TextArea1.Width = TextArea1.width - offset

and offset = distance

i would also resize after a given time to reduce repaints.

1 Like