i want to show the center part of the icVideo box by cropping and show it to bottom part of the icVideo. here middle part of the icVideo will be the diamond's girdle part(the three lines between diamond) as here is example of the project image
Screenshot-2024-02-02-115020 hosted at ImgBB — ImgBB[
^]
the height of the cropped part is okay but i want to show the center of the icVideo where currently i am getting top of the icVideo. i have tried multiple solutions but it didn't work. how do i show that center of the icVideo at bottom of the icVideo box?
What I have tried:
here i have icVideo_OverlayUpdate event
private void icVideo_OverlayUpdate(object sender, ICImagingControl.OverlayUpdateEventArgs e)
{
try
{
imageToDisplay = Diamond_Steaching.Properties.Resources.Sparrow1;
this.ob = e.overlay;
this.CentX = this.icVideo.Width / 2;
this.CentY = this.icVideo.Height / 2;
this.ob.DropOutColor = System.Drawing.Color.Magenta;
this.ob.Fill(System.Drawing.Color.Magenta);
this.ob.Enable = true;
this.ob.FontBackColor = this.ob.DropOutColor;
this.ob.FontTransparent = false;
bool bdrawgraph = true;
int x0_2 = 12;
int y0_2 = 10;
this.ob.Font = new Font("Arial", 10f, FontStyle.Bold);
this.ob.DrawText(System.Drawing.Color.Red, x0_2, y0_2, "Inspector v3.0.3");
this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 15, "Diameter : " + GlobalManagement.Instance.objDiamond.Diameter);
this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 30, "CrownAngle : " + GlobalManagement.Instance.objDiamond.CrownAngle);
this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 45, "CrownHeight : " + GlobalManagement.Instance.objDiamond.CrownHeight);
this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 60, "BottomAngle : " + GlobalManagement.Instance.objDiamond.BottomAngle);
this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 75, "Girdle : " + GlobalManagement.Instance.objDiamond.Girdle);
this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 90, "Table : " + GlobalManagement.Instance.objDiamond.Table);
if (imageToDisplay != null)
{
using (Graphics g = ob.GetGraphics())
{
int imageX = 250;
int imageY = 1;
int imageWidth = 60;
int imageHeight = 60;
Rectangle destinationRect = new Rectangle(imageX, imageY, imageWidth, imageHeight);
g.DrawImage(imageToDisplay, destinationRect);
x0_2 = 310;
y0_2 = 20;
this.ob.Font = new Font("Arial", 15f, FontStyle.Bold);
string hex = "#2791b9";
}
}
using (Graphics g = ob.GetGraphics())
{
int liveVideoX = -300;
int liveVideoY = (int)(icVideo.Height - 100);
int liveVideoWidth = (int)(icVideo.Width + 450);
int liveVideoHeight = (int)(icVideo.Height);
Rectangle liveVideoRect = new Rectangle(liveVideoX, liveVideoY, liveVideoWidth, liveVideoHeight);
g.DrawImage(icVideo.ImageActiveBuffer.Bitmap, liveVideoRect);
g.DrawImage(icVideo.ImageActiveBuffer.Bitmap, new RectangleF(liveVideoRect.X, liveVideoRect.Y, liveVideoRect.Width * 2, liveVideoRect.Height * 2));
}
if (isDrawDiamond)
{
Drawdiamond();
}
}
catch (Exception ex)
{
WriteErrorLog(ex);
}
}