2007/01/17

shellstyle.dll修改

shellstyle.dll修改 *部分内容参考自whistl3r的Shellstyle Tutorial

预备知识
1.shellstyle.dll的结构
UIFiles:
UIFile1:定义窗体及任务列表样式
UIFile2:定义控制面板样式

Resources:资源文件列表
10,11,12:音乐文件夹
13,14,15:图片文件夹
16,17,18:查找
19,20,21:视频文件夹
22,26:控制面板
25:系统文件夹
100,101,102,103,104,105,106,107:面板打开/关闭按钮
110,112:面板顶栏
120:背景

Strings:定义常用字符串或数值(字体,字号)

CPWEBVW.CSS:定义用户帐户窗体样式

2.资源的使用
rcstr(Str_ID)
Str_ID:Strings中编号

rcbmp(BMP_ID, STRETCHING, TRANSPARENT_COLOR, WIDTH, HEIGHT, SIZE_FLAG, MIRROR)
BMP_ID:Resources中编号
STRETCHING: 填充方式 1 = 正常, 3, = 重复, 6 = 拉伸, 7 = 32bit位图
TRANSPARENT_COLOR: 填充时忽略的颜色 #RRGGBB
WIDTH, HEIGHT:宽度,高度
SIZE_FLAG: 图像大小 1 = 使用图片默认大小, 0 = 使用指定的大小
MIRROR: 反转 0 = 正常, 1 = 反转

rcint(Str_ID) //将字符串转为数值
Str_ID:Strings中编号

Dtb(handlemap(a),b,c) //猜测是一种获取当前主题中图像的方法,但a,b,c各值所代表的图像不是很明确

sysmetric(ID) //系统变量表
ID可取值:
0 Screen width
1 Screen height
2 Width of sizable window frame
3 Height of sizable window frame
4 Width of scroll arrows on vertical scroll bar
5 Height of scroll arrows on vertical scroll bar
6 Width of scroll arrows on horizontal scroll bar
7 Height of scroll arrows on horizontal scroll bar
8 Height of window title
9 Width of non-sizable window frame
10 Height of non-sizable window frame
11 Width of DOUBLE or PANEL window frame
12 Height of DOUBLE or PANEL window frame
13 Scroll box width on horizontal scroll bar in text editing windows
14 Scroll box height on vertical scroll bar in text editing windows
15 Minimized window icon width
16 Minimized window icon height
17 Maximum insertion point width
18 Maximum insertion point height
19 Single-line menu bar height
20 Maximized window width
21 Maximized window height
22 Kanji window height
23 Minimum sizable window width
24 Minimum sizable window height
25 Minimum window width
26 Minimum window height
27 Window controls width
28 Window controls height
29 1 if mouse hardware present; otherwise 0
30 1 for Microsoft Windows debugging version; otherwise 0
31 1 if mouse buttons swapped; otherwise 0
32 Width of a button in a half-caption window's caption or title bar
33 Height of half-caption window caption area


核心部分
UIFile的编写
UIFile中的内容是许多结构为

的代码段,用于定义特定部分的样式及其内部元素的样式
其中可包含的属性有
contentalign: //元素位置。可有以下值
top: topleft, topright, topcenter
middle: middleleft, middleright, middlecenter
bottom: bottomleft, bottomright, bottomcenter
wrap: wrapleft, wrapright, wrapcenter //只可用于文本

background: //背景颜色
foreground: //前景颜色
bordercolor: //边界颜色 这3个属性可有以下值
rgb(red,green,blue) //RGB颜色
argb(alpha,red,green,blue) //包含alpha通道
gradient(argb(alpha,red,green,blue), argb(alpha,red,green,blue), Direction) //渐变色,第1个颜色变量为左上,第2个右下 Driection:方向 0 = 水平, 1 = 垂直
black, white, red, green, blue, ... //直接描述
window, windowtext, buttonface, buttonshadow, buttonlight, buttontext, scrollbar, hotlight, activecaption, captiontext... //系统颜色

fontsize: //字号
使用Strings表中值

fontface: //字体
使用Strings表中值

fontstyle: //字体样式
使用normal, bold, italic, underline等制

borderthickness: rect(left,top,right,bottom); //边框宽度

margin: rect(left,top,right,bottom); //缩放时保持不变的边缘宽度
padding: rect(left,top,right,bottom); //元素位置

以XP默认主题Luna的UIFile1为例

//以下各块中元素不再赘述,功能请参阅whistl3r的Shellstyle Tutorial
《style resid=mainsectionss》
《style resid=mainsectiontaskss》
《style resid=sectionss》
《style resid=sectiontaskss》
《style resid=taskpane》
《style resid=NameSpaceItemInfoList》(此处《》应为<>)


*布局 //侧边栏移至上部和右部的方法

除了在element{...}中定义的属性外,element还包含一些其他的属性:
layoutpos //在其父element中的位置,值可为:
top,bottom,left,right,client

layout //element自身的布局方式,影响其子element的排列。值可为:*此属性各值我还很多不清楚的地方,望达人指点
borderlayout() //元素可选择top,bottom,left,right,client等位置
flowlayout(a,b,c) //横向顺序排列
a = 0 强制保持元素在一行中(多出部分会无法显示);1 自动换行以保证元素可以完整显示
b = 0 由左至右;1 由右至左;2 中间
c = 0 由上至下;1 由下至上;2 中间
*b,c是指首先满足其长度/宽度要求的元素顺序。例如b = 2 时,当窗体宽度不足以容纳所有元素时,左侧的元素会被压缩
verticalflowlayout(a,b,c) //垂直顺序排列 a,b,c功能同上
filllayout() //填充 ?
gridlayout() //??

width,height //宽度,高度

sheet //所在的style

改变element的layout和layoutpos属性即可改变布局的样式
下边是一段布局代码(没有布局代码时windows使用在左侧的默认设置)

//侧边栏在上部时,不写这行会没内容

// layoutpos定义了侧边栏的位置
//mainsections和sections的排列方式,gridlayout会使mainsection存在时section无法显示
《/ScrollViewer》
《Element >
......
《/element>
《expando resid=mainsection layout=borderlayout()>
《element layoutpos=top layout=filllayout()> //定位在mainsection顶部区域
《button id=atom(header) layoutpos=top layout=borderlayout()>
《element id=atom(title) layoutpos=left/> //位于header内,左侧
《element id=atom(arrow) layoutpos=right/> //位于header内,右侧
《/button>
《element id=atom(icon) layoutpos=left/>
《/element>
《clipper layoutpos=top> //定位在mainsection顶部区
《element id=atom(watermark) layoutpos=top layout=borderlayout() height=48rp> //位于clipper内,顶部
《tasklist id=atom(tasklist) layoutpos=top layout=flowlayout(1,0,0)/> //位于watermark内,顶部,tasklist内的各任务选项以横向排列
《/element>
《/clipper>
《/expando>
《expando resid=section layout=borderlayout()>
《button id=atom(header) layoutpos=top layout=borderlayout()>
《element id=atom(title) layoutpos=left/>
《element id=atom(arrow) layoutpos=right/>
《/button>
《clipper layoutpos=top>
《tasklist id=atom(tasklist) layout=flowlayout(1,0,0)/>
《/clipper>
《/expando>

补充:
动画效果
animation: rectangle | s | fast
animation: alpha | rectangle | s | fast
alpha:....
当显示属性--外观--效果中的过度效果被选取时,animation属性有效
第一个是滚动展开效果,第二个是渐入渐出效果
s不知道代表的是什么涵义,fast处可用mediumfast

没有评论: