六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

DataWindow Style幫你格式化數據窗口樣式

[摘要]在使用DataWindow時,通常我們都是手工在數據窗口畫板中來調整數據窗口對象的樣式(列寬、列高、標題、顏色等等)。但是在大型的應用中,往往會有眾多的數據窗口,而反復的手工去調整這些數據窗口會給我們的開發工作帶來極大的不便,即使耐心的一個一個地修改了數據窗口對象的樣式,也難免不能做到精確的統一,...
  在使用DataWindow時,通常我們都是手工在數據窗口畫板中來調整數據窗口對象的樣式(列寬、列高、標題、顏色等等)。但是在大型的應用中,往往會有眾多的數據窗口,而反復的手工去調整這些數據窗口會給我們的開發工作帶來極大的不便,即使耐心的一個一個地修改了數據窗口對象的樣式,也難免不能做到精確的統一,這樣即不符合功能復用的精神,也給系統的使用效果帶來一定的影響。
      為了很好的解決這一問題,特提出了此解決方案,此方案是專門針對Grid類型的數據窗口的,在此基類中,通過代碼遍歷數據窗口的所有可視列,來改變列以及列標題的樣式,以及改變擁有下拉子數據窗口的列中的數據窗口的樣式,從而達到格式化數據窗口樣式的目的。
      你可以在以下的圖示中觀察到這一功能的最終效果: 
 

DataWindow Style幫你格式化數據窗口樣式

                圖1.DataWindow Style效果示例
      實現機制:
      1.首先要有一個數據窗口的基類,作為以后封裝各類數據窗口相關的特征代碼的容器。
      2.所有要格式化的DWObject的屬性均需設置為變量的形式,并為他們賦值。
      3.通過Describe("DataWindow.Column.Count") 函數來得到數據窗口的列數,并遍歷列,使用Modify(" ")函數來實現改變DWObject其相關的屬性(例如:執行Modify( "id_t .Font.Face=’宋體’" )來改變id_t的字體 )。
      4.重復3的過程,但不同的是,這次遍歷的是子數據窗口的列,也就是DataWindowChild對象,注意:別忘記了先判斷數據窗口是否擁有DataWindowChild,有的話記住先得到他們。
      5.也是最后一步,你是否需要保存數據窗口的樣式呢?( 比如:保持同樣的列寬,下次再打開此窗口時可以保持與上次調整的列寬一樣。) 這里只是做了一個提醒,至于如何具體實現,本例中不做說明了,或許以后有專門講解系統配置方面的專題中再加以說明吧。
      主要代碼實現:
      1.變量的聲明:
         private:
         integer                   ii_style =  1            //默認樣式
         constant  integer    STYLE_DEFAULT = 1
         //STYLE_DEFAULT
         constant  string      colheader_fontcolor_default = "16777215"
         constant  string      colheader_bgcolor_default = "10040064"
         constant  string      col_bgcolor_default= "536870912~tif(mod(getrow(),2)=0,rgb(239,236,229),rgb(255,255,255))"
      2.主要函數:
      1)   integer of_getchild(ref datawindowchild adwc[])
            integer                  i, j, li_col_cnt
            integer                  li_ret
            string                    ls_col
            datawindowchild   ldwc_child[]
            li_col_cnt = integer( this.describe( "DataWindow.Column.Count" ) ) 
            if li_col_cnt < 1 then return -1
            for i = 1 to li_col_cnt 
                 ls_col = this.of_getcolumndisplayname( i )
                 li_ret = this.getchild( ls_col, ldwc_child[i] )
                 if li_ret = 1 then
                    j++
                    this.getchild( ls_col, adwc[j] )
                 end if
            next
            return j
      2)   string of_getcolumndisplayname(integer ai_colnumber)
            string ls_colname
            ls_colname = this.describe ("#" + string (ai_colnumber) + ".name")
            if ls_colname = " " or ls_colname = "!" then
               return "!"
            end if
            return of_getColumnDisplayName (ls_colname)
      3)   string of_getcolumndisplayname(string as_colname)
            string ls_coldisplayname
            ls_coldisplayname = this.describe (as_colname + ".name")
            return ls_coldisplayname
      4)   string of_getheadername(string as_column)
            string ls_defaultheadersuffix = "_t"
            string   ls_colhead
            ls_colhead = as_column + ls_defaultheadersuffix
            return ls_colhead
      5)   string of_getheadertext(string as_column)
            string ls_defaultheadersuffix = "_t"
            string   ls_colhead
            ls_colhead = this.describe ( as_column + ls_defaultheadersuffix + ".Text" )
            if ls_colhead = "!" then
              //No valid column header, use column name.
              ls_colhead = as_column
            end if 
            return ls_colhead
      6)   integer of_setstyle(integer ai_style)
            integer          i, j
            integer          li_column_cnt                  //列數
            string           ls_column_name               //列名
            string           ls_column_width               //列寬
            string           ls_child_column_name      //子數據窗口列名
            string           ls_column_headername     //列標題
            string           ls_colheader_fontcolor      //列標題字體顏色
            string           ls_colheader_bgcolor        //列標題背景顏色
            string           ls_col_bgcolor                  //列背景顏色
            datawindowchild  ldwc_child[]             //子數據窗口
            choose case ai_style
             case 1
              ls_colheader_fontcolor = colheader_fontcolor_default
              ls_colheader_bgcolor = colheader_bgcolor_default
              ls_col_bgcolor = col_bgcolor_default
             case else
              ls_colheader_fontcolor = colheader_fontcolor_default
              ls_colheader_bgcolor = colheader_bgcolor_default
              ls_col_bgcolor = col_bgcolor_default   
            end choose
            //禁止列移動
            this.modify("DataWindow.Grid.ColumnMove=No")
            //禁止鼠標全選擇
            this.modify("DataWindow.Selected.Mouse=No")
            //調整列以及列標題
            li_column_cnt = integer( this.describe("DataWindow.Column.Count") )
            for i = 1 to li_column_cnt
              //調整列樣式 
              ls_column_name = this.of_getcolumndisplayname( i )
              this.modify( ls_column_name + ".Font.Face=’宋體’" )
              this.modify( ls_column_name + ".Font.Height=’-9’" )
              this.modify( ls_column_name + ".Y=’4’" )
              this.modify( ls_column_name + ".Height=’56’")
              this.modify( ls_column_name + ".Background.Mode=’0’" )
              this.Modify( ls_column_name + ".Background.Color=’" + ls_col_bgcolor + "’" )
              //調整列標題樣式
              ls_column_headername = this.of_getheadername( ls_column_name )
              this.modify( ls_column_headername + ".Color=’" + ls_colheader_fontcolor + "’" )
              this.modify( ls_column_headername + ".Font.Face=’Arial’" )
              this.modify( ls_column_headername + ".Font.Height=’-9’" )
              this.modify( ls_column_headername + ".Y=’0’" )
              this.modify( ls_column_headername + ".Height=’68’")
              this.modify( ls_column_headername + ".background.mode=’0’" )
              this.modify( ls_column_headername + ".Background.Color=’" + ls_colheader_bgcolor + "’")
            next
            //帶區樣式
            this.modify("DataWindow.Header.Height=’68’")
            this.modify("DataWindow.Detail.Height=’68’")
            this.modify("DataWindow.Footer.Height=’40’")
            //this.modify("DataWindow.Footer.Color= ’" + ls_colheader_bgcolor + "’")
            //調整datawindowchild樣式
            this.of_getchild( ldwc_child[] )
            for i = 1 to upperbound( ldwc_child )
              if isvalid( ldwc_child[i] ) then
                 ldwc_child[i].settransobject( sqlca )
                 //禁止列移動
                 ldwc_child[i].modify("DataWindow.Grid.ColumnMove=No")
                 //禁止鼠標全選擇
                 ldwc_child[i].modify("DataWindow.Selected.Mouse=No")
                 //調整表頭高度為0
                 ldwc_child[i].modify("DataWindow.Header.Height=’0’")
                 //調整數據區高度
                 ldwc_child[i].modify("DataWindow.Detail.Height=’68’")
                 //datawindowchild的列數
                 li_column_cnt = integer( ldwc_child[1].describe("DataWindow.Column.Count") )
                 //調整datawindowchild的列樣式
                 for j = 1 to li_column_cnt
                       //調整列樣式 
                       ls_child_column_name = ldwc_child[i].describe ("#" + string (j) + ".name")
     
                       if ls_child_column_name = " " or ls_child_column_name = "!" then
                       ls_child_column_name = ’’
              else
                 ls_child_column_name = ldwc_child[i].describe ( ls_child_column_name + ".name" )
              end if
     
              ldwc_child[i].modify( ls_child_column_name + ".Font.Face=’宋體’" )
              ldwc_child[i].modify( ls_child_column_name + ".Font.Height=’-9’" )
              ldwc_child[i].modify( ls_child_column_name + ".Y=’4’" )
              ldwc_child[i].modify( ls_child_column_name + ".Height=’56’")
              ldwc_child[i].modify( ls_child_column_name + ".Background.Mode=’0’" )
             ldwc_child[i].Modify( ls_child_column_name + ".Background.Color=’" + ls_col_bgcolor + "’" ) 
            next
          end if
         next
         return 1



