Forum to discuss AForge.NET Framework, its features, API, how-tos, etc.
by btb4198 » Fri Jul 27, 2018 3:47 pm
ok,
so I tried running Install-Package zeroc.ice.v141 -Version 3.7.1 but I keep getting errors
Install-Package zeroc.ice.net -Version 3.7.0 but it is still giving me errors
-
btb4198
-
- Posts: 34
- Joined: Fri May 18, 2018 2:31 am
by btb4198 » Fri Jul 27, 2018 6:55 pm
ok I am getting some new errors: Severity Code Description Project File Line Suppression State Error CS1061 'object' does not contain a definition for 'GetHicon' and no extension method 'GetHicon' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) Pixelation Tool 1455 Active
Severity Code Description Project File Line Suppression State Error CS0103 The name 'zoom_out' does not exist in the current context Pixelation Tool 1461 Active
-
btb4198
-
- Posts: 34
- Joined: Fri May 18, 2018 2:31 am
by btb4198 » Wed Aug 15, 2018 1:33 pm
hi,
can you post the pan code ?
Thanks, Brandon T Boone
-
btb4198
-
- Posts: 34
- Joined: Fri May 18, 2018 2:31 am
by btb4198 » Sat Mar 28, 2020 12:17 pm
ok i am having a big problem with this zoom function. If I click on a location it will zoom where I click at , and if I click on that same location it will work too... but if I click a new location is will zoom off my mouse. it seem to miss up ever time I pick a new location . and IDK why... so if I click on a new location and zoom in, it will zoom in off my mouse , but I click on that same area , it will work ... it is something about more to a new location it does not like and I do not know why.. there seem to be some off set for new locations but idk what it is... here is my code : - Code: Select all
private void videoSourcePlayer_Click(object sender, EventArgs e) {
MouseEventArgs arg = (MouseEventArgs)e; float tempPointX; float tempPointY;
float offsetX = 0; float offsetY = 0;
tempPointX = ((arg.Location.X - videoSourcePlayer.imagex) / videoSourcePlayer.zoomFactor); tempPointY = ((arg.Location.Y - videoSourcePlayer.imagey ) / videoSourcePlayer.zoomFactor);
offsetX = tempPointXOLD - tempPointX; offsetX = tempPointYOLD - tempPointY; if (this.videoSourcePlayer.zoomFactor > 1) { if (offsetX > 0) { tempPointX = tempPointX + offsetX;
}
else if (offsetX < 0) { tempPointX = tempPointX - Math.Abs(offsetX);
}
if (offsetY > 0) { tempPointY = tempPointY + offsetY;
}
else if (offsetY < 0) { tempPointY = tempPointY - Math.Abs(offsetY);
} } tempPointXOLD = tempPointX; tempPointYOLD = tempPointY;
// tempPointYOLD = arg.Location.Y;
if (HandCheckBox.Checked) { return; } if (this.btZoomIn.Checked == true) { this.videoSourcePlayer.Panflag = false; float zoom = this.videoSourcePlayer.zoomFactor * 1.5F; if (zoom > 15) { zoom = 15; return;
}//maximum value is 10 //minimum value is 0.2 Console.WriteLine("Arg X = " + arg.Location.X + " and Arg Y = " + arg.Location.Y); Console.WriteLine("tempPointX = " + tempPointX + " and tempPointY = " + tempPointY) ;
this.videoSourcePlayer.Zoom(zoom, tempPointX, tempPointY);
} else if (this.btZoomOut.Checked == true) { this.videoSourcePlayer.Panflag = false; float zoom = this.videoSourcePlayer.zoomFactor / 1.5F; this.videoSourcePlayer.Zoom(zoom, tempPointX, tempPointY); }
if (btPan.Checked == true) { this.videoSourcePlayer.Pan(arg.Location); this.videoSourcePlayer.Panflag = true; } videoSourcePlayer.RecalcImage = true;
} - Code: Select all
// Paint control private void VideoSourcePlayer_Paint( object sender, PaintEventArgs e ) { if ( !Visible ) { return; } // is it required to update control's size/position if ( ( needSizeUpdate ) || ( firstFrameNotProcessed ) ) { UpdatePosition( ); needSizeUpdate = false; } lock ( sync ) { Graphics g = e.Graphics; Rectangle rect = this.ClientRectangle; Pen borderPen = new Pen( borderColor, 1 );
g.DrawRectangle( borderPen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1 );
if ( videoSource != null ) { if ( ( currentFrame != null ) && ( lastMessage == null ) ) { imgWidth = (int)(this.Width * zoomFactor); imgHeight = (int)(this.Height * zoomFactor); if (RecalcImage && !Panflag) { Console.WriteLine(" Zoom Factor is " + zoomFactor); if (rect.Width < imgWidth) imagex = (zoomPointX * (-1) * (zoomFactor - 1)); else imagex = (rect.Width - imgWidth) / 2;
if (rect.Height < imgHeight) imagey = (zoomPointY * (-1) * (zoomFactor - 1)) ; else imagey = (rect.Height - imgHeight) / 2;
RecalcImage = false; } if (RecalcImage && Panflag == true && zoomFactor >1) { // x, y are positions of the upper left of the image // PanPosition is the position of the cursor within the ClientRectangle // need to find PanPosition relative to the image and move that point to the center of the ClientRectangle
imagex -= (PanPosition.X - rect.Width / 2) ; imagey -= (PanPosition.Y - rect.Height / 2) ; if (imagex > 0) imagex = 0; imagey = (imagey > 0) ? 0 : imagey;
if (imagex + imgWidth < rect.Width) imagex = rect.Width - imgWidth;
if (imagey + imgHeight < rect.Height) imagey = rect.Height - imgHeight;
RecalcImage = false; }
// keepRatio = true; if ( keepRatio ) {
Bitmap frame = ( convertedFrame != null ) ? convertedFrame : currentFrame; double ratio = (double) frame.Width / frame.Height; Rectangle newRect = rect;
if ( rect.Width < rect.Height * ratio ) { newRect.Height = (int) ( rect.Width / ratio ); } else { newRect.Width = (int) ( rect.Height * ratio ); }
newRect.X = ( rect.Width - newRect.Width ) / 2; newRect.Y = ( rect.Height - newRect.Height ) / 2;
g.DrawImage(currentFrame, imagex, imagey, imgWidth, imgHeight); newWide = (int)(imgWidth - imagex); newHeight = (int) (imgHeight - imagey);
// g.DrawImage( frame, newRect.X + 1, newRect.Y + 1, newRect.Width - 2, newRect.Height - 2); } else { // draw current frame try { g.DrawImage(currentFrame, imagex, imagey, imgWidth, imgHeight); // Console.WriteLine("Image = " + imagex + " " + imagey + " " + imgWidth + " " + imgHeight); newWide = (int)(imgWidth - imagex); newHeight = (int)(imgHeight - imagey); } catch (Exception err) { }
// draw current frame // g.DrawImage( frame, rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2); }
firstFrameNotProcessed = false; // currentPic = new Bitmap(currentFrame, newWide, newHeight);// imgWidth, imgHeight); } else { // create font and brush SolidBrush drawBrush = new SolidBrush( this.ForeColor );
g.DrawString( ( lastMessage == null ) ? "Connecting ..." : lastMessage, this.Font, drawBrush, new PointF( 5, 5 ) ); currentPic = currentFrame;//new Bitmap(currentFrame, this.Width, this.Height); Console.WriteLine("in side the Else"); drawBrush.Dispose( ); } } borderPen.Dispose( ); }
}
has any one else gotten this to work?
-
btb4198
-
- Posts: 34
- Joined: Fri May 18, 2018 2:31 am
Return to AForge.NET Framework
|

|