圖解 CSS (1): 先做一個樣式表測試載入器

來源:互聯網
上載者:User
一直沒有把樣式表系統一下, 春節假期有空, 不能再等了.

為了方便學習, 先寫了一個樣式表測試載入器: CssTest(點擊下載)

工具非常簡單, 寫了 10 行左右的代碼; 運行:


代碼檔案:
unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, ExtCtrls, StdCtrls, ComCtrls, OleCtrls, SHDocVw;type  TForm1 = class(TForm)    Memo1: TMemo;    Splitter1: TSplitter;    Panel1: TPanel;    WebBrowser1: TWebBrowser;    procedure FormCreate(Sender: TObject);    procedure FormClose(Sender: TObject; var Action: TCloseAction);    procedure Memo1Change(Sender: TObject);  end;var  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);var  path: string;begin  Text := 'CssTest';  WebBrowser1.Navigate('about:blank');  Memo1.ScrollBars := ssBoth;  with Memo1.Font do begin    Name := 'Verdana';    Size := 10;    Color := $000080;  end;  path := ChangeFileExt(ParamStr(0),'.dat');  if FileExists(path) then ReadComponentResFile(path, Memo1);end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);begin  WriteComponentResFile(ChangeFileExt(ParamStr(0),'.dat'), Memo1);end;procedure TForm1.Memo1Change(Sender: TObject);begin  WebBrowser1.Navigate('about:' + Memo1.Text);end;end.

表單檔案:

object Form1: TForm1  Left = 0  Top = 0  ActiveControl = Memo1  Caption = 'Form1'  ClientHeight = 231  ClientWidth = 439  Color = clBtnFace  Font.Charset = DEFAULT_CHARSET  Font.Color = clWindowText  Font.Height = -11  Font.Name = 'Tahoma'  Font.Style = []  OldCreateOrder = False  OnClose = FormClose  OnCreate = FormCreate  PixelsPerInch = 96  TextHeight = 13  object Splitter1: TSplitter    Left = 241    Top = 0    Height = 231    MinSize = 1    ExplicitLeft = 219    ExplicitHeight = 196  end  object Memo1: TMemo    Left = 0    Top = 0    Width = 241    Height = 231    Align = alLeft    Lines.Strings = (      'Memo1')    TabOrder = 0    OnChange = Memo1Change  end  object Panel1: TPanel    Left = 244    Top = 0    Width = 195    Height = 231    Align = alClient    BevelOuter = bvNone    Caption = 'Panel1'    TabOrder = 1    object WebBrowser1: TWebBrowser      Left = 0      Top = 0      Width = 195      Height = 231      Align = alClient      TabOrder = 0      ExplicitLeft = 88      ExplicitTop = 88      ExplicitWidth = 300      ExplicitHeight = 150      ControlData = {        4C00000027140000E01700000000000000000000000000000000000000000000        000000004C000000000000000000000001000000E0D057007335CF11AE690800        2B2E126208000000000000004C0000000114020000000000C000000000000046        8000000000000000000000000000000000000000000000000000000000000000        00000000000000000100000000000000000000000000000000000000}    end  endend
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.