📄 npdeeu2.prg
字号:
Execute(GetConfig(1));
autogr2config(x___):={if(AskUserYesNo("There is an error in your 2D graphics view configuration:"+chr(13)+x___+chr(13)+"Do you want to configure the 2D graphics view automatically?")==0,{abort(x___);},
{
axe1:=chr(34)+GetUserInput("Enter the expression displayed on the first axis:")+chr(34);
axe2:=chr(34)+GetUserInput("Enter the expression displayed on the second axis:")+chr(34);
min1:=GetUserInput("Enter the minimum value displayed on the first axis:");
max1:=GetUserInput("Enter the maximum value displayed on the first axis:");
min2:=GetUserInput("Enter the minimum value displayed on the second axis:");
max2:=GetUserInput("Enter the maximum value displayed on the second axis:");
draw:=0;
if(AskUserYesNo("Do you want to display the axes:"),
{draw:=draw||1;},{});
if(AskUserYesNo("Do you want to display the solution:"),
{draw:=draw||2;},{});
if(AskUserYesNo("Do you want to keep the aspect ratio:"),
{draw:=draw||4;},{});
SetConfig(computeall:="axe1:="+axe1+";"+chr(13)+chr(10)+
"axe2:="+axe2+";"+chr(13)+chr(10)+
"min1:="+min1+";"+chr(13)+chr(10)+
"max1:="+max1+";"+chr(13)+chr(10)+
"min2:="+min2+";"+chr(13)+chr(10)+
"max2:="+max2+";"+chr(13)+chr(10)+
"draw:="+numtos(draw)+";"+chr(13)+chr(10));
Abort("The setup is complete."+chr(13)+"Use File/Execute to start again."+chr(13)+chr(13)+computeall);
});
};
if(valid(draw)!=-1,{draw:=7;},{});
if(valid(axe1)!=-4,{autogr2config("You must define the variable axe1 as the text containing the expression to be displayed on the first axis.");},{});
if(valid(axe2)!=-4,{autogr2config("You must define the variable axe2 as the text containing the expression to be displayed on the second axis.");},{});
if((valid(min1)!=-1)&&(valid(min1)!=-2),{autogr2config("You must define the variable min1 as the minimal value to be displayed on the first axis.");},{});
if((valid(max1)!=-1)&&(valid(max1)!=-2),{autogr2config("You must define the variable max1 as the maximal value to be displayed on the first axis.");},{});
if((valid(min2)!=-1)&&(valid(min2)!=-2),{autogr2config("You must define the variable min2 as the minimal value to be displayed on the second axis.");},{});
if((valid(max2)!=-1)&&(valid(max2)!=-2),{autogr2config("You must define the variable max2 as the maximal value to be displayed on the second axis.");},{});
g_sx:=(max1-min1)/(getwinsize(2)-getwinsize(0));
g_sy:=(max2-min2)/(getwinsize(3)-getwinsize(1));
if(draw&&4,{g_s:=max(g_sx,g_sy);
WindowExt(min1,min2+g_s*(getwinsize(3)-getwinsize(1)),min1+g_s*(getwinsize(2)-getwinsize(0)),min2);},
{WindowExt(min1,max2,max1,min2);});
BgrColor(255,255,255);
FgrColor(0,0,0);
UPDFrequency(16);
if(draw&&2,{
OnUpdate(g_update:=execute("{BgrColor(255,255,255);Moveto(min1,0);lineto(max1,0);
moveto(0,min2);lineto(0,max2);j:=0;x:=x0;moveto("+axe1+","+axe2+");
while({j<=n},{x:=x0+j*dx;j:=j+1;LineTo("+axe1+","+axe2+");});DisplayView(0);}"));
},{});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -