Click here to Skip to main content
15,887,262 members
Home / Discussions / C#
   

C#

 
GeneralRe: Unmanaged callback, Dispose issue Pin
Luc Pattyn14-Aug-10 8:43
sitebuilderLuc Pattyn14-Aug-10 8:43 
GeneralRe: Unmanaged callback, Dispose issue Pin
DaveyM6914-Aug-10 9:07
professionalDaveyM6914-Aug-10 9:07 
GeneralRe: Unmanaged callback, Dispose issue Pin
Luc Pattyn14-Aug-10 9:19
sitebuilderLuc Pattyn14-Aug-10 9:19 
GeneralRe: Unmanaged callback, Dispose issue Pin
DaveyM6914-Aug-10 9:31
professionalDaveyM6914-Aug-10 9:31 
Questionhow to session value in a page. Pin
Mubeen.asim12-Aug-10 21:38
Mubeen.asim12-Aug-10 21:38 
AnswerRe: how to session value in a page. Pin
Jens Meyer12-Aug-10 22:10
Jens Meyer12-Aug-10 22:10 
GeneralRe: how to session value in a page. Pin
Mubeen.asim12-Aug-10 23:17
Mubeen.asim12-Aug-10 23:17 
QuestionResize problem for drawn rectangle on the picture box? Pin
Nivas8212-Aug-10 20:27
Nivas8212-Aug-10 20:27 
Hi,

Customer wants to draw a rectangle on the image and when zoom in and zoom out the position of the drawn rectangle should resize respectively.
Ex:
say a some text in the image and i have drawn a rectangle for that text. If i zoom the image the rectangle should also changes so they still covers that text on the image.

I don't want to paint (paste) the rectangle on the image because like to change the position the rectangle when ever user likes (i have achived this part so don't need ti wary on this)

I have load the image in the picture box and drawn some rectangles. Now like to zoom the image (along with drawn rectangle) as below code. My problem is when i zoom the image the Rectangle in the top of the image aligned correctly (at the new position) but the x point of the rectangle in the 3/4 (of the height of picture box)slightly move right.


How can resize the all rectangles?

Thanks in advance......

public void ZoomIn()
{


//sz to get the previous picture box size.

double ratio = 0d;

                if (sz1.Width >= Convert.ToInt16(sz.Width * 2.2))
                {
                    MessageBox.Show("Max ZoomIn");
                    

                }
                else
                {
                 
                    sz1.Width += 50;
                    sz1.Height += 50;
                    ratio = Convert.ToDouble(sz1.Width) / Convert.ToDouble(pictureBox1.Width);
                    pictureBox1.Size = sz1;
// get the Image rectangle value to set the offset

                    PropertyInfo pInfo = pictureBox1.GetType().GetProperty("ImageRectangle",
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance);

                    rect1 = (Rectangle)pInfo.GetValue(pictureBox1, null);

                    n2 = rect1.Y - n3;
                    n3 = rect1.Y;


                    Point pf = pictureBox1.Location;
                    pf.Offset(-25, -n2);

                    pictureBox1.Location = pf;

                    for (c = 0; c <= (rectangles.Count - 1); c++)
                    {

                        rect1.X = Convert.ToInt16(Convert.ToDouble(rectangles[c].X) * ratio);
                        rect1.Width = Convert.ToInt16(Convert.ToDouble(rectangles[c].Width) * ratio); 
                       //N2 TO ADUST THE Y POSITION OF DRAWN RECTANGLE
			rect1.Y = Convert.ToInt16(Convert.ToDouble(rectangles[c].Y) * ratio) + n2;
                        rect1.Height = Convert.ToInt16((Convert.ToDouble(rectangles[c].Height) * ratio);
// RECTANGLE LIST TO COLLECT ALL RECTANGLE VALUES
			rectangles.RemoveAt(c);
                        rectangles.Insert(c, rect1);
}
}
}

AnswerRe: Resize problem for drawn rectangle on the picture box? Pin
Luc Pattyn13-Aug-10 2:05
sitebuilderLuc Pattyn13-Aug-10 2:05 
GeneralRe: Resize problem for drawn rectangle on the picture box? Pin
Nivas8217-Aug-10 20:30
Nivas8217-Aug-10 20:30 
GeneralRe: Resize problem for drawn rectangle on the picture box? Pin
Luc Pattyn18-Aug-10 1:41
sitebuilderLuc Pattyn18-Aug-10 1:41 
GeneralRe: Resize problem for drawn rectangle on the picture box? Pin
Nivas8223-Aug-10 2:12
Nivas8223-Aug-10 2:12 
AnswerRe: Resize problem for drawn rectangle on the picture box? Pin
Luc Pattyn23-Aug-10 2:16
sitebuilderLuc Pattyn23-Aug-10 2:16 
GeneralRe: Resize problem for drawn rectangle on the picture box? Pin
Nivas8223-Aug-10 23:09
Nivas8223-Aug-10 23:09 
GeneralRe: Resize problem for drawn rectangle on the picture box? Pin
Nivas8220-Oct-10 21:30
Nivas8220-Oct-10 21:30 
QuestionHow to load a referenced dll from specified location not GAC? Pin
Jack2009512-Aug-10 16:57
Jack2009512-Aug-10 16:57 
AnswerRe: How to load a referenced dll from specified location not GAC? Pin
PIEBALDconsult12-Aug-10 17:46
mvePIEBALDconsult12-Aug-10 17:46 
GeneralRe: How to load a referenced dll from specified location not GAC? Pin
Luc Pattyn12-Aug-10 18:07
sitebuilderLuc Pattyn12-Aug-10 18:07 
GeneralRe: How to load a referenced dll from specified location not GAC? Pin
PIEBALDconsult12-Aug-10 18:14
mvePIEBALDconsult12-Aug-10 18:14 
GeneralRe: How to load a referenced dll from specified location not GAC? Pin
Luc Pattyn12-Aug-10 18:17
sitebuilderLuc Pattyn12-Aug-10 18:17 
GeneralRe: How to load a referenced dll from specified location not GAC? Pin
Jack2009512-Aug-10 18:37
Jack2009512-Aug-10 18:37 
GeneralRe: How to load a referenced dll from specified location not GAC? Pin
PIEBALDconsult12-Aug-10 19:11
mvePIEBALDconsult12-Aug-10 19:11 
GeneralRe: How to load a referenced dll from specified location not GAC? Pin
Jack2009512-Aug-10 22:57
Jack2009512-Aug-10 22:57 
GeneralRe: How to load a referenced dll from specified location not GAC? [modified] Pin
PIEBALDconsult13-Aug-10 3:10
mvePIEBALDconsult13-Aug-10 3:10 
QuestionArrays and Classes Pin
dluurs12-Aug-10 15:22
dluurs12-Aug-10 15:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.