⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 winskindata.pas

📁 这是VCLSKIN v4.22 的所有的源代码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    Exit;
   end;

   if not fileexists(value) then exit;
   data.clear;
   data.loadfromfile(value);
   LoadSkin;
//   skinmanager.setaction(skin_change);
//   if ftype=sfMainform then
   UpdateSkin;
//   else showmessage('Skin file format error !');
end;

procedure TSkinData.LoadFromStream(Stream: TStream);
begin
   empty:=true;
   data.clear;
   data.LoadFromStream(stream);
   LoadSkin;
   if ftype=sfMainform then
   UpdateSkin;
//   skinmanager.setaction(skin_change);
end;

procedure TSkinData.LoadFromCollection(astore:TSkinStore;aindex:integer);
var aitem:TSkinCollectionItem;
begin
   if astore.Store.count<=aindex then exit;
   empty:=true;
   data.clear;
   aitem:=TSkinCollectionItem(astore.Store.items[aindex]);
   aitem.fdata.Position := 0;
   data.LoadFromStream(aitem.fdata);
   LoadSkin;
//   if ftype=sfMainform then
   UpdateSkin;
end;

function TSkinData.LoadSkin:boolean;
var fpath,fini:string;
    PathBuffer : array [0..255] of char;
    b:boolean;
begin
   empty:=true;
   if csDesigning in ComponentState then exit;
   GetTempPath (256, PathBuffer);
   fpath := StrPas(PathBuffer);
   reader:=TSkinReader.create;
   ms := TMemorystream.create;
   b:=reader.loadfromstream(data);
   if b then begin
     ini := TQuickIni.Create;
     reader.readini('.ini',ms,fini);
     fini:=fpath+fini;
     try
        ms.Seek(0,soFromBeginning);
        ini.LoadFromStream(ms);
//        ms.savetofile(fini);
        loadfromini(fini);
//        deletefile(fini);
     finally
        reader.free;
        ms.free;
        ini.free;
     end;
   end;
   result:=b;
end;

procedure TSkinData.LoadFromIni(filename:string);
begin

//  ini := TIniFile.Create(FileName);
  sectionlist:=Tstringlist.create;

  ini.ReadSections(sectionlist);
  //
  SkinName := ini.ReadString('TitlebarSkin', 'SkinName', '');
  //
  Readbord;
  readcolor;
  ReadSysbutton;
  Readbutton;
  readtitle(Title,'Personality');
  readProgress(Progress,'Progress');
  readobject(ProgressChunk,'Progress.Chunk');
  readMenuBar(MenuBar,'Personality');
  readobject(Box,'GroupBoxEdge');
  ReadBoxLabel(boxlabel,'GroupBox');
  readobject2(Tab,'Tabs','Border');
  readobject(StatusBar,'StatusBarEdges');
  readobject(TabSheet,'Tab.Pane');
  if (tabsheet<>nil) then begin
     if (tabsheet.r.top>4) then tabsheet.r.top:=4  ;
     if (tabsheet.r.left>4) then tabsheet.r.left:=4  ;
     if (tabsheet.r.right>4) then tabsheet.r.right:=4  ;
     if (tabsheet.r.bottom>4) then tabsheet.r.bottom:=4  ;
  end;
  //Readobject(toolbar,'ToolBarBackground');
  Readobject(toolbarbtn,'ToolBars');
//  ReadToolbar(Toolbar,'Toolbars');
//  readobject(ComBox,'ComboButton');
  readobject2(ComBox,'ComboButton','****');
  readobject(ComBoxborder,'SunkEdge');
  if (combox<>nil) and ( not combox.Map.empty) then begin
     combox.MaskMap.assign(combox.Map);
     combox.MaskMap.PixelFormat:= pf24bit;
     SpiegelnHorizontal(combox.MaskMap);
  end;
  readobject(ExtraImages,'ExtraImages');
  readobject(header,'Headerbar');

  readObject(MenuItem,'MenuItem');
  readObject(MenuItemBG,'MenuBackground');
  readobject(SArrow,'Scrollbar');
  readobject(HBar,'HorzScroll');
  readobject(VBar,'VertScroll');
  readobject(HSlider,'HorzScrollThumb');
  readobject(VSlider,'VertScrollThumb');

  readobject(TrackHorz,'Trackbar.ThumbHorz');
  readobject(TrackVert,'Trackbar.ThumbVert');
  readobject(TrackLeft,'Trackbar.ThumbLeft');
  readobject(TrackRight,'Trackbar.ThumbRight');
  readobject(TrackTop,'Trackbar.ThumbUp');
  readobject(TrackBottom,'Trackbar.ThumbDown');

  readobject2(HSpin,'UpDown.Horz','GlyphImage');
  readobject2(VSpin,'UpDown.Vert','GlyphImage');

  readobject(TrackBar,'Track');
  readobject(Trackbarvert,'TRACKVERT');

  if trackbar=nil then
     ReadTrack(Trackbar,'TRACK');
  if trackbarvert=nil then
     ReadTrack(Trackbarvert,'TRACKVERT');
  
  SetFrame;
  ReBuildCombobox;
  ReBuildComboxArrow;
  RebuildToolbar;
  colors[csCaption]:=GetCaptionColor;
  if BGBrush<>0 then begin
     deleteobject(BgBrush);
     BGBrush:=0;
  end;
  BGBrush:=CreateSolidBrush(colors[csButtonFace]);

  sectionlist.free;
  Empty := False;
