Custom Tool in PDFViewCtrl

Why is that every time i draw a line or rectangle it goes to a
different position in OnMouseDown() event.
Here's the sample code.

        PointF _start_pt;
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (_tool_mode == CustomToolMode.e_custom_distance_tool)
            {
                _cur_page = GetPageNumberFromScreenPt(e.X, e.Y);

                double x = e.X;
                double y = e.Y;

                this.ConvScreenPtToPagePt(ref x, ref y, _cur_page);
                _start_pt.X = (float)x;
                _start_pt.Y = (float)y;
                Capture = true;
            }
         }

        protected override void OnPaint(PaintEventArgs e)
        {
           Matrix m = GetDeviceTransform(_cur_page);
           e.Graphics.MultiplyTransform(m);
           e.Graphics.DrawRectangle(Pens.Blue, _start_pt.X,
_start_pt.Y, 100, 100);
        }

Hi

I just solved this problem. I switched the X axis and Y axis value.
(ex. e.Graphics.DrawRectangle(Pens.Blue, _start_pt.Y, _start_pt.X,
100, 100));

Regards

Yup, it is MS .NET weirdness. You may want to take a look at PDFView
C# for a more complete example of a custom markup tool.

By the way, can I use the annot edit tool to my custom tool?

Thanks for the reply.

Hi

Never mind, I just created my own custom_selectable_distance_tool.

Regards