This is a migrated thread and some comments may be shown as answers.

RadPictureBox ZoomToCursor

6 Answers 47 Views
PictureBox
This is a migrated thread and some comments may be shown as answers.
Saeed
Top achievements
Rank 1
Saeed asked on 22 Apr 2021, 10:18 AM
Hi, I am trying to use RadPictureBox  (Telerik UI for WinForms R1 2021) to  view EMF file. Zoom is working but I can't zoom to cursor or, at least stay at the same area, during zoom both scrollbars are getting max value so the image scrolled to bottom right corner  

6 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Apr 2021, 10:40 AM

Hello, Saeed,

Currently, RadPictureBox doesn't support zoom to cursor functionality. You can also have a look at the support formats: https://docs.telerik.com/devtools/winforms/controls/picturebox/overview#supported-formats 

However, it sounds like a reasonable request. I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

I hope this information helps. If you need any further assistance please don't hesitate to contact me.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

0
Saeed
Top achievements
Rank 1
answered on 22 Apr 2021, 10:44 AM

Thanks for reply.

The format is not an issue, same behavior is for jpg or png  

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 Apr 2021, 07:03 AM

Hello, Saeed, 

I have tested zooming a .jpg image in RadPictureBox. I haven't noticed anything specific in the scrollbars. Please refer to the attached gif file for better illustration. Am I missing something? Could you please specify the exact steps how to reproduce the problem you are facing?

I have also attached my sample project for your reference. Please give it a try and see how it works on your end.

Once we replicate the issue locally, we can make an adequate analysis o the precise case and provide further assistance.

Thank you in advance for your cooperation. I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Saeed
Top achievements
Rank 1
answered on 24 Apr 2021, 01:36 PM

Hi.

The scrolling happening during zooming , when the scroll bars , for example, in the middle of the control.
Can't attach it here , the file is too big. 
https://youtu.be/oh03NHdm3NI

any way, to reproduce follow the steps:
1. Zoom in using mouse wheel (quite a lot, not just a few clicks) - Scroll bars are expected to remain in position , about 0 pos.
2. move scroll bars to the middle.
3. Zoom in again using mouse wheel 
Scroll bars will jump to the maximum position 
4. try to move them back to the middle and zoom in again 

Again , Scroll bars will jump to the max position  

 

 

0
Saeed
Top achievements
Rank 1
answered on 24 Apr 2021, 01:58 PM
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 26 Apr 2021, 07:36 AM
Hello, Saeed, 

Thank you for the provided sample video illustrating the problem you are facing. I would like to note that this is related to the previously logged item for implementing ZoomToCursor functionality which currently is not supported: https://feedback.telerik.com/winforms/1516572-radpicturebox-add-zoomtocursor-functionality 

Currently, the possible solution that I can suggest is to store the ratio of the vertical scrollbar's offset and adjust the value when you zoom the picture:
        public RadForm1()
        {
            InitializeComponent();
             

            this.radPictureBox1.ZoomChanged += RadPictureBox1_ZoomChanged;
            this.radPictureBox1.PictureBoxElement.MouseWheel += RadPictureBox1_MouseWheel;
           
        }
        float fraction = 0;
        private void RadPictureBox1_MouseWheel(object sender, MouseEventArgs e)
        {
            fraction = (float)this.radPictureBox1.PictureBoxElement.VerticalScrollBar.Value /
                (this.radPictureBox1.PictureBoxElement.VerticalScrollBar.Maximum -
                this.radPictureBox1.PictureBoxElement.VerticalScrollBar.LargeChange);
        }

        private void RadPictureBox1_ZoomChanged(object sender, EventArgs e)
        {
            if (fraction!=0)
            { 
                this.radPictureBox1.PictureBoxElement.VerticalScrollBar.Value = 
                    (int)((this.radPictureBox1.PictureBoxElement.VerticalScrollBar.Maximum -
                this.radPictureBox1.PictureBoxElement.VerticalScrollBar.LargeChange) * fraction); 
            } 
        }

The attached gif file illustrates the achieved result.

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Saeed
Top achievements
Rank 1
commented on 27 Apr 2021, 10:28 AM

Thanks for you support
Tags
PictureBox
Asked by
Saeed
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Saeed
Top achievements
Rank 1
Share this question
or