主站蜘蛛池模板: 亚洲精品另类 | 亚洲欧美日本在线观看 | 日本视频一区二区三区 | 午夜亚洲国产精品福利 | 亚洲日本视频 | 新一级毛片国语版 | 欧美在线天堂 | 色噜噜狠狠狠狠色综合久 | 色爱区综合五月激情 | 亚洲va韩国va欧美va | 亚洲欧美在线观看一区二区 | 三级国产精品一区二区 | 日韩欧美综合在线 | 一区二区三区在线视频观看 | 欧美天天性影院 | 日韩一级欧美一级在线观看 | 青青青免费网站在线观看 | 日韩爱爱网 | 天天综合网站 | 天天干天天插天天 | 日本高清在线播放 | 一区在线视频 | 色综合日韩 | 一级做a爰片久久毛片美女 一级做a爰片久久毛片毛片 | 亚洲xxxxx | 欧美艳星nikki办公室 | 一级做a毛片免费视频 | 日本美女久久 | 色先锋资源 | 伊人动漫| 一级做a爰全过程免费视频毛片 | 一本久道在线 | 亚洲男人的天堂久久香蕉网 | 亚洲精品在线播放视频 | 午夜痒痒网| 午夜人屠h精品全集 | 午夜性刺激免费视频观看不卡专区 | 日本性在线 | 午夜噜噜| 午夜欧美精品久久久久久久 | 青青草免费线观 |