外文翻译 - NET Compact Framework 2.0中的新事物_第1页
外文翻译 - NET Compact Framework 2.0中的新事物_第2页
外文翻译 - NET Compact Framework 2.0中的新事物_第3页
外文翻译 - NET Compact Framework 2.0中的新事物_第4页
外文翻译 - NET Compact Framework 2.0中的新事物_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

0外文原文WhatsNewinthe.NETCompactFramework2.0The.NETCompactFrameworkversion2.0offersmanyimprovementsoveritspredecessor,the.NETCompactFrameworkversion1.0.Althoughtheimprovementsarewidespread,theyallfocusonthecommongoalsofimprovingdeveloperproductivity,providinggreatercompatibilitywiththefull.NETFrameworkandincreasingsupportfordevicefeatures.Thisarticleprovidesahigh-levelsummaryofthe.NETCompactFramework2.0changesandenhancements.UserInterfaceTherelativelysmallsizeofsmartdevicedisplaysrequiresthatapplicationsusetheavailablespaceefficiently,whichhistoricallyhasrequiredthatdevelopersspendagreatdealoftimedesigningandimplementinganapplicationsuserinterface.Recentadvancesinsmartdisplaycapabilities,suchashigh-resolutionandmultipleorientationsupporthavemadethejobofuserinterfacedevelopmentevenmorechallenging.Tosimplifythetaskofcreatingapplicationuserinterfaces,the.NETCompactFramework2.0providesthemanynewfeaturesthataredescribedinthissection.WindowsFormsControlsAttheheartoftheuserinterfacearethecontrols;the.NETCompactFramework2.0providesanumberofnewcontrols.Thesenewcontrolsconsistofcontrolsthatthe.NETCompactFrameworkhasincommonwiththefull.NETFrameworkinadditiontocontrolsthatarespecifictodevices.MonthCalendarTheMonthCalendarcontrolisacustomizablecalendarcontrolthatprovidesavisualdisplayofdatesandisusefulforprovidingagraphicalwayforuserstoselectdates.DateTimePickerTheDateTimePickercontrolisacustomizablecontrolfordisplayingandallowinguserstoenterdateandtimeinformation.Itisespeciallywellsuitedforsmartdeviceapplicationsduetoitscombinationofacompactdisplayandgraphicaldateselectionformat.Whendisplayinginformation,theDateTimePickercontrolrenderssimilartoatextbox;however,whentheuserisselectingadate,apop-upcalendarsimilartotheMonthCalendarcontrolcanbedisplayed.1WebBrowserTheWebBrowsercontrolencapsulatesthedeviceWebbrowser,providingrichdisplaycapabilitiesandexposingavarietyofeventsthatallowyourapplicationtobothtracktheusersinteractionwiththeWebbrowsercontentinadditiontoallowingyourapplicationtoprovidecustomizedbehaviorsfortheseevents.NotificationTheNotificationcontrolencapsulatesthePocketPCsnotificationfeaturethatallowsapplicationstosendtheuseranotificationwithoutchangingthecontextoftheuserscurrentactivity.ThenotificationtextcanbeplaintextorHTML.Inadditiontodisplayinginformation,notificationscanreceiveinputfromtheuserbyincludingHTMLbuttonsandlinksintheHTMLtextofthenotification.DocumentListTheDocumentListcontrolprovidesastandardmechanismfordisplayingandmanagingfilessuchasthatwhichisusedwhenopeningfilesinExcelMobileandWordMobile.TheDocumentListcontrolprovidestheuserwiththeabilitytonavigatearoundthefilesystemandtodelete,copy,move,andrenamefiles.TheusercanalsousetheDocumentListcontroltosende-mailmessagesandsendfilesbymeansofinfraredtootherdevices.DataGridonSmartphoneSmartphonenowsupportstheDataGridcontrol.JustlikePocketPC,theDataGridcontrolonSmartphonesupportsconfigurablecolumnsizes,multipledisplaystyles,databinding,nullvaluehandling,andeventstotrackusercellselections.LinkLabelTheLinkLabelcontrolisalabelcontrolthatiscapableofdisplayingoneormorehyperlinks.SplitterTheSplittercontrolisasplitterbarthatprovidesresizingcapabilitytodockedcontrols.ToolBarTheToolBarcontrolisWindowstoolbarthatiscapableofdisplayingimagesasbuttons.UserControlsThe.NETCompactFramework2.0nowsupportsusercontrols.Withtheadditionofusercontrols,.NETCompactFramework2.0applicationscannowcreatecontrolsgraphicallywithinVisualStudio2005and,justasthefull.NETFramework,the2.NETCompactFramework2.0usercontrolsautomaticallyappearonthecontrolToolboxandcanbeplacedonformsbyusingdrag-and-drop.DisplayandLayoutManagementThewidevarietyofWindowsMobileformfactorsthatarenowavailablerequiresthatapplicationdevelopersdevelopapplicationuserinterfacestobemuchmoredynamicthaninthepast.Tosimplifythetaskofcreatingdynamicuserinterfaces,the.NETCompactFramework2.0providesmanynewlayoutandmanagementfeatures.ControlDockingThe.NETCompactFramework2.0controlsnowsupportdocking.Dockingacontrolplacesitagainsttheedgeoftheparentcontrolfillingthatedge.Astheparentcontrolisresized,thedockedcontrolautomaticallyresizestoalwaysfillthespecifiededgeoftheparentcontrol.Controlscanalsobedockedtofilltheentireparent.ControlAnchoringThe.NETCompactFramework2.0controlsalsosupportanchoring.Anchoringacontrolidentifiesthatoneormoresidesofthecontrolshouldremainafixeddistancefromthecorrespondingedgeoredgesoftheparentcontrol.Astheparentcontrolisresized,thecontrolautomaticallyresizessotheanchoredsidesofthecontrolremaintheappropriatedistancefromthecorrespondingedgesoftheparentcontrol.AutomaticScrollingTheFormandPanelcontrolinadditiontoothercontrolsthatinheritfromtheScrollableControlcontrolnowprovidetheAutoScrollproperty.Whensettotrue,thecontrolautomaticallyprovidesascrollbartoallowtheusertoscrolltoanychildcontrolsthatareoutsidethecontrolsvisibleboundary.AutomaticScalingAllContainerControlderivedcontrols,suchastheFormcontrol,nowprovidetheAutoScaleModeproperty.TheAutoScaleModepropertyindicateshowthecontrolshouldrenderwhenitisdisplayedonaresolutiondifferentthantheresolutionitwasoriginallydesignedfor.WhensettoAutoScrollMode.Dpi,allchildcontrolsofthecontainercontrolarescaledtomatchtheruntimedisplaysresolution.AvalueofAutoScaleMode.Noneindicatesthatnoautomaticscalingwillbedone,makingtheapplicationresponsibletorendercorrectlyonthedifferentresolutions.SuspendLayoutandResumeLayout3The.NETCompactFramework2.0ControlclassnowsupportstheSuspendLayoutandResumeLayoutmethods.Justasinthefull.NETFramework,thesemethodsareusedinconjunctionwithoneanothertogroupmultiplelayoutevents,suchasrepositioningorresizingaseriesofchildcontrols.GraphicsDpiXandDpiYpropertiesTheGraphicsclassnowprovidesinformationastotheresolutionofthecurrentdevicedisplay.TheDpiXpropertyindicatesthenumberofhorizontaldotsperinch,andDpiYindicatesthenumberofverticaldotsperinch.CustomDrawingTosimplifythecreationofrichuserinterfaces,the.NETCompactFramework2.0hasaddedanumberoffeaturesthatallowapplicationstomuchmoreeasilyhandlecustomdrawing.RotatableFontsTheadditionoftheLogFontclasstothe.NETCompactFramework2.0providessupportfordisplayingtextatanangleandforincorporatingothertexteffects.CustomPensApplicationscannowcreatepensofaspecificcolorandsize.BitmapsThe.NETCompactFramework2.0providesmanyenhancementsforworkingwithbitmaps.Enhancementsincludeprovidingmoreoptionswhencreatingbitmapsandhavingtheabilitytosaveabitmaptoafileorstream.ApplicationscanmoreeasilyviewandmanipulatebitmapsthroughthecombinationoftheLockBitsandUnlockBitsmethodswiththenewlyaddedBitmapDataclass.Forapplicationsneedingtosharebitmapsbetweenmanagedandnativecode,youcannowretrieveahandletothenativebitmapobjectthroughtheGetHbitmapmethod.DirectXWindowsMobile5.0softwareincludesanumberofrichtwo-dimensionalandthree-dimensionaldrawingfeaturesthroughitsnativeimplementationoftheDirectXapplicationprogramminginterfaces(APIs).For.NETCompactFramework2.0developerswhotargetWindowsMobile5.0baseddevices,theDirectXfeaturesetisavailablethroughtheclassescontainedintheMicrosoft.Windows.DirectXnamespaceandcorrespondingassembly.KeyboardManagement4Anincreasingnumberofsmartdevicesnowincludekeyboards.Toallowmanageddeveloperstotakeadvantageoftheavailablekeyboards,the.NETCompactFramework2.0providesenhancedsupportforkeyboards.NoteSomeofthefeaturesmentionedinthissectionwereaddedaspartofthe.NETCompactFramework1.0servicepacksbutarementionedheretobesurethateveryoneisawarethattheyareavailable.TabSupportControlsnowsupportataborderallowingapplicationuserstomovebetweencontrolsbypressingthetabkey.KeyboardEventsandForm.KeyPreviewControlsnowreceiveKeyUp,KeyDown,andKeyPressevents.Inaddition,theFormcontrolnowprovidestheKeyPreviewproperty.Whensettofalse,keyboardeventsaresentdirectlytothecontrol.WhenKeyPreviewissettotrue,allkeyboardeventsaresenttotheForminstancepriortobeingsenttothecontrolthatcurrentlyhasfocus.TheForminstancecanpreventaneventfrombeingsenttothecontrolwithfocusbysettingtheKeyPressEventArgs.HandledpropertytotrueintheForminstancescorrespondingeventhandler.DataDataisofcourseacentralpartofanyapplication.Whetherrelational,data-orientedclasseshaveadirecteffectonthelevelofprogrammingeffortthatisrequiredtoaccessandworkwithdata.The.NETCompactFramework2.0providesanumberofnewdataclassesinadditiontonewfeaturestoexistingclasses.Updatable,ScrollableAccesstoSQLServer2005MobileEditionThe.NETCompactFramework2.0providesanewclassforaccessingaSQLServer2005MobileEdition(SQLMobile)database,SqlCeResultSet.ThenewSqlCeResultSetclassprovidesscrollingandupdatableaccessdirectlytotheSQLMobiledatabase.Thisaccessprovidesamuchfasterandmoreresource-efficientsolutionforaccessingSQLMobiledatathantheDataSetclass.LiketheDataSetclass,SqlCeResultSetcanbeusedasadatabindingsource.DataSet5TheDataSetclassandrelatedclassesprovideanumberofnewfeatures.Thesefeaturesnotonlyprovideenhancedfunctionalitybutalsobringthe.NETCompactFrameworkDataSetclassmoreinlinewiththatofthefull.NETFramework.GetChangesandMergeMethodsThe.NETCompactFramework2.0addstheGetChangesandMergemethodstotheDataSetclass.TheGetChangesmethodreturnsacopyofDataSetthatcontainsallofthechangessinceAcceptChangeswaslastcalled.ThereturnedDataSetisoptimizedformerging.TheMergemethodmergesoneDataSetintoanother.ItisparticularlyusefulformergingchangesfromoneDataSet,returnedbytheGetChangesmethod,intoanother.CopyMethodThe.NETCompactFrameworkDataSetclassnowprovidestheCopymethod.TheCopymethodreturnsanewDataSetcontainingthesamestructureanddataastheoriginal.DataTablesSerializationTheDataTableclassnowprovidestheWriteXmlandReadXmlmethods,whichprovideXMLserializationanddeserializationofindividualtables.AlsotheadditionofserializationanddeserializationsupportallowsDataTablestobepassedasWebservicearguments.XMLThe.NETCompactFramework2.0providesanumberofenhancementstotheXMLrelatedclasses.TheseenhancementsbothsimplifytheprocessofworkingwithXMLdataandalsobringthe.NETCompactFrameworkXMLrelatedclassesmuchmoreinlinewiththoseavailableinthefull.NETFramework.XPathSupportTheXmlDocumentclassnowsupportstheSelectSingleNodeandSelectNodesmethodsbothofwhichprovidetheabilitytosearchthedocumentusingXPath.XMLSerializationThe.NETCompactFramework2.0addstheXmlSerializerclassalongwiththerelatedattributeclasses,suchasXmlElementandXmlAttribute.UsingXmlSerializerallowsyoutosaveandrestoreclassestoandfromXML.ThenewXmlSerializerclassisalsousedinternallybythe.NETCompactFramework2.0Webserviceproxybaseclasses.ThenewXmlSerializerclassprovidessubstantiallyimprovedperformanceoverthemechanismusedbythe.NETCompactFramework1.0to6serializeanddeserializeWebserviceargumentstherebyprovidingimprovedWebservicecallperformance.XMLSchemaThe.NETCompactFramework2.0nowprovidestheXmlSchemaclassandrelatedclassesforworkingwithXMLschemadocuments.Theseclassescanalsobeusedtodynamicallygenerateschemas.DataBindingThenewdatabindingclass,BindingSource,isincludedinthe.NETCompactFramework2.0.TheBindingSourceisnormallylayeredbetweenoneormoredataboundcontrolsandadatabindingsource.Whenused,theBindingSourceclasssimplifiesdatabindingbyprovidingalayerofindirectionandaddingcurrencymanagement,changeevents,andmore.CommunicationsCommunicationsisanimportantpartofvirtuallyeverysmartdeviceapplication.The.NETCompactFramework2.0hasaddedseveralnewclassestosimplifycommoncommunicationsrequirementsaswellasprovidingentirelynewcapabilities.Inadditiontothenewcommunicationsclasses,the.NETCompactFramework2.0alsoincludesimprovementstoexistingclasses.WebServicesAsnotedearlier,thenewXmlSerializerclasssubstantiallyimprovestheperformanceofWebservicecallsbyprovidingamuchfasterXMLserializationanddeserializationofWebservicearguments.Inadditiontotheperformanceimprovements,the.NETCompactFramework2.0WebserviceclassesnowprovidesupportforSOAPversion1.2.MSMQForapplicationdeveloperswhowanttotakeadvantageoftheasynchronousmessagingfeaturesofMSMQ,the.NETCompactFramework2.0providestheclassesintheSystem.Messagingnamespace.Theseclassesprovidesupportforsendingandreceivingmessagesincludingusingtransactionstocreateatomicoperations.SerialPortsToreducetheprogrammingeffortthatisrequiredwhenworkingwithserialports,the.NETCompactFramework2.0includestheSerialPortclass.TheSerialPortclassprovidesa7simplifiedabstractionoverserialcommunicationsportsthatprovidesanumberoffeaturesthatsimplifymonitoringandconfiguringserialports.Theserialportalsosimplifiessendingandreceivingdatawithserialportsincludingtheautomaticencodinganddecodingofdatasenttoandreceivedfromtheport.IPv6SupportThe.NETCompactFramework2.0networkingclassesnowprovidesupportforIPv6inadditiontoIPv4.ConclusionHopefullythissummaryhasgivenyouagoodideaaboutthemanynewfeaturesavailabletosmartdevicedevelopersbyusingthe.NETCompactFramework2.0.Forthosetopicsforwhichyoudlikemoredetails,checkoutthedocumentationandMSDN.DetailedarticlesabouteachofthetopicsaddressedinthisarticleareorwillsoonbeavailableonMSDN.8中文翻译.NETCompactFramework2.0中的新事物.NETCompactFramework2.0版在以前版本.NETCompactFramework1.0版上提供许多改善。虽然普遍改善,但他们都集中在共同的目标改进开发商生产力、以完整的.NETFramwork提供更强的兼容性,以及加大对设备特性的支持。这篇文章提供一个.NETCompactFramework2.0的变动和改进的高水平的概要。用户界面相关的灵活的设备显示器的小尺寸要求:应用程序高效率地使用可用空间。这在过去是要求开发商花费很多时间来设计和实施应用的用户界面。最近的在灵活的显示能力方面的进步,譬如高分辨率和多方位支持,使得用户界面发展的工作更具挑战性。为了简化创造应用用户界面的任务,.NETCompactFramework2.0提供许多关于这方面描述的新特性。窗口形式控制存在于用户界面中心的是控制;.NETCompactFramework2.0提供了很多新的控制。这些新控制由除了特别针对设备之外的控制组成。这种控制是.NETCompactFramework有的与.NETFramework一样充分的控制。MonthCalendarMonthCalendar控制是提供日期显示的可定制的日历控制,而且是有利于为用户提供一个图解方式来精选日期。DateTimePickerDateTimePicker控制是为显示和允许用户进入日期和时间信息的可定制的控制。由于它的一个紧凑显示和图解日期选择格式的组合,它特别适用于灵活的设备应用程序。当显示信息时,DateTimePicker控制与正文框相似;但是,当用户选择了一个日期,可能显示一个类似于MonthCalendar控制的弹出日历。WebBrowserWebBrowser控制压缩了设备Web浏览器,并且提供强大的显示能力和暴露很多事件。这些事件除了允许你的应用程序提供对于这些事件的用户化的行为,还允许你的应用程序追踪用户与Web浏览器内容的互动。NotificationNotification控制压缩了袖珍版个人电脑的通知特性,就是允许应用程序寄给用户一个没有改变用户当前活动的上下文的通知。通知文本可以是纯文本或HTML。除显示信息之外,通知可以通过包含在通知的HTML文本中的HTML按钮和链接来接受用户的输入。DocumentListDocumentList控制为显示和处理文件提供一个标准的机制,譬如当打开ExcelMobileandWordMobile中的使用的文件。DocumentList控制提供给用户操纵文件系统以及删除、复制、行动和重命名的能力。用户也可以用DocumentList控制通过红外线发送电子邮件和发送文件到其它设备。Smartphone中的DataGrid9Smartphone现在支持DataGrid控制。就像袖珍个人电脑,Smartphone中的DataGrid控制支持构形的大小、多种显示形式、数据捆绑、空值处理和跟踪用户单元选择的事件。LinkLabelLinkLabel控制是一个能显示一个或更多超链接的标签控制。SplitterSplitter控制是一个提供恢复相接控制的能力的分离栏。ToolBarToolBar控制是能将图像以按钮形式显示的Windows工具栏。用户控制.NETCompactFramework2.0现在支持用户控制。增加用户控制的同时,.NETCompactFramework2.0应用程序现在可以用VisualStudio2005图像化地创建控制,并且,就如完整的.NETFramework一样,.NETCompactFramework2.0的用户控制自动在控制工具箱出现,而且可以用拖放安置在窗体上。显示和布局管理现在可用的WindowsMobile窗体因素的广泛多样性,要求应用程序开发者开发应用程序用户界面比以前更动态化。为了简化创造动态用户界面的任务,.NETCompactFramework2.0提供许多新布局和管理特性。控制相接.NETCompactFramework2.0控制现在支持相接。相接一个控制设置它与双亲控制的边缘相反,即填充边缘。因为双亲控制调整尺寸,相接控制自动调整尺寸来填充双亲控制指定的边缘。控制也可以相接填装整个双亲。控制停滞.NETCompactFramework2.0控制也支持停滞。停滞控制识别,即控制的一边或多边应该依然是与对应的边缘或双亲控制的边缘保持的一个固定距离。因为双亲控制调整尺寸,控制自动地调整尺寸,因此控制的停滞的一边依然是与双亲控制的对应的边缘保持的适当的距离。自动卷曲FormandPanel控制除了继承于ScrollableControl控制的其他控制现在提供AutoScroll属性。当设置为真,控制自动地提供一个卷曲栏来允许用户卷曲到任一个在控制可视范围之外的孩子控制。自动缩放比例所有ContainerControl起源的控制,譬如Form控制,现在提供AutoScaleMode属性。AutoScaleMode属性指出当控制在一个不同于最初它设计的决议上显示时,控制应该如何反映。当设置为AutoScrollMode.Dpi时,容器控制的所有孩子控制相应地与执行时间的显示决议相匹配。AutoScaleMode.None的值表明缩放比例不会自动完成,这样就使应用程序有责任在不同的决议上准确地提出。SuspendLayout和ResumeLayout.NETCompactFramework2.0Control类现在支持SuspendLayout和ResumeLayout方法。就像在完整的.NETFramework中一样,这些方法在与一个异于聚集布局事件关联,譬如改变一系列的孩子控制的位置或调整它们的尺寸。GraphicsDpiX和DpiY属性10现在,Graphics类提供关于当前设备显示的决议的信息。DpiX属性显示水平的每英寸像素的数量,而且DpiY属性显示垂直的每英寸像素的数量。自定义图画为了简化丰富的用户界面的创作,.NETCompactFramework2.0增加了很多特性。这些特性允许应用程序更加容易运用自定义图画。可旋转的字体LogFont类添加到.NETCompactFramework2.0为在为在一个角度显示文本提供支持,以及为合并其他文本作用提供支持。自定义笔现在,应用程序可以创造具体颜色和大小的笔。位图.NETCompactFramework2.0为用位图工作提供改进。这种改进包括:当创建位图和有能力将一个位图保存到一个文件或流时,提供更多的选择。应用程序可以运用新加入的BitmapData类,通过LockBits和UnlockBits方法的联合更加容易观察和操作位图。因为应用程序需要在被处理的和自身的代码之间分享位图,现在,你可以通过GetHbitmap方法检索一个自身位图对象的句柄。DirectXWindowsMobile5.0软件通过执行DirectX应用程序设计界面(APIs)包含二维和三维的图画特性。因为.NETCompactFramework2.0的开发商瞄准WindowsMobile5.0基础设备的人,DirectX特性集有能力贯穿包含在“Microsoft.Windows.DirectX”命名域中的类和对应的汇编。键盘管理现在,灵活的设备的一个增长数字包括键盘。为了允许管理开发商利用可利用的键盘,.NETCompactFramework2.0为键盘提供改进的支持。注:在这部分提及的一些特性被作为一部分加到.NETCompactFramework1.0服务包,但在这里提它们,大家就肯定知道它们也是可用的。制表符支持现在,控制支持制表符命令以允许应用程序用户通过按制表符键在控制之间切换。KeyboardEvents和Form.KeyPreview现在,控制接受KeyUp、KeyDown和KeyPress事件。此外,现在,Form控制提供KeyPreview属性。当设置为假,keyboard事件就会被直接发到控制。当KeyPreview被设置为真,所有keyboard事件就会被发到Form实例以等待被发送到当前聚焦的控制。通过在Form实例的对应的事件处理设置KeyPressEventArgs属性为真,Form实例可以防止事件以焦点被送到控制。数据当然,数据是任一个应用程序的重要部份。不管有无关系,针对数据的类在必需访问和运作以数据编程的努力上的水平有直接效应。.NETCompactFramework2.0除了为现存的类提供新特性,还提供很多新数据类。Updatable,ScrollableAccesstoSQLServer2005MobileEdition.NETCompactFramework2.0为进入SQLServer2005MobileEdition(SQLMobile)数据库SqlCeResultSet提供新类。新的SqlCeResultSet类提供卷曲和可更新的直接存取SQLMobile数据库。这个存取为存取SQLMobile数据提供11一种比DatasSet类更加快速和更加资源高效率的解决方案。和DataSet类一样,SqlCeResultSet可以作为数据绑定资源使用。DataSetDataSet类和相关的类提供很多新特性。这些特性不仅提供改进的功能而且带来.NETCompac

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论