老铁们,大家好,相信还有很多朋友对于edit是什么意思和Edit编辑控件的说明与创建的相关问题不太懂,没关系,今天就由我来为大家分享分享edit是什么意思以及Edit编辑控件的说明与创建的问题,文章篇幅可能偏长,希望可以帮助到大家,下面一起来看看吧!
编辑控件Edit是编程开发中常用的一种界面控件。他的建立很简单:
m_edt.Create("user",x,y,kuan,gao,g_can.m_font_kj);
这样就建立了一个简单的编辑控件。
常用的对应编辑控件的其他设置有:
1、建立一个密码的编辑控件,也就是当你输入字符的时候他会以一个*号代替:
m_edt.Create("psd",x,y,kuan,gao,g_can.m_font_kj,iEs_Password);
2、建立一个只读的编辑控件,也就是这个编辑控件你是不能编辑的:
m_edt.Create("这个只显示,不能编辑",x,y,kuan,gao,g_can.m_font_kj,iEs_ReadOnly);
3、建立一个多行编辑控件,当输入内容较多的时候就要用到这个了:
m_edt.CreateMultiLine("多行编辑框",x,y,kuan,gao,g_can.m_font_kj);
m_edt.CreateMultiLine("多行编辑框",x,y,kuan,gao,g_can.m_font_kj,iEs_ReadOnly);
二、如何获取控件值,代码很简单
m_edt.GetTxt();//结果就保存在m_edt.m_ps中
m_edt.SetTxt("设置值");
sprintf_s(m_edt.m_ps,1024,"设置值");
五、附上常用的编辑框的风格说明:
#defineiEs_Left0x0000L//左对齐文本Leftalignstext
#defineiEs_Center0x0001L//在多行编辑器中将文本置中.Windows98/Me,Windows2000/XP:Centerstextinasingle-lineormultilineeditcontrol.Windows95,WindowsNT4.0andearlier:Centerstextinamultilineeditcontrol.
#defineiEs_Right0x0002L//右对齐Windows98/Me,Windows2000/XP:Rightalignstextinasingle-lineormultilineeditcontrol.Windows95,WindowsNT4.0andearlier:Rightalignstextinamultilineeditcontrol.
#defineiEs_MultiLine0x0004L//设定为多行Designatesamultilineeditcontrol.Thedefaultissingle-lineeditcontrol.Whenthemultilineeditcontrolisinadialogbox,thedefaultresponsetopressingtheENTERkeyistoactivatethedefaultbutton.TousetheENTERkeyasacarriagereturn,usetheES_WANTRETURNstyle.WhenthemultilineeditcontrolisnotinadialogboxandtheES_AUTOVSCROLLstyleisspecified,theeditcontrolshowsasmanylinesaspossibleandscrollsverticallywhentheuserpressestheENTERkey.IfyoudonotspecifyES_AUTOVSCROLL,theeditcontrolshowsasmanylinesaspossibleandbeepsiftheuserpressestheENTERkeywhennomorelinescanbedisplayed.IfyouspecifytheES_AUTOHSCROLLstyle,themultilineeditcontrolautomaticallyscrollshorizontallywhenthecaretgoespasttherightedgeofthecontrol.Tostartanewline,theusermustpresstheENTERkey.IfyoudonotspecifyES_AUTOHSCROLL,thecontrolautomaticallywrapswordstothebeginningofthenextlinewhennecessary.AnewlineisalsostartediftheuserpressestheENTERkey.ThewindowsizedeterminesthepositionoftheWordwrap.Ifthewindowsizechanges,theWordwrappingpositionchangesandthetextisredisplayed.Multilineeditcontrolscanhavescrollbars.Aneditcontrolwithscrollbarsprocessesitsownscrollbarmessages.Notethateditcontrolswithoutscrollbarsscrollasdescribedinthepreviousparagraphsandprocessanyscrollmessagessentbytheparentwindow.
#defineiEs_UpperCase0x0008L//大写所有字符Convertsallcharacterstouppercaseastheyaretypedintotheeditcontrol.Tochangethisstyleafterthecontrolhasbeencreated,useSetWindowLong.
#defineiEs_LowerCase0x0010L//将所有输入字符自动转换为小写Convertsallcharacterstolowercaseastheyaretypedintotheeditcontrol.Tochangethisstyleafterthecontrolhasbeencreated,useSetWindowLong
#defineiEs_Password0x0020L//显示密码,用*代替文本,不想用*时可以使用iEm_SetPasswordChar消息来设置其他字符Displaysanasterisk(*)foreachcharactertypedintotheeditcontrol.Thisstyleisvalidonlyforsingle-lineeditcontrols.WindowsXP:Iftheeditcontrolisfromuser32.dll,thedefaultpasswordcharacterisanasterisk.However,iftheeditcontrolisfromcomctl32.dllversion6,thedefaultcharacterisablackcircle.Tochangethecharactersthatisdisplayed,orsetorclearthisstyle,usetheEM_SETPASSWORDCHARmessage.NoteComctl32.dllversion6isnotredistributablebutitisincludedinMicrosoftWindowsXPorlater.TouseComctl32.dllversion6,specifyitinamanifest.Formoreinformationonmanifests,seeUsingWindowsXPVisualStyles.
#defineiEs_AutoVScroll0x0040L//当用户在最后一行按回车时自动将文本向上滚动一行.AutomaticallyscrollstextuponepagewhentheuserpressestheENTERkeyonthelastline
#defineiEs_AutoHScroll0x0080L//当用户在行尾输入一个字符的时候,文本自动向右滚动10个字符,当按下回车时,文本滚动回到零位值Automaticallyscrollstexttotherightby10characterswhentheusertypesacharacterattheendoftheline.WhentheuserpressestheENTERkey,thecontrolscrollsalltextbacktopositionzero
#defineiEs_NoHideSel0x0100L//不作编辑框的默认动作,该动作是:当控件失去输入光标时,隐藏所选文本;当控件接受输入光标时,显示所有文本.Negatesthedefaultbehaviorforaneditcontrol.Thedefaultbehaviorhidestheselectionwhenthecontrollosestheinputfocusandinvertstheselectionwhenthecontrolreceivestheinputfocus.IfyouspecifyES_NOHIDESEL,theselectedtextisinverted,evenifthecontroldoesnothavethefocus
#defineiEs_OemConvert0x0400L//当应用程序调用AnsiToOen()将一个编辑控件中的ANSI字符转换成OEM字符串时,通过将控件中输入的ANSI字符集转换成OEM字符集再转回到ANSI,确保适当的字符转换,这种样式在包含文件名的编辑框中非常有用Convertstextenteredintheeditcontrol.ThetextisconvertedfromtheWindowscharactersettotheOEMcharactersetandthenbacktotheWindowscharacterset.ThisensurespropercharacterconversionwhentheapplicationcallstheCharToOemfunctiontoconvertaWindowsstringintheeditcontroltoOEMcharacters.ThisstyleismostusefulforeditcontrolsthatcontainfilenamesthatwillbeusedonfilesystemsthatdonotsupportUnicode.Tochangethisstyleafterthecontrolhasbeencreated,useSetWindowLong.
#defineiEs_ReadOnly0x0800L//只读,不得编辑Preventstheuserfromtypingoreditingtextintheeditcontrol.Tochangethisstyleafterthecontrolhasbeencreated,usetheEM_SETREADONLYmessage.
#defineiEs_WantReturn0x1000L//在一个对话框的单行编辑控件中,当用户按Enter键时插入回车"\\r"字符SpecifiesthatacarriagereturnbeinsertedwhentheuserpressestheENTERkeywhileenteringtextintoamultilineeditcontrolinadialogbox.Ifyoudonotspecifythisstyle,pressingtheENTERkeyhasthesameeffectaspressingthedialogbox'sdefaultpushbutton.Thisstylehasnoeffectonasingle-lineeditcontrol.Tochangethisstyleafterthecontrolhasbeencreated,useSetWindowLong.
#defineiEs_Number0x2000L//是输入数字(好像只使用win95)Allowsonlydigitstobeenteredintotheeditcontrol.Notethat,evenwiththisset,itisstillpossibletopastenon-digitsintotheeditcontrol.Tochangethisstyleafterthecontrolhasbeencreated,useSetWindowLong.
关于edit是什么意思,Edit编辑控件的说明与创建的介绍到此结束,希望对大家有所帮助。