关于Demo的,由于我现在是实际项目里面用的,涉及到了DB什么的,你们那里跑不起来,所以我就把针对每一行设定颜色的代码抽出了一部分,贴出来了。
- Sub Set_Color_Row(ByRef Row As Integer, ByRef Spd As SpreadConv.SpreadConv)
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).ForeColor = Lbl_Color_Def.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).BackColor = Lbl_Color_Def.BackColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Time - 1, Row - 1, Spd.MaxCols - 1).ForeColor = Lbl_Color_Def.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Time - 1, Row - 1, Spd.MaxCols - 1).BackColor = Lbl_Color_Def.BackColor
-
- Call Check_Wrun_Row(Row, Spd)
-
- If Get_Spd_Num(G_Col_KbnDel, Row, Spd) = 1 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SheetHaba - 1, Row - 1, Spd.MaxCols - 1).Locked = True
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SheetHaba - 1, Row - 1, Spd.MaxCols - 1).ForeColor = Lbl_Color_Del.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SheetHaba - 1, Row - 1, Spd.MaxCols - 1).BackColor = Lbl_Color_Del.BackColor
- ElseIf Get_Spd_Num(G_Col_KbnJyogai, Row, Spd) = 1 Then
- Spd.BlockMode = True
- Spd.Row = Row
- Spd.Col = G_Col_SheetHaba
- Spd.Row2 = Row
- Spd.Col2 = Spd.MaxCols
- Spd.Lock = True
- Spd.BlockMode = False
- Set_Color_Kakutei(Row, Spd, 9, 0, 0)
- ElseIf Get_Spd_Num(G_Col_KbnZaiko, Row, Spd) = 1 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SheetHaba - 1, Row - 1, Spd.MaxCols - 1).Locked = True
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SheetHaba - 1, Row - 1, Spd.MaxCols - 1).ForeColor = Lbl_Color_Zaiko.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SheetHaba - 1, Row - 1, Spd.MaxCols - 1).BackColor = Lbl_Color_Zaiko.BackColor
- Else
- Spd.BlockMode = True
- Spd.Row = Row
- Spd.Col = G_Col_SheetHaba
- Spd.Row2 = Row
- Spd.Col2 = Spd.MaxCols
- Spd.Lock = False
- Spd.BlockMode = False
- Spd.Col = G_Col_SouCatSu : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_CatSu : Spd.Row = Row : Spd.Lock = False
- If Get_Spd_Num(G_Col_Zen, Row, Spd) = 1 Then
- Spd.Col = G_Col_SL : Spd.Lock = True
- Spd.Col = G_Col_Kei : Spd.Lock = True
- Spd.Col = G_Col_SC1 : Spd.Lock = True
- Spd.Col = G_Col_SC2 : Spd.Lock = True
- Spd.Col = G_Col_SC3 : Spd.Lock = True
- Spd.Col = G_Col_SC4 : Spd.Lock = True
- Spd.Col = G_Col_SC5 : Spd.Lock = True
- Spd.Col = G_Col_SC6 : Spd.Lock = True
- Spd.Col = G_Col_SC7 : Spd.Lock = True
- Spd.Col = G_Col_SC8 : Spd.Lock = True
- Spd.Col = G_Col_SC9 : Spd.Lock = True
- Spd.Col = G_Col_Torisu : Spd.Lock = True
- Spd.Col = G_Col_SitaSL : Spd.Lock = True
- If Get_Spd_Num(G_Col_Jyuchu_全板, Row, Spd) = 1 Then
- Spd.Col = G_Col_Zen : Spd.Lock = True
- Spd.Col = G_Col_Dansai : Spd.Lock = True
- End If
-
- Else
- Spd.Col = G_Col_SL : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_Kei : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_SC1 : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_SC2 : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_SC3 : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_SC4 : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_SC5 : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_SC6 : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_SC7 : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_SC8 : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_SC9 : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_Torisu : Spd.Row = Row : Spd.Lock = False
- Spd.Col = G_Col_SitaSL : Spd.Row = Row : Spd.Lock = False
- End If
- If Get_Spd_Num(G_Col_DakuNo, Row, Spd) = 1 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SouCatSu - 1).Locked = True
- Spd.ActiveSheet.Cells(Row - 1, G_Col_CatSu - 1, Row - 1, Spd.MaxCols - 1).Locked = False
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SouCatSu - 1, Row - 1, Spd.MaxCols - 1).ForeColor = Lbl_Color_Daku.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SouCatSu - 1, Row - 1, Spd.MaxCols - 1).BackColor = Lbl_Color_Daku.BackColor
- Else
- If Get_Spd_Num(G_Col_DakuNo, Row, Spd) > 1 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SouCatSu - 1).Locked = True
- Spd.ActiveSheet.Cells(Row - 1, G_Col_CatSu - 1, Row - 1, Spd.MaxCols - 1).Locked = False
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SouCatSu - 1, Row - 1, Spd.MaxCols - 1).ForeColor = Lbl_Color_Daku_Ko.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SouCatSu - 1, Row - 1, Spd.MaxCols - 1).BackColor = Lbl_Color_Daku_Ko.BackColor
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SheetHaba - 1, Row - 1, Spd.MaxCols - 1).ForeColor = Lbl_Color_Def.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SheetHaba - 1, Row - 1, Spd.MaxCols - 1).BackColor = Lbl_Color_Def.BackColor
- End If
- End If
- If Get_Spd_Num(G_Col_KbnOchibo, Row, SpdKeikaku) = 1 Then
-
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Time - 1).ForeColor = Lbl_Color_RotOchibo.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Time - 1).BackColor = Lbl_Color_RotOchibo.BackColor
- Else
- If Get_Spd_Num(G_Col_KbnHinOchibo, Row, SpdKeikaku) = 1 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Time - 1).ForeColor = Lbl_Color_HinOchibo.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Time - 1).BackColor = Lbl_Color_HinOchibo.BackColor
- End If
- End If
- If Get_Spd_Num(G_Col_KbnWrun, Row, Spd) = 1 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SheetHaba - 1, Row - 1, Spd.MaxCols - 1).ForeColor = Lbl_Color_Wrun.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_SheetHaba - 1, Row - 1, Spd.MaxCols - 1).BackColor = Lbl_Color_Wrun.BackColor
- End If
- If Get_Spd_Num(G_Col_Hari_ロット固定, Row, Spd) = 1 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Time - 1).ForeColor = Lbl_Color_Rot.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Time - 1).BackColor = Lbl_Color_Rot.BackColor
- End If
-
- Set_Color_Err(Row, Spd)
- End If
-
-
- If Get_Spd_Str(G_Col_Iro1, Row, Spd) <> "" Then
- Spd.Row = Row
- Spd.Col = G_Col_Iro1
- If Get_Spd_Num(G_Col_Paretto1, Row, Spd) <> 0 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro1 - 1).ForeColor = System.Drawing.ColorTranslator.FromOle(Get_Spd_Num(G_Col_Paretto1, Row, Spd))
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro1 - 1).ForeColor = System.Drawing.ColorTranslator.FromOle(0)
- End If
- If Get_Spd_Num(G_Col_ParettoB1, Row, Spd) <> 0 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro1 - 1).BackColor = System.Drawing.ColorTranslator.FromOle(Get_Spd_Num(G_Col_ParettoB1, Row, Spd))
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro1 - 1).BackColor = System.Drawing.ColorTranslator.FromOle(16777215)
- End If
- End If
- If Get_Spd_Str(G_Col_Iro2, Row, Spd) <> "" Then
- Spd.Row = Row
- Spd.Col = G_Col_Iro2
- If Get_Spd_Num(G_Col_Paretto2, Row, Spd) <> 0 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro2 - 1).ForeColor = System.Drawing.ColorTranslator.FromOle(Get_Spd_Num(G_Col_Paretto2, Row, Spd))
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro2 - 1).ForeColor = System.Drawing.ColorTranslator.FromOle(0)
- End If
- If Get_Spd_Num(G_Col_ParettoB2, Row, Spd) <> 0 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro2 - 1).BackColor = System.Drawing.ColorTranslator.FromOle(Get_Spd_Num(G_Col_ParettoB2, Row, Spd))
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro2 - 1).BackColor = System.Drawing.ColorTranslator.FromOle(16777215)
- End If
- End If
- If Get_Spd_Str(G_Col_Iro3, Row, Spd) <> "" Then
- Spd.Row = Row
- Spd.Col = G_Col_Iro3
- If Get_Spd_Num(G_Col_Paretto3, Row, Spd) <> 0 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro3 - 1).ForeColor = System.Drawing.ColorTranslator.FromOle(Get_Spd_Num(G_Col_Paretto3, Row, Spd))
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro3 - 1).ForeColor = System.Drawing.ColorTranslator.FromOle(0)
- End If
- If Get_Spd_Num(G_Col_ParettoB3, Row, Spd) <> 0 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro3 - 1).BackColor = System.Drawing.ColorTranslator.FromOle(Get_Spd_Num(G_Col_ParettoB3, Row, Spd))
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro3 - 1).BackColor = System.Drawing.ColorTranslator.FromOle(16777215)
- End If
- End If
-
- If Get_Spd_Str(G_Col_Iro4, Row, Spd) <> "" Then
- Spd.Row = Row
- Spd.Col = G_Col_Iro4
-
- If Get_Spd_Num(G_Col_Paretto4, Row, Spd) <> 0 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro4 - 1).ForeColor = System.Drawing.ColorTranslator.FromOle(Get_Spd_Num(G_Col_Paretto4, Row, Spd))
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro4 - 1).ForeColor = System.Drawing.ColorTranslator.FromOle(0)
- End If
- If Get_Spd_Num(G_Col_ParettoB4, Row, Spd) <> 0 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro4 - 1).BackColor = System.Drawing.ColorTranslator.FromOle(Get_Spd_Num(G_Col_ParettoB4, Row, Spd))
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Iro4 - 1).BackColor = System.Drawing.ColorTranslator.FromOle(16777215)
- End If
- End If
-
- If Microsoft.VisualBasic.Left(Get_Spd_Str(G_Col_Tokui, Row, Spd), 3) = "大内段" Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Tokui - 1).BackColor = System.Drawing.ColorTranslator.FromOle(&HC0E0FF)
- End If
-
- If Get_Spd_Num(G_Col_配送CD, Row, Spd) <> 0 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Haiso - 1).ForeColor = System.Drawing.ColorTranslator.FromOle(CInt(Get_Spd_Str(G_Col_配送文字カラー, Row, Spd)))
- End If
-
-
- If VBUP.VBUP.Format(Get_Spd_Str(G_Col_Jyuchu_納期, Row, Spd), "YYYY/MM/DD") <= VBUP.VBUP.Format(G_DATE, "YYYY/MM/DD") Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Nouki - 1).BackColor = System.Drawing.ColorTranslator.FromOle(&HC0C0FF)
- End If
-
-
- Select Case Get_Spd_Num(G_Col_Hari_確定区分, Row, Spd)
- Case 1
- Spd.ActiveSheet.Cells(Row - 1, 0, Row - 1, Spd.MaxCols - 1).Locked = False
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).ForeColor = Lbl_Color_KariKakutei.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).BackColor = Lbl_Color_KariKakutei.BackColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).Text = "仮"
- Case 2, 3
- Select Case Get_Spd_Num(G_Col_Hari_直区分, Row, Spd)
- Case 1
- Spd.ActiveSheet.Cells(Row - 1, 0, Row - 1, Spd.MaxCols - 1).Locked = True
- If Get_Spd_Num(G_Col_Hari_確定区分, Row, Spd) = 2 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).ForeColor = Lbl_Color_1Tyoku.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).BackColor = Lbl_Color_1Tyoku.BackColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).Text = "1"
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).ForeColor = Lbl_Color_Sousin.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).BackColor = Lbl_Color_Sousin.BackColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).Text = "1"
- End If
- Case 2
- Spd.ActiveSheet.Cells(Row - 1, 0, Row - 1, Spd.MaxCols - 1).Locked = True
- If Get_Spd_Num(G_Col_Hari_確定区分, Row, Spd) = 2 Then
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).ForeColor = Lbl_Color_2Tyoku.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).BackColor = Lbl_Color_2Tyoku.BackColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).Text = "2"
- Else
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).ForeColor = Lbl_Color_Sousin.ForeColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).BackColor = Lbl_Color_Sousin.BackColor
- Spd.ActiveSheet.Cells(Row - 1, G_Col_Head - 1).Text = "2"
- End If
-
- End Select
- End Select
- End Sub
复制代码
|