end;

procedure TSkinData.SetFrame;
var i:integer;
    w:integer;
begin
//  ReadSysbutton;
//  Readbutton;
  button.frame:=5;
  if button.radioframe=0 then begin
    if button.radiomap.height>=16 then w:=16
    else w:=13;
    button.radioframe:= button.radiomap.width div w;
    if button.radioframe<4 then button.radioframe:=4;
  end;

  if button.checkframe=0 then begin
    if button.checkmap.height>=16 then w:=16
    else w:=13;
    button.checkframe:= button.checkmap.width div w;
    if button.checkframe<4 then button.checkframe:=4;
  end;
//  for i:= 0 to length(sysbtn)-1 do
//      sysbtn[i].frame:=5;
  if title<>nil then Title.frame:=2;
  if Progress<>nil then begin
     if progress.style=0 then
     Progress.frame:=2
     else
     Progress.frame:=1;
  end;
  if MenuBar<>nil then MenuBar.frame:=2;
  if Box<>nil then Box.frame:=2;
  if Toolbar<>nil then Toolbar.frame:=1;
  if Toolbarbtn<>nil then toolbarbtn.frame:=5;
  if Tab<>nil then Tab.frame:=5;
  if TabSheet<>nil then TabSheet.frame:=1;
//  if MinCaption<>nil then MinCaption.frame:=1;
  if StatusBar<>nil then StatusBar.frame:=3;
  if BoxLabel<>nil then BoxLabel.frame:=1;
  if ComBox<>nil then ComBox.frame:=4;
  if ComBoxborder<>nil then ComBoxborder.frame:=4;
  if ExtraImages<>nil then ExtraImages.frame:=5;
  if (header<>nil) and (header.frame=0) then header.frame:=5;

  if MenuItem<>nil then MenuItem.frame:=5;
  if MenuItemBG<>nil then MenuItemBG.frame:=1;
  if SArrow<>nil then SArrow.frame:=23;
  if HBar<>nil then Hbar.frame:=4;
  if VBar<>nil then Vbar.frame:=4;
  if VSpin<>nil then VSpin.frame := 8;
  if HSpin<>nil then HSpin.frame := 8;
  if TrackHorz<>nil then TrackHorz.frame := 5;
  if TrackVert<>nil then TrackVert.frame := 5;
  if TrackLeft<>nil then TrackLeft.frame := 5;
  if TrackRight<>nil then TrackRight.frame := 5;
  if TrackTop<>nil then TrackTop.frame := 5;
  if TrackBottom<>nil then TrackBottom.frame := 5;
  if hslider<>nil then
    HSlider.frame:=ini.readinteger('HorzScrollThumb','FrameCount',3);
  if vslider<>nil then
  VSlider.frame:=ini.readinteger('VertScrollThumb','FrameCount',3);
end;

function TSkinData.GetPrecolor(var acolor:Tcolor;n:integer):boolean;
begin
   result:=false;
   if (n>-1) and (n<length(colorpreset)) then begin
    acolor:=colorpreset[n];
    result:=true;
   end;
end;

function TSkinData.getfilename(s:string):string;
var i:integer;
begin
   i:=pos('.',s);
   if i>0 then result:=copy(s,1,i-1)
   else result:='';
end;

procedure TSkinData.DefineProperties(Filer: TFiler);
begin
  inherited;
  Filer.DefineBinaryProperty('SkinStream', ReadData, WriteData, True);
end;

