K3老单插件控制字段显示

0

本文作者:xjtudll  发布于:2021-9-25  分类:技术心得  点击:


https://www.cnblogs.com/youzhangcai1/p/10685778.html
204679-20190410200824978-2071314483

【问题描述:】

我想在工业单据的插件中锁定单据头字段,但实现不了?

【解决方法:】

For i = 0 To m_BillTransfer.Head.count - 1
    If m_BillTransfer.Head(i).Caption = "客户地点:" Then

        '客户地点显示、不可编辑(Visible改为False为不显示)

        m_BillTransfer.Head(i).Visible = True
        m_BillTransfer.Head(i).Enabled = False

        m_BillTransfer.Head(i).Caption= "XXXX"

        Exit For
    End If

Next i

【问题描述:】

我想在录产品入库单时做一插件,只要有一个地方改变就自动隐藏单据体中的“备注”列,试来试去不行,还请高人指点,先谢了!

【解决方法:】

你可以将其锁定,而不必隐藏:

Private Sub m_BillTransfer_HeadChange(ByVal CtlIndex As Long, ByVal Value As Variant, ByVal bNewBill As Boolean, Cancel As Boolean)
Dim vsEntrys As Object
Dim i As Long
Set vsEntrys = m_BillTransfer.Grid
For i = 1 To UBound(m_BillTransfer.EntryCtl)

    If UCase(m_BillTransfer.EntryCtl(i).FieldName) = "FNOTE" Then
       Exit For
   End If
Next i

'锁定单据体备注字段

With vsEntrys
   .col = i
   .Col2 = i
   .row = -1
   .BlockMode = True
   .Lock = True
   .BlockMode = False
End With
End Sub
你也可以将此列锁定后列宽设置为0,变通实现隐藏:
With vsEntrys
   .col = i
   .Col2 = i
   .row = -1
   .BlockMode = True
   .Lock = True
   .BlockMode = False
   .ColWidth(i) = 0
End With

0 Comments

Write a comment ?