。
因此,在MT5的更新中发生了一些变化,使墙纸变成了与预期不同的东西,也就是文章中所描述的那样,但这并不意味着它是由基金公司提供的,因为在C_WallPaper类别中,你可以看到以下的内容。
ObjectSetInteger ( Terminal.Get_ID(), szName, OBJPROP_BACK , true );
这说明对象必须要停在基座上,更明显的是,它被挡在了前面,因为接收的对象或BitMap会接收这些小块,一个解决办法是提高所有对象的状态,或者尝试降低Bitmap的状态,如果是这样,第二种办法就更简单了,这可以改变接收墙纸的对象的OBJPROP_ZORDER属性的值。我曾尝试过这两种解决方案,但我没有找到稳定的方法来解决这个问题,而且,我也不知道该怎么做,因为纸质的纸张必须按小时来计算。..如果你注意看,你会发现位图图像将被绘制在蜡烛的主体上,表明位图对象处于前台,这同样不是预期的行为,因为上面的那行代码,因为这个原因,它刚好接收到任何和所有的点击事件......🙁
//+------------------------------------------------------------------+ //| SelectFile.mqh | //+------------------------------------------------------------------+ #include <Controls\Dialog.mqh> #include <Controls\Button.mqh> #include <Controls\Edit.mqh> #include <Controls\ListView.mqh> #include <Controls\CheckGroup.mqh> //+------------------------------------------------------------------+ //| defines | //+------------------------------------------------------------------+ #define INDENT_LEFT (4) // indent from left #define INDENT_TOP (4) // indent from top #define INDENT_RIGHT (4) // indent from right #define BUTTON_WIDTH (60) // size by X coordinate #define BUTTON_HEIGHT (20) // size by Y coordinate #define EDIT_HEIGHT (20) // size by Y coordinate #define COMMON_WIDTH (90) // size by X coordinate //+------------------------------------------------------------------+ //| Class CSelectFile | //+------------------------------------------------------------------+ class CSelectFile : public CDialog { CEdit m_filename; CButton m_button_ok; CButton m_button_cancel; CListView m_filelist; CCheckGroup m_common; string m_instance_id, m_files[], m_folders[], m_prevfolder, m_cfolder, m_fullname; int m_numberfiles, m_numberfolders, m_totalfiles, m_fileflag, m_pressbutton; protected: CChart m_chart; public: CSelectFile(void); ~CSelectFile(void); virtual bool Create(const long chart,const string name,const int x1,const int y1,const int x2,const int y2); int ChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam); string Filename(){ m_pressbutton=0; return(m_fullname);} int FileFlag(){ return(m_fileflag);} protected: void OnClickButtonOK(void); void OnClickButtonCancel(void); virtual void OnClickButtonClose(void); void OnChangeList(void); void OnCheckCommon(void); void SetFolder(string m_fol=""); }; //+------------------------------------------------------------------+ CSelectFile::CSelectFile(void) { m_instance_id=IntegerToString(rand(),5,'0'); m_fileflag=0; m_pressbutton=0; m_fullname=""; m_cfolder=""; m_prevfolder=""; m_numberfiles=0; m_numberfolders=0; } //+------------------------------------------------------------------+ CSelectFile::~CSelectFile(void) { ArrayFree(m_folders); ArrayFree(m_files); m_chart.Detach(); CDialog::Destroy(); } //+------------------------------------------------------------------+ bool CSelectFile::Create(const long chart,const string name,const int x1,const int y1,const int x2,const int y2) { if(x2-x1<280 || y2-y1<200) return(false); m_chart_id=chart; m_name=name; m_subwin=0; //--- initialize chart object m_chart.Attach(chart); //--- specify object and mouse events if(!m_chart.EventObjectCreate() || !m_chart.EventObjectDelete() || !m_chart.EventMouseMove()) { Print("CSelectFile: object events specify error"); m_chart.Detach(); return(false); } //--- call method of the parent class if(!CDialog::Create(m_chart.ChartId(),m_instance_id,m_subwin,x1,y1,x2,y2)) { Print("CSelectFile: expert dialog create error"); m_chart.Detach(); return(false); } Caption(name); //--- create dependent controls //--- create list of files int _x1=INDENT_LEFT; int _y1=INDENT_TOP; int _x2=ClientAreaWidth()-INDENT_RIGHT; int _y2=_y1+(ClientAreaHeight()-INDENT_TOP*5-EDIT_HEIGHT*2); if(!m_filelist.Create(m_chart_id,m_name+"FileList",m_subwin,_x1,_y1,_x2,_y2)) return(false); if(!Add(m_filelist)) return(false); m_prevfolder=""; m_cfolder=""; SetFolder(m_cfolder); //--- create field of filename _x1=INDENT_LEFT; _y1=INDENT_TOP+_y2; _x2=ClientAreaWidth()-INDENT_RIGHT; _y2=_y1+EDIT_HEIGHT+INDENT_TOP; if(!m_filename.Create(m_chart_id,m_name+"Filename",m_subwin,_x1,_y1,_x2,_y2)) return(false); if(!Add(m_filename)) return(false); //--- create common check _x1=INDENT_LEFT; _y1=INDENT_TOP+_y2; _x2=_x1+COMMON_WIDTH; _y2=_y1+EDIT_HEIGHT; if(!m_common.Create(m_chart_id,m_name+"Common",m_subwin,_x1,_y1,_x2,_y2)) return(false); if(!Add(m_common)) return(false); if(!m_common.AddItem("Common",1)) return(false); //--- create button Cancel _x1=ClientAreaWidth()-INDENT_RIGHT-BUTTON_WIDTH; _x2=_x1+BUTTON_WIDTH; _y2=_y1+BUTTON_HEIGHT; if(!m_button_cancel.Create(m_chart_id,m_name+"Cancel",m_subwin,_x1,_y1,_x2,_y2)) return(false); if(!m_button_cancel.Text("Cancel")) return(false); if(!Add(m_button_cancel)) return(false); //--- create button OK _x1=_x1-INDENT_RIGHT-BUTTON_WIDTH; _x2=_x1+BUTTON_WIDTH; if(!m_button_ok.Create(m_chart_id,m_name+"OK",m_subwin,_x1,_y1,_x2,_y2)) return(false); if(!m_button_ok.Text("OK")) return(false); if(!Add(m_button_ok)) return(false); //---- m_pressbutton=0; m_fullname=""; m_chart.Redraw(); //---- if(Id(m_subwin*CONTROLS_MAXIMUM_ID)>CONTROLS_MAXIMUM_ID) { Print("CSelectFile: too many objects"); return(false); } return(true); } //+------------------------------------------------------------------+ //| Event handler | //+------------------------------------------------------------------+ int CSelectFile::ChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam) { if(id==(ON_CLICK+CHARTEVENT_CUSTOM) && lparam==m_button_ok.Id()) OnClickButtonOK(); else if(id==(ON_CLICK+CHARTEVENT_CUSTOM) && lparam==m_button_cancel.Id()) OnClickButtonCancel(); else if(id==(ON_CHANGE+CHARTEVENT_CUSTOM) && lparam==m_filelist.Id()) OnChangeList(); else if(id==(ON_CHANGE+CHARTEVENT_CUSTOM) && lparam==m_common.Id()) OnCheckCommon(); else if(!CDialog::OnEvent(id,lparam,dparam,sparam)) return(0); m_chart.Redraw(); return(m_pressbutton); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CSelectFile::OnClickButtonOK(void) { m_fullname=m_filename.Text(); StringTrimLeft(m_fullname); StringTrimRight(m_fullname); if(StringLen(m_fullname)>0) { m_fullname=m_cfolder+m_fullname; m_pressbutton=1; } } //+------------------------------------------------------------------+ void CSelectFile::OnClickButtonCancel(void) { m_pressbutton=-1; m_fullname=""; } //+------------------------------------------------------------------+ void CSelectFile::OnClickButtonClose(void) { OnClickButtonCancel(); } //+------------------------------------------------------------------+ void CSelectFile::OnChangeList(void) { int i=(int)m_filelist.Value(); if(i<0) return; else if(i==0) { string s; if(m_cfolder==m_prevfolder || s==m_prevfolder) { m_cfolder=""; m_prevfolder=m_cfolder; SetFolder(m_cfolder); } else { s="\\"+m_prevfolder; StringReplace(m_cfolder,s,"\\"); m_prevfolder=m_cfolder; if(m_cfolder=="\\") m_cfolder=""; SetFolder(m_cfolder+"\\"); } m_filename.Text(""); } else if(i<m_numberfolders) { m_prevfolder=m_folders[i]; m_cfolder+=m_prevfolder; SetFolder(m_cfolder+"\\"); m_filename.Text(""); } else m_filename.Text(m_filelist.Select()); } //+------------------------------------------------------------------+ void CSelectFile::OnCheckCommon(void) { m_fileflag=m_common.Value()>0?FILE_COMMON:0; if(m_fileflag==0) { m_prevfolder=""; m_cfolder=""; SetFolder(m_cfolder); m_filename.Text(""); } else { m_prevfolder=""; m_cfolder=""; SetFolder(m_cfolder); m_filename.Text(""); } } //+------------------------------------------------------------------+ void CSelectFile::SetFolder(string fol="") { string fl,ff,fld=fol; StringReplace(fld,"\\\\","\\"); int i; m_filelist.Select(0); m_filelist.ItemsClear(); ArrayResize(m_folders,1); ArrayResize(m_files,1); if(fld=="Files\\") fl=""; else fl=fld; //---folders long hfind=FileFindFirst(fl+"*",ff,m_fileflag); if(hfind==INVALID_HANDLE) {//empty folder m_numberfiles=0; m_numberfolders=1; m_folders[0]="Files\\"+fld; m_filelist.ItemAdd(m_folders[0]); m_totalfiles=0; } else { m_numberfiles=0; m_numberfolders=0; do { if(StringFind(ff,"\\")>1) m_numberfolders++; m_numberfiles++; } while(FileFindNext(hfind,ff)); FileFindClose(hfind); ArrayResize(m_folders,m_numberfolders+1); hfind=FileFindFirst(fl+"*",ff,m_fileflag); if(hfind==INVALID_HANDLE) return; m_numberfolders=1; do { if(StringFind(ff,"\\")>1){ m_folders[m_numberfolders]=ff; m_numberfolders++;} } while(FileFindNext(hfind,ff)); FileFindClose(hfind); if(fld=="") { m_folders[0]="Files\\"; ff=""; } else { m_folders[0]=fld; ff="Files\\"; } m_filelist.ItemAdd(ff+m_folders[0]); int nn=m_numberfolders; for(i=1; i<nn; i++) m_filelist.ItemAdd(m_folders[i]); //---files hfind=FileFindFirst(fl+"*.*",ff,m_fileflag); m_numberfiles=0; do { if(StringFind(ff,"\\")<0) m_numberfiles++; } while(FileFindNext(hfind,ff)); FileFindClose(hfind); if(m_numberfiles>0) { ArrayResize(m_files,m_numberfiles); m_numberfiles=0; hfind=FileFindFirst(fl+"*.*",ff,m_fileflag); if(hfind!=INVALID_HANDLE) { do { if(StringFind(ff,"\\")<0) { m_files[m_numberfiles]=ff; m_numberfiles++;} } while(FileFindNext(hfind,ff)); FileFindClose(hfind); } for(i=0; i<m_numberfiles; i++) m_filelist.ItemAdd(m_files[i]); } m_totalfiles=m_numberfiles+m_numberfolders+1; } } //+------------------------------------------------------------------+
//+------------------------------------------------------------------+ //| Test_SelectFile.mq5 | //+------------------------------------------------------------------+ #include <class_SelectFile.mqh> //+------------------------------------------------------------------+ CSelectFile *SelectFile=NULL; //+------------------------------------------------------------------+ int OnInit() { SelectFile=new CSelectFile(); if(!SelectFile.Create(0,"Select a file",20,20,350,300)) return(-1); return(0); } //+------------------------------------------------------------------+ void OnDeinit(const int reason) { if(SelectFile!=NULL) delete SelectFile; } //+------------------------------------------------------------------+ void OnChartEvent(const int id, // event ID const long& lparam, // event parameter of the long type const double& dparam, // event parameter of the double type const string& sparam) // event parameter of the string type { if(SelectFile!=NULL) { int key=SelectFile.ChartEvent(id,lparam,dparam,sparam); if(key>0) {//press button OK string file=SelectFile.Filename(); int flag=SelectFile.FileFlag(); delete SelectFile; SelectFile=NULL; Print("The selected file - ",flag==FILE_COMMON?"[Common]":"",file); int handle=FileOpen(file,flag); if(handle>0) { Print(file," - open"); FileClose(handle); } else Print(file," - failed to open"); } else if(key<0) {//press button Cancel delete SelectFile; SelectFile=NULL; Print("No file selected"); } } if(SelectFile==NULL) { Print("The program is completed"); ExpertRemove(); } } //+------------------------------------------------------------------+请在点击图片时修改图片。我想知道是否有可能,如果没有可能,那么我就不会放弃我的神经系统。
在MT5的更新中发生了一些事情,将墙纸变成了与文章中预期不同的东西,因为它正确地显示在图形背景中,因为在C_WallPaper类中你会发现以下一行。
这告诉我们,该对象将不得不留在后台,更奇怪的是,它正在走到前面,因为这个,接收或BitMap的OBJECT开始接收点击,一个解决方案是增加所有对象的状态,或尝试降低Bitmap的状态,在这种情况下,这第二个会更简单。这将通过改变接收墙纸的对象中的OBJPROP_ZORDER属性的值来实现,我尝试了这两种解决方案,但我无法以一种纠正问题的方式稳定整个事情,因此,和INFELIZMENTE,墙纸必须暂时被丢弃。..如果你注意看,你会发现位图图像被绘制在蜡烛体上,表明位图对象在前台,这同样不是预期的行为,因为上面那行代码,正因为如此,它刚好接收到任何和所有的点击事件......。🙁
丹尼尔。
如果你放一个定时器并运行一个功能来禁用和再次启用墙纸,或者通过把墙纸放在后台(后面)来 "重申 "这个功能,这可能吗?
我使用的一个GUI面板,我不得不去选择这个解决方案。一些图形元素需要删除并重新创建,根据对象的类型,放在背景或前面。
新文章 让图表更有趣:添加背景已发布:
许多工作站包含一些代表性的图片用以显示用户的一些信息。 这些图片令工作环境更加优美和令人兴奋。 我们来看看如何通过添加背景令图表更有趣。
许多工作站包含一些代表性的图片用以显示用户的一些信息。 这些图片使工作环境更加美丽和愉悦身心,因为人们总是试图选择贴心和最漂亮的图片作为壁纸。 但当我们打开交易平台时,我们发现它有点无趣。 我们所拥有的只是数字数据的图形表示。
即使看很长一段时间的图片和照片您也不会感到疲倦,但观察价格图表哪怕是几分钟也会很累。 所以,我们如此做,就可以观察和分析图表,而背景中的图片能激励我们,提醒我们一些美好的东西。
作者:Daniel Jose