IW will convert most of the visual attributes to CSS; Our active use of CSS takes two steps:
The first step:
{The CSS file to be linked is specified via the form's StyleSheet property} procedure tiwform1.iwappformcreate (sender:tobject); begin Stylesheet.filename: = ' mycss1.css '; CSS file must be placed under wwwroot//Stylesheet.url: = '// Outer chain end; {If the site-level CSS ... Tiwservercontroller.oncreate}procedure tiwservercontroller.iwservercontrollerbasecreate ( Sender:tobject); begin Stylesheet.filename: = ' mycss1.css '; CSS file must be placed under wwwroot//Stylesheet.url: = '// Outer chain end;
Step Two:
{Specify CSS properties for the control you want to use for the style}procedureTiwform1.iwappformcreate (Sender:tobject);beginStylesheet.filename: = ' mycss1.css '; Iwmemo1.css: = ' Class1 '; If there is a Class1 class in mycss1.css, such as:. Class {font-size:32px;}IWMemo1.StyleRenderOptions.RenderFont: = False; Under normal circumstances, you also need to adjust the Stylerenderoptions propertyEnd; {------------------------------------------------------------------about Stylerenderoptions property: If we use CSS for the control, It is possible to conflict with the properties of the control itself, which one? This requires the Stylerenderoptions property of the control to decide! It is also a class (Iwtypes.tiwstylerenderoptions < Tpersistent < TObject), which has only a few Boolean properties: Property Rendersize:boolean//property Renderposition:boolean//property renderfont:boolean//property Re Nderzindex:boolean//property rendervisibility:boolean//property renderstatus:boolean//Enabledproperty Render Padding:boolean//property renderborder:boolean//property renderabsolute:boolean//property usedisplay:boole AN//when the corresponding value is False, the corresponding CSS can be used.-------------------------------------------------------------------}
Many of the actions of CSS are similar to JavaScript, such as:
procedure tiwform1.iwappformcreate (sender:tobject); Begin iwservercontroller.htmlheaders (' <link type= "text/css" rel= "stylesheet" href= "Mycss1.css"/> " ); Self.PreHeader.Add (' <link type= ' text/css "rel=" stylesheet "href=" mycss2.css "/> ' ); SELF.EXTRAHEADER.ADD (' <link type= ' text/css "rel=" stylesheet "href=" mycss3.css "/> ' ); IWSERVERCONTROLLER.CONTENTFILES.ADD (' mycss4.css ' ); Self.ContentFiles.Add (' mycss5.css ' ); end ;