experchange > vb.* > vb.general.discussion

Robert (01-10-19, 01:27 AM)
I have a picBox loaded with controls that I drag around as needed.
Problem is that the controls on the picbox flicker like crazy while
dragging.

Other than making the controls .Visible = False during the drag, what
can be done ?

--- - complaints: news ---
Robert (01-10-19, 03:21 AM)
So far the best I can do is make all controls except for the picturebox
itself and the drag icon used to drag the picturebox .Visible = False.

For each control with a .Visible property
..Visible = False when MouseDown to start drag
..Visible = True when MouseUp.

But the picturebox still flickers.

I see that using C++ they have a double buffer capability.

Not VB6 ?

I want smooooth.

--- - complaints: news ---
Mayayana (01-10-19, 03:27 AM)
"Robert" <Robert> wrote
|
| I have a picBox loaded with controls that I drag around as needed.
| Problem is that the controls on the picbox flicker like crazy while
| dragging.
|
| Other than making the controls .Visible = False during the drag, what
| can be done ?
|

Maybe use a drag icon for the move? Then you don't
need to keep painting the control. Just call Move on
it when it's dropped.
Larry Serflaten (01-10-19, 05:44 PM)
Robert wrote:

> But the picturebox still flickers. <...>
> I want smooooth.


Did you try the SendMessage method? It doesn't show the controls, but it should be as smooth as the OS can make it....

'(Add a pictureBox to a new form)
Option Explicit

Private Declare Function SendMessage _
Lib "user32" _
Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) _
As Long

Private Declare Function ReleaseCapture _
Lib "user32" () As Long

Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Call ReleaseCapture
Call SendMessage(Picture1.hWnd, _
WM_NCLBUTTONDOWN, _
HTCAPTION, ByVal 0&)
End If

End Sub
Larry Serflaten (01-10-19, 06:03 PM)
Larry Serflaten wrote:

> It doesn't show the controls,


Try it and see, after I posted this I found I had the Windows setting to show contents turned off. When I turned it on the controls moved right along with the picture box. Maybe it is just what you need! :-)

LFS
Robert (01-11-19, 08:50 PM)
" It doesn't show the controls, "

" I had the Windows setting to show contents turned off. "

" When I turned it on the controls moved right along "

How ? What setting ?

--- - complaints: news ---
Robert (01-12-19, 01:05 AM)
Works a charm ! Thank you !

Larry Serflaten wrote:
[..]
> HTCAPTION, ByVal 0&)
> End If
> End Sub


--- - complaints: news ---
Larry Serflaten (01-12-19, 01:07 AM)
Robert wrote:
> How ? What setting ?


It may be OS specific, but try this:


LFS
Robert (01-16-19, 07:45 PM)
Strangely, on one laptop
dragging the toolbar results in dragging an outline
on the other laptop
dragging the toolbar shows the contents of the toolbar.

Both Win XP Pro.

Mayayana wrote:
[..]
Larry Serflaten (01-17-19, 02:06 AM)
Robert wrote:
> > Maybe use a drag icon for the move? Then you don't
> > need to keep painting the control. Just call Move on
> > it when it's dropped.


Check that display setting, that is exactly the difference between
showing window contents while dragging, and not...

LFS
Similar Threads