Thông tin tài liệu:
ADO.NET is basically made up of two components such as DataSet and .NETdata providers.DataSets are objects that store data in a disconnected cache.The .NET data providers is a collection of components such as:Connection,Command,DataReader,DataAdapter.The Connection object is used to establish a connection between theapplication and the database.
Nội dung trích xuất từ tài liệu:
Session 6: GDI+ Programming Session6 GDI+Programming Review ADO.NETisbasicallymadeupoftwocomponentssuchasDataSetand.NET dataproviders. DataSetsareobjectsthatstoredatainadisconnectedcache. The.NETdataprovidersisacollectionofcomponentssuchas: Connection Command DataReader DataAdapter TheConnectionobjectisusedtoestablishaconnectionbetweenthe applicationandthedatabase. TheCommandobjectallowsretrievalandmanipulationofdatainthe database. DataReaderisusedtogetthereadonlyandforwardonlydatafromthedata source. DataAdapterisusedtofetchthevaluesfromthedatasourcetotheDataSet andalsotoupdatethedatasourcewiththevaluesintheDataSet. Windows Forms / Session 6 / 2 of 26 ReviewContd… ThedataintheDataSetisstoredintheformofDataTableobjects. TheDataColumnobjectdefinesthecolumnsofaDataTable.The DataColumnobjectisreferencedbytheColumnspropertyoftheDataTable. TheDataRowobjectrepresentstherowsofdatainaDataTable. DataViewactsasapresentationlayerforthedatathatisstoredin DataTable.ItprovidesacustomizedviewofDataTableforsorting,filtering andsearchingdata. IfthetablesthatareincludedintheDataSethavealogicalrelationship betweenthem,therelatedrecordscanbemadeavailableinanothertable usingtheDataRelationobject. ADO.NETsupportstwotypeofDataBinding: SimpleDataBindingonlyasinglevaluefromadatasetcanbeboundtoany controlatagiventime ComplexDataBindingacontrolcanbeboundtoacompletedataset TheDataGridcontroldisplaysdatainatabularformatandoptionally supportsdataediting;i.e.inserting,updating,deleting,sortingandpaging. Windows Forms / Session 6 / 3 of 26 Objectives CreateGraphicalImageswithGDI+ ExploreObjectsinGDI+:Pen,Brushand Color Drawlines,shapesandtextwithGDI+ DisplayimagesusingGDI+ PrintImagesusingGDI+ Windows Forms / Session 6 / 4 of 26 IntroductiontoGDI+GDI+providesthebasicfunctionalitytoimplementgraphicsin WinForms. GDI+ resides in System.Drawing.dllassembly.Using classes such as System.Drawing.Text, andSystem.Drawing.Drawing2DSystem.Drawing.Printing, shapes can be drawn andfilled, colorful attractive text can be rendered and imagescanbedrawnwithoutusinganypicturecontrols. Windows Forms / Session 6 / 5 of 26 Graphicsclass PresentintheSystem.Drawing namespace. Cannotbeinherited.AGraphicsobjectcanbecreatedinseveralways: ByoverridingtheOnPaint()methodandgettingthereferenceto thegraphics UsingthePainteventofaformtogetthereferencetothegraphics UsingtheCreateGraphics() Method FromanyobjectthatderivesfromImageclass Windows Forms / Session 6 / 6 of 26 CreatingaGraphicsreferenceprotected override void OnPaint(PaintEventArgs paintevent){ Graphics graf=paintevent.Graphics;}private void mainForm_Paint(objectsender, PaintEventArgs paintevent){ Graphics graf=paintevent.Graphics;} Windows Forms / Session 6 / 7 of 26 CreatingaGraphicsreference Contd…private void PaintMe(Control testcontrol){ Graphics graf=testcontrol.CreateGraphics(); ...}protected override void OnPaint(PaintEventArgspaintevent){ Bitmap bmpimage=new Bitmap(WaterLilies.jpg); Graphics graf = Graphics.FromImage(bmpimage); ...} Windows Forms / Session 6 / 8 of 26 MethodsofGraphicsclassMethodName DescriptionClear Clearsthedrawingsurfaceandfillsit withspecifiedbackgroundcolorDrawArc DrawsanarcDrawBezier DrawsaBeziercurveDrawEllipse DrawsanellipseDrawImage DrawsanimageDrawLine DrawsalineDrawString DrawsatextstringDrawRectangle DrawsarectangleFillEllipse FillsanellipsewithcolorFillRectangle Fillsarectanglewithcolor Windows Forms / Session 6 / 9 of 26 ThePenclass Usedtospecifythewidth,styles, fillstylesforshapes. Cannotbeinheritedbutwecan createobjectsbyinstantiatingit. BelongstotheSystem.Drawing namespace.Pen ourpen=new Pen(Color.Blue,5); Theabovecodewillcreateapenobjectofbluecolorwithwidth5 Windows Forms / Session 6 / 10 of 26 TheBrushclass Usedtofillsolidcolorintoshapes. ...