图解 CSS (1): 先做一个样式表测试工具
图解 CSS (1): 先做一个样式表测试工具
涂孟超 发表于3年前
图解 CSS (1): 先做一个样式表测试工具
  • 发表于 3年前
  • 阅读 3
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 新注册用户 域名抢购1元起>>>   


一直没有把样式表系统一下, 春节假期有空, 不能再等了.

为了方便学习, 先写了一个样式表测试工具: CssTest(点击下载)

工具非常简单, 写了 10 行左右的代码; 运行效果图:



代码文件:
unit Unit1;

interface

uses
  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
  end
end

 
 
 
 
 

 

 

  
共有 人打赏支持
粉丝 13
博文 2004
码字总数 14107
×
涂孟超
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: