I am use this function to draw multi valve image in the screen but when run the application in different resolution the image position change
the application work only with 1920x 1080 resolution when you change the resolution the image will be in different position in the screen
how I can fix the image position in the form without change the resolution
public void xvcloseevent(object sender, PaintEventArgs e)
{
try {
Screen scr = Screen.PrimaryScreen;
int temphigh = scr.Bounds.Height;
int tempwidth = scr.Bounds.Width;
Assembly asm = Assembly.GetExecutingAssembly();
Stream stm = asm.GetManifestResourceStream("FirstprojectDCS.FilesProjectsDcs.xv_close.png");
Bitmap xv_close = new Bitmap(stm);
Stream stm2 = asm.GetManifestResourceStream("FirstprojectDCS.FilesProjectsDcs.FV_CLOSE.png");
Bitmap Fv_close = new Bitmap(stm2);
Stream stm3 = asm.GetManifestResourceStream("FirstprojectDCS.FilesProjectsDcs.FV_CLOSE_V_L.png");
Bitmap Fv_close_v_l = new Bitmap(stm3);
Stream stm4 = asm.GetManifestResourceStream("FirstprojectDCS.FilesProjectsDcs.FV_CLOSE _V_L2.png");
Bitmap Fv_close_V_L2 = new Bitmap(stm4);
Pen Mypen = new Pen(Color.Red,1);
xv_close.SetResolution(96.0F, 96.0F);
Fv_close.SetResolution(96.0F, 96.0F);
Fv_close_v_l.SetResolution(96.0F, 96.0F);
Fv_close_V_L2.SetResolution(96.0F, 96.0F);
Graphics g = e.Graphics;
int sourceWidth = xv_close.Width;
int sourceHeight = xv_close.Height;
if (ESD_no == 2 || ESD_no == 2013)
{
if (ESD_no == 2)
{
g.DrawString("ESD-002 action Deoxo Rx Shduwn", new Font("Verdana", 20),
new SolidBrush(Color.Tomato), 40, 40);
}
else if (ESD_no == 2013)
{
g.DrawString("ESD-201 cause 3 1620-XPB-023A- Deoxo Reactor Depressurizing Local Pushbutton", new Font("Verdana", 17),
new SolidBrush(Color.Tomato), 40, 40);
g.DrawString("ESD-201 cause 3 action Deoxo Rx Shduwn", new Font("Verdana", 17),
new SolidBrush(Color.Tomato), 40, 70);
}
xcoordinate = 122;
ycoordinate = 145-26;
g.DrawImage(xv_close, xcoordinate, ycoordinate, sourceWidth, sourceHeight);
g.DrawEllipse(Mypen, xcoordinate - 60, ycoordinate - 60, 160, 120);
xcoordinate = 834;
ycoordinate = 307 - 26;
g.DrawImage(xv_close, xcoordinate, ycoordinate, sourceWidth, sourceHeight);
g.DrawEllipse(Mypen, xcoordinate - 60, ycoordinate - 60, 160, 120);
xcoordinate = 946;
ycoordinate = 307 - 26;
g.DrawImage(xv_close, xcoordinate, ycoordinate, sourceWidth, sourceHeight);
g.DrawEllipse(Mypen, xcoordinate - 60, ycoordinate - 60, 160, 120);
xcoordinate = 507;
ycoordinate = 639 - 26;
g.DrawImage(xv_close, xcoordinate, ycoordinate, sourceWidth, sourceHeight);
g.DrawEllipse(Mypen, xcoordinate - 60, ycoordinate - 60, 160, 120);
xcoordinate = 730;
ycoordinate = 460 - 26;
g.DrawImage(xv_close, xcoordinate, ycoordinate, sourceWidth, sourceHeight);
g.DrawEllipse(Mypen, xcoordinate - 60, ycoordinate - 60, 160, 120);
xcoordinate = 1033;
ycoordinate = 146 - 26;
g.DrawImage(xv_close, xcoordinate, ycoordinate, sourceWidth, sourceHeight);
g.DrawEllipse(Mypen, xcoordinate - 60, ycoordinate - 60, 160, 120);
xcoordinate = 1142;
ycoordinate = 143 - 26;
g.DrawImage(xv_close, xcoordinate, ycoordinate, sourceWidth, sourceHeight);
g.DrawEllipse(Mypen, xcoordinate - 60, ycoordinate - 60, 160, 120);
if (IntertripESD == 3)
{
g.DrawString("ESD-003 intertrip with ESD-002 N2 PURGING ", new Font("Verdana",10),
new SolidBrush(Color.DarkGreen), 1281-80, 119-90);
xcoordinate = 1290;
ycoordinate = 114 - 26;
What I have tried:
I am use this function to draw multi valve image in the screen but when run the application in different resolution the image position change
the application work only with 1920x 1080 resolution when you change the resolution the image will be in different position in the screen
how I can fix the image position in the form without change the resolution