New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen artifact/trail when dragging/resize a border #79

Closed
joomlaview13 opened this Issue Nov 15, 2017 · 29 comments

Comments

8 participants
@joomlaview13

joomlaview13 commented Nov 15, 2017

Hi guys,

I was running the samples, and I encountered a problem that is driving me crazy. When I tried to resize the panel by dragging on the border, some black lines/visual artifacts appeared above the panel, and wouldn't go away until I let go of left mouse button. You can see a picture of it below:

Win 10 problem

The strange thing is it only happened on my Win10 system, and I couldn't reproduce it on my Win7 box. So I suspect it might have something to do with a particular setting in Win10. Could anyone tell me how to get rid of those annoying black lines?

Thanks!

@Smurf-IV

This comment has been minimized.

Smurf-IV commented Nov 15, 2017

Might be the order they are added in the Designer, so the "Drag context" thinks it needs to go to the top of the form. Just a guess.

@joomlaview13

This comment has been minimized.

joomlaview13 commented Nov 15, 2017

Thanks for the reply, Smurf. I just took a look at Designer.cs and tried to rearrange things... No use :( Do you have any other suggestion or tip?

So let me describe the problem in details -- The problem exists in every example included in the toolkit (with a drag-able border).. Every time I press the left mouse button and try to drag the border, black lines would appear on the top.. Sometimes even after I let go of the mouse button, the black lines remain on the screen.

The problem only affects Win10 system (my laptop). The border-dragging operation works correctly on my Win7 desktop.

Did anyone else encounter the same problem (or able to replicate this issue)?

I really want to use Krypton toolkit for my application, but can't really use it unless I solve this issue.

Any help will be much appreciated.

@joomlaview13

This comment has been minimized.

joomlaview13 commented Nov 15, 2017

BTW, this is a brand new laptop with Win10 installed. So it cannot be a graphic memory issue. The issue only affects Krypton toolkit (and the border-dragging works fine for Visual studio.. etc)..

@JohnRanger

This comment has been minimized.

JohnRanger commented Nov 24, 2017

Hi

I have tested the demo apps right now on my Win10 (with Intel and NVIDIA graphics Card) - it is also a Laptop - altough an older one - an no such artefacts appear.

I would then tend to think that this is a graphics Driver Problem.

What Kind of graphic Card is in your Laptop?

With Kind regards,

John

@joomlaview13

This comment has been minimized.

joomlaview13 commented Nov 25, 2017

Hi John,

I have nVidia Geforce 1070 Ti, with latest graphics driver installed. And it's a HP Omen 17.3'' laptop I just bought.

That actually makes sense because I couldn't reproduce the artifacts on my older desktop with win7 either.

Incidentally, I've tried some other winform components (Syncfusion.. DevExpress.. etc), and none of them have given me such problem. It's giving me headache as I'd rather use the free Krypton suite instead. :(

@joomlaview13

This comment has been minimized.

joomlaview13 commented Nov 25, 2017

I downloaded my nVidia driver directly from nVidia. The only thing that's been giving me problem is the Krypton demos.

Could someone else with the latest nVidia graphics card and driver try the demo and see if you can reproduce the problem?

Thanks.

@Cocotteseb

This comment has been minimized.

Cocotteseb commented Nov 25, 2017

I have the same problems on two computers (different nvidia cards) on my app. I didn't have this problem before.
I wonder if it is related to the version of Windows 10 : fall creators update 1709 for me. Same for you ?

@joomlaview13

This comment has been minimized.

joomlaview13 commented Dec 1, 2017

Yes!

I first noticed the problem right after I reinstalled my Win10, so I suspect it might have something to do with one of the updates. Let me go check and see if I have the fall creators update..

BTW -- this problem pretty much makes the toolkit unusable to me.

Do you have any idea how to fix this? :(

@joomlaview13

This comment has been minimized.

joomlaview13 commented Dec 1, 2017

Can someone else with Win10 and latest updates pitch in and give us your input?

The error only exists on my Win10 box with latest updates, and not my old Win7 system. So I suspect it might be windows update-related, just like Cocotteseb mentioned.

Could someone else verify this?

@joomlaview13

This comment has been minimized.

joomlaview13 commented Dec 1, 2017

FYI, I have nVidia GeForce 1070Ti with latest graphic driver, and latest windows 10 updates installed.

@FreeFlyingEnchilada

This comment has been minimized.

FreeFlyingEnchilada commented Dec 1, 2017

I expect there is a good chance this fix I suggested here could solve your issue. The method this library uses to hide updates is unusual and seems to have some issues. The issue I was solving with that fix was near identical to the one you're describing.

@Cocotteseb

This comment has been minimized.

Cocotteseb commented Dec 23, 2017

This drives me nuts.
I think the problem comes from the function
private static void DrawSplitIndicator(Rectangle drawRect) { // We just perform a simple reversible rectangle draw ControlPaint.FillReversibleRectangle(drawRect, Color.Black); }

in SeparatorController.cs

However I do not understand why on the latest Win 10 builds it does not longer work and how to overcome this issue.
Meanwhile someone finds out a better solution, I've added a test to not display the separator when moving on Win10...

In public SeparatorController(ISeparatorSource source, ViewBase target, bool splitCursors, bool drawIndicator, NeedPaintHandler needPaint) : base(target, needPaint)

        `if (Environment.OSVersion.Version.Major >= 10)
        {
            _drawIndicator = false; //unless it flickers on Win10 : https://github.com/ComponentFactory/Krypton/issues/79
        }
        else
        {
            _drawIndicator = drawIndicator;
        }
	}`
@Wagnerp

This comment has been minimized.

Contributor

Wagnerp commented Jan 12, 2018

Hi @Cocotteseb,

I was just looking at your solution, but I can't figure out where you get the _drawIndicator variable from? I am working on the .NET framework 4.7 port with @Smurf-IV, and trying to implement your fix. Any help is appreciated, and you will get credited for your assistance.

@Cocotteseb

This comment has been minimized.

Cocotteseb commented Jan 13, 2018

Hi @Wagnerp /@Smurf-IV,

In your code you have automatic property :
/// <summary> /// Gets and sets the drawing of the movement indicator. /// </summary> public bool DrawMoveIndicator { get; set; }

I have
/// <summary> /// Gets and sets the drawing of the movement indicator. /// </summary> public bool DrawMoveIndicator { get { return _drawIndicator; } set { _drawIndicator = value; } }

So just use DrawMoveIndicator in your code.
It's a really bad fix as there is no longer artifact but also no longer the moving indicator. If you find something better we all be happy !

@Wagnerp

This comment has been minimized.

Contributor

Wagnerp commented Jan 14, 2018

Hi @Cocotteseb

Many thanks for the response. I have implemented the fix into the port, and have credited you for you work.

@jwsimms

This comment has been minimized.

jwsimms commented Jul 2, 2018

I had the same issue with the artifacts on both my home computer and work computer. I downloaded the the latest version with same problem. I was able to sidestep the issue by creating a window with the initial rectangle region of the slider bar. It works on all computers. I only modified SeparatorController.cs file using a static drag bar class. Very easy to follow and add. I just need to know where to upload it.

screenshot

@jwsimms

This comment has been minimized.

jwsimms commented Jul 2, 2018

Here is the static drag bar class.

` ///


/// This class has been created to remove the function
/// ControlPaint.FillReversibleRectangle(drawRect, Color.Black);
/// I have continued have have artifacts drawn on the screen
/// when dragging splitter bars.
///

public class DragObject
{
static System.Drawing.Color _BarColor = System.Drawing.Color.Red;
static Control _ctrl = null;
static ViewBase _Target = null;
static Control _parent = null;
public static void Hide()
{
if (_ctrl != null)
{
_ctrl.Parent.Controls.Remove(_ctrl);
_ctrl.Hide();
_ctrl.Dispose();
_ctrl = null;
_parent = null;
_Target = null;

            }
        }
        public static void Show(ViewBase Target, Rectangle ScreenRect)
        {
            //
            // if for some reason, our targer has changed, remove old control
            //
            if (_Target != null)
            {
                if (_Target != Target)
                {
                    Hide();
                }                    
            }
            //
            // create dragbar control
            //                                
            if(_ctrl == null)
            {
                _ctrl = new Control() { Visible = false, BackColor = _BarColor };                    
                //
                // get parent of dragbar control. Find a parent that
                // supports children. Some controls have read only 
                // child collections.
                //
                _parent = Target.OwningControl;
                while(_parent != null)
                {            
                    try
                    {                            
                        _parent.Controls.Add(_ctrl);
                        break;
                    }
                    catch(System.NotSupportedException)
                    {
                        _parent = _parent.Parent;
                    }
                }                
            }                
            //
            // position dragbar control
            //
            Rectangle rect = _parent.RectangleToClient(ScreenRect);
            _ctrl.Location = rect.Location;
            _ctrl.Size = rect.Size;
           
            _ctrl.BringToFront();                
            if (_ctrl.Visible == false)
                _ctrl.Show();
            _ctrl.Invalidate();
        }
    }

`

@Wagnerp

This comment has been minimized.

Contributor

Wagnerp commented Jul 3, 2018

@jwsimms,

Many thanks for the code that you have provided me. I'll implement it into the Krypton-NET-470, 471, 472 and 480 codebases today with credit of you for your work.

Wagnerp added a commit to Wagnerp/Krypton that referenced this issue Jul 3, 2018

@jwsimms

This comment has been minimized.

jwsimms commented Jul 3, 2018

@Wagnerp

This comment has been minimized.

Contributor

Wagnerp commented Jul 3, 2018

@jwsimms

I'll try to make it a property to define. I think it is fairly easy to hook it into the palette colours, but I need some time to figure it out.

@phlexss

This comment has been minimized.

phlexss commented Jul 13, 2018

I'm using the latest Krypton build which has the new splitter dragging code, but I run into a problem with docking;

if I have a docking area which has for instance 4 panels, one big at the top and 3 smaller below (see image), when I drag the large horizontal spitter to resize the top panel, the splitterbar is not shown while dragging. It seems as if it is behind the panels and not correctly shown on top.

splitter

Dragging the vertical splitters between the bottom panels works fine but is also not shown while dragging the splitter at the right of the top panel.

Anyone has any idea what the problem might be and how to fix it?

@phlexss

This comment has been minimized.

phlexss commented Jul 13, 2018

I played around a bit with the new splitterbar code and I sort of found the problem;

the _parent control that is found doesn't seem the correct one. This control also doesn't have the "Name" property set....so I added the following code to "// Get parent of dragbar control. Find a parent that"

                        while ( _parent.Name == "" )
                        {
                            _parent = _parent.Parent;
                        }

Complete code of sub "Show" is now:

        /// <summary>
        /// Shows the specified target.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="screenRect">The screen rect.</param>
        public static void Show(ViewBase target, Rectangle screenRect)
        {
            //
            // If for some reason, our target has changed, remove old control
            //
            if (_target != null)
            {
                if (_target != target)
                {
                    Hide();
                }
            }

            //
            // Create dragbar control
            //                                
            if (_ctrl == null)
            {
                _ctrl = new Control() { Visible = false, BackColor = _barColour };

                //
                // Get parent of dragbar control. Find a parent that
                // supports children. Some controls have read only 
                // child collections.
                //
                _parent = target.OwningControl;

                while (_parent != null)
                {

                    try
                    {
                        while ( _parent.Name == "" )
                        {
                            _parent = _parent.Parent;
                        }

                        _ctrl.Parent = _parent;

                        _parent.Controls.Add(_ctrl);

                        break;
                    }
                    catch (NotSupportedException)
                    {
                        _parent = _parent.Parent;
                    }
                }
            }

            //
            // Position dragbar control
            //
            Rectangle rect = _parent.RectangleToClient(screenRect);

            _ctrl.Location = rect.Location;

            _ctrl.Size = rect.Size;

            _ctrl.BringToFront();

            if (_ctrl.Visible == false)
            {
                _ctrl.Show();
            }

            //
            // Force a redraw
            //
            _ctrl.Invalidate();
        }
    }

This has fixed my problem of the splitterbar not being shown while dragging.

Maybe this is not the best way to fix it, so if anyone has a better way I'm all ears!

@jwsimms

This comment has been minimized.

jwsimms commented Jul 18, 2018

@Wagnerp

This comment has been minimized.

Contributor

Wagnerp commented Jul 19, 2018

@phlexss

I think that I have updated my branches with your fix. Please could you highlight the differences?

@phlexss

This comment has been minimized.

phlexss commented Jul 19, 2018

@Wagnerp

I"m sort of new on github.....what do you mean with "highlight the differences"?

@Wagnerp

This comment has been minimized.

Contributor

Wagnerp commented Jul 19, 2018

@phlexss

Sure, what I meant was what did you change from the original method code?

@jwsimms

This comment has been minimized.

jwsimms commented Jul 23, 2018

@phlexss

This comment has been minimized.

phlexss commented Jul 25, 2018

@Wagnerp

The code I added is;

                    while ( _parent.Name == "" )
                    {
                        _parent = _parent.Parent;
                    }

(see earlier comment)

@Wagnerp

This comment has been minimized.

Contributor

Wagnerp commented Jul 25, 2018

@phlexss

Thanks will add it ASAP, I'm waiting for @ComponentFactory at the moment to merge the changes to hopefully get this repo back to a more stable state, before integrating this code.

ComponentFactory added a commit that referenced this issue Jul 25, 2018

Unwind changes to a more stable state (#146)
* * Decoupled the designer DLL from rest of toolkit

* * Remove BIN folder

* * Update README.md

* * In development

* * Redo

* * Palette upgrade tool

* * Remove locks

* * Removal of app

* * Working Design.dll

* * Remove build directory

* * Remove VS blocks

* * Fix #79

* * Code reset

* * Last known working build

* * Instructions

* * Small changes

* * Try to resolve conflict

Wagnerp added a commit to Wagnerp/Krypton that referenced this issue Jul 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment