void TranslatePSPosition(MachineUI.ucPS_new objPS, int position) { float aspectRatio = 0; //aspectRatio = Math.Abs(objPS.MinXValue - objPS.MaxXValue) / Math.Abs(objCM.MinValue - objCM.MaxValue); aspectRatio = GetAspectRatio(objPS.MaxXValue, objPS.MinXValue, objPS.MaxValue, objPS.MinValue); TransformGroup tg = objPS.RenderTransform as TransformGroup; TranslateTransform rt = tg.Children[3] as TranslateTransform; rt.X = (position - objPS.MinValue) * aspectRatio; }
MachineUI.ucPS_new GetPSObject(string psCode) { MachineUI.ucPS_new returnCM = null; foreach (MachineUI.ucPS_new objPS in FindVisualChildren <MachineUI.ucPS_new>(this)) { if (objPS.MachineCode.Equals(psCode)) { returnCM = objPS; } } return(returnCM); }
void SetPSPosition(string psCode, int position) { MachineUI.ucPS_new objPS = GetPSObject(psCode); TranslatePSPosition(objPS, position); }