好东西大家共享(从网上下的)

ld2099 2003-12-12 05:47:23
//1.生肖(年份参数:int ls_year 返回参数:string):
mid(fill('鼠牛虎兔龙蛇马羊猴鸡狗猪',48),(mod(ls_year -1900,12)+13)*2 -1,2)


//2.天干地支(年份参数:int ls_year 返回参数:string):
mid(fill('甲乙丙丁戊己庚辛壬癸',40),(mod(ls_year -1924,10)+11)*2 -1,2)+mid(fill('子丑寅卯辰巳午未申酉戌亥',48),(mod(ls_year -
1924,12)+13)*2 -1,2)


//3.星座(日期参数:date ls_date 返回参数:string):
mid("摩羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手摩羯",(month(ls_date)+sign(sign(day(ls_date) -(19+integer(mid
('102123444423',month(ls_date),1))))+1))*4 -3,4)+'座'

//4.判断闰年(年份参数:int ls_year 返回参数:int 0=平年,1=闰年):
abs(sign(mod(sign(mod(abs(ls_year),4))+sign(mod(abs(ls_year),100))+sign(mod(abs(ls_year),400)),2)) -1)


//5.某月天数(日期参数:date ls_date 返回参数:int):
integer(28+integer(mid('3'+string(abs(sign(mod(sign(mod(abs(year(ls_date)),4))+sign(mod(abs(year(ls_date)),100))+sign(mod(abs(year
(ls_date)),400)),2)) -1))+'3232332323',month(ls_date),1)))


//6.某月最后一天日期(日期参数:date ls_date 返回参数:date):
date(year(ls_date),month(ls_date),integer(28+integer(mid('3'+string(abs(sign(mod(sign(mod(abs(year(ls_date)),4))+sign(mod(abs(year
(ls_date)),100))+sign(mod(abs(year(ls_date)),400)),2)) -1))+'3232332323',month(ls_date),1))))


//7.另一个求某月最后一天日期(日期参数:date ls_date 返回参数:date):
RelativeDate (date(year(ls_date)+sign(month(ls_date) -12)+1,mod(month(ls_date)+1,13)+abs(sign(mod(month(ls_date)+1,13)) -1),1),-1)


//8.另一个求某月天数(日期参数:date ls_date 返回参数:int):
day(RelativeDate (date(year(ls_date)+sign(month(ls_date) -12)+1,mod(month(ls_date)+1,13)+abs(sign(mod(month(ls_date)+1,13)) -
1),1),-1))


//9.某月某日星期几--同PB系统函数DayName(日期参数:date ls_date 返回参数:string):
'星期'+mid('日一二三四五六',(mod(year(ls_date) -1 + int((year(ls_date) -1)/4) - int((year(ls_date) -1)/100) + int((year(ls_date) -
1)/400) + daysafter(date(year(ls_date),1,1),ls_date)+1,7)+1)*2 -1,2)


//10.求相隔若干月份后的相对日期(日期参数:date ls_date 相隔月份(可取负数):int ls_add_month 返回参数:date):
date(year(ls_date)+int((month(ls_date)+ls_add_month)/13),long(mid(fill('010203040506070809101112',48),(mod(month(ls_date)
+ls_add_month -1,12)+13)*2 -1,2)),day(ls_date) -integer(right(left(string(day(RelativeDate (date(year(ls_date)+int((month(ls_date)
+ls_add_month)/13)+sign(long(mid(fill('010203040506070809101112',48),(mod(month(ls_date)+ls_add_month -1,12)+13)*2 -1,2)) -12)+
1,mod(long(mid(fill('010203040506070809101112',48),(mod(month(ls_date)+ls_add_month -1,12)+13)*2 -1,2))+1,13)+abs(sign(mod(long(mid
(fill('010203040506070809101112',48),(mod(month(ls_date)+ls_add_month -1,12)+13)*2 -1,2))+1,13)) -1),1),-1)) -day(ls_date),'00')
+'00000',5),3))/100)



...全文
24 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
banalman 2003-12-16
  • 打赏
  • 举报
回复
非常感谢。正用上。
treesoft 2003-12-16
  • 打赏
  • 举报
回复
好东东! :)
ld2099 2003-12-16
  • 打赏
  • 举报
回复
再来一些。都是在陶清网站下的。


1.RGB函数计算公式: 颜色值 = (65536 * Blue) + (256 * Green) + (Red)

2.控件可拖动:
send(handle(this),274,61458,0)

3.如何用程序控制下拉子数据窗口的下拉和收起
用modify或者直接用dw_1.object.col1.dddw.showlist = true

4.检索参数有些不需要传入则传%.

5.如何屏蔽鼠标滚轮触发
在控件的other事件写
if message.number = 522 then return 1

6.得到数据窗口的语法:
string ls_dwsyntax
ls_dwsyntax=dw_1.describe("datawindow.syntax")

7.得到数据窗口中各列及标题:
long ll_count,i
string ls_value,ls_colname

ll_colnum = Long(dw_1.object.datawindow.column.count)

for i = 1 to ll_colnum
//得到标题头的名字
ls_colname = dw_1.describe('#' + string(i) + ".name") + "_t"
ls_value = dw_1.describe(ls_colname + ".text")
next

8.在程序中动态设置初始值:
ex:dw_contro.object.columnName.initial = 'xxxx'

9.如何在DataWindow的SQL语法中不使用SELECT DISTINCT实现删除重复的行

---- 起先对你要显示唯一值的列进行排序:"city A",然后增加如下过滤字符串:" city < > city [-1] or GetRow () = 1"

10.如何改变列的字体颜色,提醒用户此列已做修改

---- 在列的Color属性中,输入如下表达式IF (column_name < >column_name.Original, RGB(255, 0, 0), RGB(0, 0, 0))。在这个条件中,如果此列已改变,则显示红色字体,否则显示黑色字体。这个表达式主要用column_name < > column_name.Original比较当前列的值和原始列的值是否相同来达到判断的目的。

11.在数据窗口的clicked或doubleclicked事件中写上注释//可解决一些意外的bug!
chrisfy 2003-12-16
  • 打赏
  • 举报
回复
收藏先
rickeycat 2003-12-15
  • 打赏
  • 举报
回复
up
workhand 2003-12-15
  • 打赏
  • 举报
回复
good,收藏
Cat 2003-12-15
  • 打赏
  • 举报
回复
up
xiao_bai 2003-12-15
  • 打赏
  • 举报
回复
谢谢楼主。
BenyMo 2003-12-15
  • 打赏
  • 举报
回复
十分好
liliang800207 2003-12-15
  • 打赏
  • 举报
回复
up
hdvcd 2003-12-15
  • 打赏
  • 举报
回复
upup,收藏收藏
GoldProgramer 2003-12-14
  • 打赏
  • 举报
回复
不错,真的很好。
mittee 2003-12-14
  • 打赏
  • 举报
回复
很漂亮
viaboy 2003-12-14
  • 打赏
  • 举报
回复
crezy up
samonchang 2003-12-14
  • 打赏
  • 举报
回复
up
hzhxxx 2003-12-12
  • 打赏
  • 举报
回复
up

1,078

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