We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

questions about scroll bars and anchoring diagram

Hi
I'm using syncfusion v:20.4.0.38   in visual studio 2022 - .Net6
I have 2 questions about  scroll bars and the anchoring diagram

1) I want my diagram to have auto scrolls which means If a node dropped near the boundary of the diagram control automatically scrollBars appear and the user can scroll NOW but Not Before this! How can I do this???

p.n. : I have my custom diagram.edd file loading with this document size (W:671,H:150) and when add diagram to form programmatically with this size to (W:671,H:150)


2) I'm adding my diagram control to a flow layout panel on form - flow layout panel anchored to form correctly
But the problem is when I maximize or resize the form diagram does not resize with flow layout panel and remains constant !!

I want to anchor the Diagram to the Flow layout panel! how do I achieve this?
1.jpg

thanks a lot!


3 Replies

MO mohammad March 1, 2023 11:51 AM UTC

here is my code


Attachment: SyncFusion_Diagraming_Test_513ac3e0.rar


PP Prakash Perumal Syncfusion Team March 6, 2023 11:57 AM UTC

Hi Mohammad,


Sorry for the delay in getting back to you.


We are currently validating on your requirement and will provide you with an update no later than the end of the day.


Regards,

Prakash



PP Prakash Perumal Syncfusion Team March 6, 2023 03:14 PM UTC

Hi Mohammad,


Please find the response for your queries.


Query

Response

Diagram to have auto scrolls if a node dropped near the boundary of the diagram control

AutoScrolling functionality can be enabled by using the code below.

 

diagram.AutoScrolling = ScrollBars.Both;

 

If we have misunderstood your requirement, please provide us with more details or an image representation for your requirement.

 

Resize diagram when maximize or resize the form along with flow layout pane.

We have achieved your requirement by updating the diagram size relatively in the Form_Resize event.

 

int? oldWidth, oldHeight;

private void Form1_Resize(object sender, EventArgs e)

{

    flowLayoutPanel1.Width = this.ClientSize.Width;

    flowLayoutPanel1.Height = this.ClientSize.Height;

    flowLayoutPanel1.WrapContents = true;

    flowLayoutPanel1.BackColor = Color.CornflowerBlue;

 

    if (flowLayoutPanel1.Controls.Count > 0 && oldWidth.HasValue && oldHeight.HasValue)

    {

        var deltaHeight = flowLayoutPanel1.Height - oldHeight.Value;

        var deltaWidth = flowLayoutPanel1.Width - oldWidth.Value;

        foreach (Control control in flowLayoutPanel1.Controls)

        {

            if (control is Diagram diagram)

            {

                diagram.Size = new Size(diagram.Size.Width + deltaWidth, diagram.Size.Height + deltaHeight);

            }

        }

    }

 

    oldWidth = flowLayoutPanel1.Width;

    oldHeight = flowLayoutPanel1.Height;

}

 

private void Form1_Load(object sender, EventArgs e)

{

    oldWidth = flowLayoutPanel1.Width;

    oldHeight = flowLayoutPanel1.Height;

}


Regards,

Prakash


Loader.
Live Chat Icon For mobile
Up arrow icon