procedure TSkinData.ReadData(Stream : TStream);
var ASize : longint;
begin
  Stream.Read (ASize, sizeof (ASize));
  if ASize > 0  then  begin
      data.SetSize (ASize);
      Stream.Read (data.Memory^, ASize);
      if not (csDesigning in ComponentState) then begin
          LoadSkin ;
      end;
  end;
end;

procedure TSkinData.WriteData(Stream : TStream);
var ASize : longint;
begin
  ASize := data.Size;
  Stream.Write(ASize, sizeof (ASize));
  if ASize > 0 then
    Stream.Write (data.Memory^, ASize);
end;

function TSkinData.GetSkinStore: string;
begin
  Result := '(none)';

  if csDesigning in ComponentState then
  begin
    if (data.size>0) then
      Result := '(Good)';
  end;
end;

procedure TSkinData.SetSkinStore(const Value: string);
begin
end;

procedure TSkinData.SetVersion( Value: string);
begin
end;

procedure TSkinData.Loaded;
begin
   inherited;
   if (csDesigning in ComponentState) then exit;

   if (@pGetScrollBarInfo=nil) then
        skincontrols:=skincontrols-[xcScrollbar];

   if skinmanager=nil then
        SkinManager:=TSkinManage.create(0);
//   skinmanager.addskindata(self);

   skinmanager.addskindata(self);
   CreateCaptionFont;
   CreateLogo;

   if ftype = sfMainform then begin
      skinmanager.installhook;
      if factive then begin
         if not empty then begin
            skinmanager.setaction(skin_Active);
         end else
            factive:=false;
      end;
      if not (xcMainmenu in SkinControls) then
        skincontrols:=skincontrols-[xcSystemMenu]
      else
        skincontrols:=skincontrols-[xcMenuitem];
      GetAppIcon();
   end
   else begin
      skinmanager.active:=true;
      inc(skinmanager.state);
      if (owner is Tform ) and factive then
         skinmanager.addform(tform(owner).handle);
   end;
end;

procedure TSkinData.SetActive( Value: boolean);
begin
  if factive<>value then begin
     factive:=value;
     if (csDesigning in ComponentState) then exit;
     if (csReading  in ComponentState) then exit;
//     if (skinformtype=sfMainform) or (skinformtype=sfDllForm) then begin
     if (skinformtype=sfMainform) then begin
       if value then begin
          if not empty then begin
             skinmanager.updatedata:=self;
             skinmanager.setaction(skin_Active);
             skinmanager.state:=skin_Active;
//             skinmanager.updatedata:=self;
          end;
       end else begin
        skinmanager.updatedata:=self;
        skinmanager.setaction(skin_uninstall);
//        skinmanager.updatedata:=self;
       end;
     end else if (skinformtype=sfOnlyThisForm) then begin
       skinmanager.updatedata:=self;
       if value then begin
          if not empty then
             skinmanager.setaction(skin_Active);
       end else begin
             skinmanager.setaction(skin_uninstall);
       end;
     end;
  end;
end;

procedure TSkinData.UpdateSkin;
begin
    if (csDesigning in ComponentState) then exit;
    if (csReading  in ComponentState) then exit;
    if skinmanager=nil then loaded;
//    if skinformtype<>sfMainform then  exit;
//    if SkinFormtype = sfOnlyThisForm then begin
//        exit;
//    end;
    skinmanager.updatedata:=self;
    skinmanager.DeleteSysbtn;
    if skinmanager.state=skin_Active then
      skinmanager.setaction(skin_change);
end;

procedure  TSkinData.ChangeProperty(control: TObject;aprop,value:string);
var PropInfo:PPropInfo;
begin
   if  control<>nil then begin
      PropInfo:=GetPropInfo(control,aprop);
      if PropInfo<>nil then  begin
         if propinfo^.PropType^.Kind= tkEnumeration then
          SetEnumProp(control,PropInfo,value);
      end;
   end;
end;

procedure  TSkinData.GetAppIcon;
var deficon,  SmallIcon: HIcon;
  cx, cy,i: Integer;
  Temp :Tbitmap;
begin
      Temp:=Tbitmap.create;
      cx := GetSystemMetrics(SM_CXSMICON);
      cy := GetSystemMetrics(SM_CYSMICON);
      temp.canvas.brush.color:=clFuchsia;
      temp.width:=cx;temp.height:=cy;
      DefIcon := SendMessage(application.Handle, WM_GETICON, ICON_SMALL, 0);
      if DefIcon = 0 then
   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -