⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 controls.xml

📁 cShap控制云台运动
💻 XML
📖 第 1 页 / 共 5 页
字号:
else
  Element1.SetBounds( Left, Top + Height - 16, Element1.Width, 16 )
  Element2.SetBounds( Left, Top, Element2.Width, 16 )
end if
Element3.Visible = Height >= 48
if Element3.Visible then
  Element3.Top = Element2.Top + Element2.Height
else
  Element3.Top = Element2.Top
end if
Line1.SetBounds( Left, Element3.Top, Line1.Width, Element1.Top - Element3.Top )
Line2.SetBounds( Line1.Left, Line1.Top, Line1.Width, Line1.Height )
SetPos( FPos )
end function
private function OnTimer(Sender)
SetPos( FPos + Line1.Tag * FPage )
p = Point( 0, 0 )
GetCursorPos( p )
ScreenToClient( p )
ClientToView( p )
stop = false
if Line1.Tag > 0 then
  if p.y < Element3.Top + Element3.Height then
    stop = true
  end if
else
  if p.y > Element3.Top then
    stop = true
  end if
end if
if stop then
  OnDestroy( Sender )
  Line2.Visible = false
else if FTimerInterval = 300 then
  OnDestroy( Sender )
  FTimerInterval = 100
  FTimer = CreateTimer( Sender, "OnTimer", FTimerInterval )
end if
end function
property Page read FPage write SetPage
property Pos read FPos write SetPos
private function SetEnable(AValue)
Element1.Enable = AValue
Element2.Enable = AValue
Enabled = AValue
end function
private function SetMax(AValue)
n = int( AValue )
if ( n < 0 ) then
  n = 0
end if
FMax = n
SetPage( FPage )
SetPos( FPos )
end function
private function SetPage(AValue)
FPage = int( AValue )
if( FPage > FMax )then
	FPage = FMax
end if
if FPage < 1 then
  FPage = 1
end if
end function
private function SetPos(AValue)
n=int( AValue )
if n < 0 then
	n = 0
end if
if n > FMax then
	n = FMax
end if
Element3.Visible = (Line1.Height > Element3.Height)
m = Element3.Top
if FMax <> 0 then
  Element3.Top = Line1.Top + ( Line1.Height - Element3.Height ) * n / FMax
else
  Element3.Top = Line1.Top
end if
if Line1.Tag > m then
  Line2.SetBounds( Line1.Left, Element3.Top + Element3.Height, Line1.Width, Element1.Top - Element3.Top - Element3.Height )
else
  Line2.SetBounds( Line1.Left, Line1.Top, Line1.Width, Element3.Top - Line1.Top )
end if
if FPos <> n then
	FPos = n
  OnChange( this )
end if
end function
</programe>
</VScrollBar>
<CheckBox name="CheckBox1" bounds="2,2,352,18" origin="48.347962,13" visible="false" Caption="&apos;CheckBox1&apos;" Checked="false" Enable="true" Focused="false" Selected="false">
<text name="Text1" bounds="19,2,352,18" origin="4,2.4" linecolor="$80000005" backcolor="$80000005" pattern="1" border="$0" fontname="瀹嬩綋" fontsize="12" fontcolor="$80000008" wordwrap="false" multiline="false" textalign="4" borderinterval="0" text="CheckBox1"/>
<rect name="Rect1" bounds="18.970002,2,352,18" origin="25,8" linetype="0" linewidth="0"/>
<line name="line1" origin="8.5,10" selectmode="0" linetype="0" pattern="1" picturedata="07TBitmap
424DDA0200000000000036000000280000000D0000000D0000000100200000000000A40200000000000000000000000000000000000080511C0080511C008051
1C0080511C0080511C0080511C0080511C0080511C0080511C0080511C0080511C0080511C0080511C0080511C00EFF1F100F1F3F300F4F5F500F6F7F700F8F9
F900FAFBFB00FCFDFD00FEFEFE00FFFFFF00FFFFFF00FFFFFF0080511C0080511C00ECEFEF00EFF1F100F1F3F300F4F5F500F6F7F700F8F9F900FAFBFB00FCFD
FD00FEFEFE00FFFFFF00FFFFFF0080511C0080511C00E9ECEC00ECEFEF00EFF1F100F1F3F300F4F5F500F6F7F700F8F9F900FAFBFB00FCFDFD00FEFEFE00FFFF
FF0080511C0080511C00E5E8E800E9ECEC00ECEFEF00EFF1F100F1F3F300F4F5F500F6F7F700F8F9F900FAFBFB00FCFDFD00FEFEFE0080511C0080511C00E2E5
E500E5E8E800E9ECEC00ECEFEF00EFF1F100F1F3F300F4F5F500F6F7F700F8F9F900FAFBFB00FCFDFD0080511C0080511C00DEE2E200E2E5E500E5E8E800E9EC
EC00ECEFEF00EFF1F100F1F3F300F4F5F500F6F7F700F8F9F900FAFBFB0080511C0080511C00DBE0E000DEE2E200E2E5E500E5E8E800E9ECEC00ECEFEF00EFF1
F100F1F3F300F4F5F500F6F7F700F8F9F90080511C0080511C00D9DEDE00DBE0E000DEE2E200E2E5E500E5E8E800E9ECEC00ECEFEF00EFF1F100F1F3F300F4F5
F500F6F7F70080511C0080511C00D7DCDC00D9DEDE00DBE0E000DEE2E200E2E5E500E5E8E800E9ECEC00ECEFEF00EFF1F100F1F3F300F4F5F50080511C008051
1C00D7DCDC00D7DCDC00D9DEDE00DBE0E000DEE2E200E2E5E500E5E8E800E9ECEC00ECEFEF00EFF1F100F1F3F30080511C0080511C00D7DCDC00D7DCDC00D7DC
DC00D9DEDE00DBE0E000DEE2E200E2E5E500E5E8E800E9ECEC00ECEFEF00EFF1F10080511C0080511C0080511C0080511C0080511C0080511C0080511C008051
1C0080511C0080511C0080511C0080511C0080511C0080511C00">
<points>
2,3.5,6
15,3.5,2
15,16.5,2
2,16.5,2
</points>
</line>
<line name="line2" origin="8.5,10" selectmode="0" visible="false" linetype="0" pattern="1" picturedata="07TBitmap
424D1A0200000000000036000000280000000B0000000B0000000100200000000000E40100000000000000000000000000000000000063C8FB005AC5FA0054C2
FA004EC0FA0048BDF90043BBF9003EB9F9003AB7F90036B6F80033B4F80030B3F8006BCCFB0063C8FB005AC5FA0054C2FA004EC0FA0048BDF90043BBF9003EB9
F9003AB7F90036B6F80033B4F80074D0FC006BCCFB00E3E7E700E3E7E700E3E7E700E3E7E700E3E7E700E3E7E700E3E7E7003AB7F90036B6F8007CD3FC0074D0
FC00E3E7E700E3E7E700E3E7E700E3E7E700E3E7E700E3E7E700E3E7E7003EB9F9003AB7F90084D6FD007CD3FC00E3E7E700E3E7E700E3E7E700E3E7E700E3E7
E700E3E7E700E3E7E70043BBF9003EB9F9008CD9FD0084D6FD00E3E7E700E3E7E700E3E7E700E3E7E700E3E7E700E3E7E700E3E7E70048BDF90043BBF9009CDF
FE008CD9FD00E3E7E700E3E7E700E3E7E700E3E7E700E3E7E700E3E7E700E3E7E7004EC0FA0048BDF900ACE4FE009CDFFE00E3E7E700E3E7E700E3E7E700E3E7
E700E3E7E700E3E7E700E3E7E70054C2FA004EC0FA00BAE9FF00ACE4FE00E3E7E700E3E7E700E3E7E700E3E7E700E3E7E700E3E7E700E3E7E7005AC5FA0054C2
FA00C6EDFF00BAE9FF00ACE4FE009CDFFE008CD9FD0084D6FD007CD3FC0074D0FC006BCCFB0063C8FB005AC5FA00CFF0FF00C6EDFF00BAE9FF00ACE4FE009CDF
FE008CD9FD0084D6FD007CD3FC0074D0FC006BCCFB0063C8FB00">
<points>
3,4.5,6
14,4.5,2
14,15.5,2
3,15.5,2
</points>
</line>
<line name="line3" origin="8.5,10" selectmode="0" visible="false" linetype="0" picturedata="07TBitmap
424D1A0200000000000036000000280000000B0000000B0000000100200000000000E401000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000800000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00008000000080000000800000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00008000000080000000800000008000000080
0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000080000000800000FFFFFF00008000000080000000800000FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0000800000FFFFFF00FFFFFF00FFFFFF00008000000080000000800000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000080000000800000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000800000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00">
<points>
3,4.5,6
14,4.5,2
14,15.5,2
3,15.5,2
</points>
</line>
<programe>
property Caption read GetCaption write SetCaption
property Checked read GetChecked write SetChecked editor Bool
property Enable read GetEnable write SetEnable editor Bool
property Focused read GetFocused write SetFocused editor Bool
private function GetCaption()
return Text1.Text
end function
private function GetChecked()
return Line3.Visible
end function
private function GetEnable()
return Enabled
end function
private function GetFocused()
return ( Rect1.LineType = 15 )
end function
private function Initialize(Sender)
FSelected = false
end function
public function OnKeyDown(Sender,Key)
b = ( Key = 32 )
if not b then
  s = &apos;(&apos; + chr( Key ) + &apos;)&apos;
  if At( s, Caption ) &gt; 0 then
    b = true
  end if
end if
if b then
  OnClick( Sender )
end if
end function
private function OnMouseEnter(Sender)
Line2.Visible = true
end function
private function OnMouseExit(Sender)
Line2.Visible = false
end function
private function OnResize(Sender)
Line1.MoveTo( Left, Top + Height / 2 - Line1.Height / 2 )
Line2.MoveTo( Line1.Left + 1, Line1.Top + 1 )
Line3.MoveTo( Line1.Left + 1, Line1.Top + 1 )
Text1.SetBounds( Line1.Right + 4, Top, Right - ( Line1.Right + 4 ), Height )
Rect1.SetBounds( Text1.Left, Text1.Top, Text1.Width, Text1.Height )
end function
published function OnValueChanged(Sender)
end function
property Selected read FSelected write SetSelected editor Bool
private function SetCaption(AValue)
Text1.Text = AValue
Refresh()
end function
private function SetChecked(AChecked)
if Line3.Visible &lt;&gt; AChecked then
  Line3.Visible = AChecked
  if IsLoaded() then
    OnValueChanged( this )
  end if
end if
end function
private function SetEnable(AValue)
Enabled = AValue
if Enabled then
  Text1.FontColor = $80000008
else
  Text1.FontColor = $80000011
end if
end function
private function SetFocused(AValue)
if AValue then
  i=0
  while i &lt; Parent.UnitCount
    d = Parent.Units[i]
    if d &lt;&gt; this and d.HasProperty( &apos;Focused&apos; ) then
      if d.Focused then
        d.Focused = false
      end if
    end if
    i = i + 1
  wend
  Rect1.LineType = 15
else
  Rect1.LineType = 0
end if
end function
private function SetSelected(AValue)
FSelected = AValue
if FSelected then
  Text1.BackColor = $8000000D
  Text1.LineColor = $8000000D
  Text1.FontColor = $8000000E
else
  Text1.BackColor = $80000005
  Text1.LineColor = $80000005
  Text1.FontColor = $80000008
end if
end function
</programe>
</CheckBox>
<group name="Group1">
</group>
<programe>
public function AddItem(AValue)
ar[ar.count]=AValue
ck[ck.count]=false
if fupdate then
  Reset()
end if
end function
public function BeginUpdate()
fupdate=false
end function
public function DeleteItem(AIndex)
if AIndex&gt;=0 and AIndex&lt;ar.Count then
  if ItemIndex=(ar.Count-1) then
    ItemIndex=ItemIndex-1
  end if
  ar.delete(AIndex)
  ck.delete(AIndex)   
  if fupdate then
    Reset()
  end if
end if
end function
property Enable read GetEnable write SetEnable editor Bool
public function EndUpdate()
fupdate=true
Reset()
end function
property Focused read FFocused write SetFocused editor Bool
public function GetChecked(FIndex)
return ck[FIndex]
end function
public function GetCount()
Return ar.count
end function
private function GetEnable()
return Enabled
end function
public function GetItem(AIndex)
return ar[AIndex]
end function
private function GetItems()
return ar.Text
end function
public function IndexOf(AItem)
n=-1 
i=0 
while i&lt;ar.count
  if ar[i]=AItem then
    n=i
    i=ar.count
  end if
  i=i+1
wend
return n
end function
private function Initialize(Sender)
ar=array(10)
ck=array(10)
FItemIndex=-1
fupdate=true
FFocused=false
FItemHeight = 16
end function
property ItemHeight read FItemHeight write SetItemHeight
property ItemIndex read FItemIndex write SetItemIndex
property Items read GetItems write SetItems
public function OnKeyDown(Sender,Key)
if Key = 33 then
  n = ItemIndex - Group1.UnitCount
else if Key = 34 then
  n = ItemIndex + Group1.UnitCount
else if Key = 35 then
  n = ar.Count - 1
else if Key = 36 then
  n = 0
else if Key = 37 or Key = 38 then
  n = ItemIndex - 1
else if Key = 39 or Key = 40 then
  n = ItemIndex + 1
else if Key = 32 then
  if FItemIndex &gt; -1 then
  	SetChecked( FItemIndex, not GetChecked( FItemIndex ) )
  end if
  return
else
  return
end if
if n &gt;= ar.Count then
  n = ar.Count - 1
end if
if n &lt; 0 then
  n = 0
end if
if n &gt;= 0 and n &lt; ar.Count then
  ItemIndex = n
end if
end function
private function OnLButtonDown(Sender,X,Y)
d=UnitAtPoint( X, Y, 0 )
if d &lt;&gt; 0 then
  if d.Type = &apos;CheckBox&apos; then
    n = Group1.FindUnit( d )
	  ItemIndex = n + VScrollBar1.Pos
    Focused = true
    p = Point( X, Y )
    ViewToClient( p )
    ActiveSheet.ClientToView( p )
    e = d.UnitByName( &quot;Line1&quot; )
    if e.Contains( p.x, p.y ) then
      d.Checked = not d.Checked
      ck[ItemIndex] = d.Checked
    end if
  end if
end if
end function
private function OnLoad(Sender)
Reset()
end function
private function OnMouseWheel(Sender,Forward)
if Forward then
  VScrollBar1.Pos = VScrollBar1.Pos - 1
else
  VScrollBar1.Pos = VScrollBar1.Pos + 1
end if
end function
private function OnResize(Sender)
n=int( ( Height - 4 ) / FItemHeight )
while n &lt; Group1.UnitCount
	DeleteUnit( Group1.Units[Group1.UnitCount-1] )
wend
while n &gt; Group1.UnitCount
  d = CopyUnit( CheckBox1 )
  d.Visible = true
  Group1.Add( d )
wend
Element1.SetBounds( Left, Top, Width, Height )
CheckBox1.SetBounds( Left + 2, Top + 2, Width - 4, FItemHeight - 1 )
VScrollBar1.SetBounds( Left + Width - VScrollBar1.Width, Top + 1, VScrollBar1.Width, Height - 2 )
VScrollBar1.BringToFront( true )
Reset()
end function
private function Reset()
n = ar.Count - Group1.UnitCount
VScrollBar1.Max = n
VScrollBar1.Page = Group1.UnitCount
VScrollBar1.Visible = ( n &lt;&gt; 0 )
i=0
y=Top+2
while i &lt; Group1.UnitCount
	d=Group1.Units[i]
  w = Width - 4
  if VScrollBar1.Visible then
    w = w - VScrollbar1.Width
  end if
  d.SetBounds( Left + 2, y, w, FItemHeight - 1 )
  y = d.Top + FItemHeight
	i = i + 1
wend
VScrollBar1.OnChange( VScrollBar1 )
end function
public function SetChecked(AIndex,AValue)
if AIndex &gt; -1 then
	n=AIndex - VScrollBar1.Pos
	if n &gt;= 0 and n &lt; Group1.UnitCount then
		Group1.Units[n].Checked = AValue
	end if
	ck[AIndex]=AValue
end if
end function
private function SetEnable(AValue)
VScrollBar1.Enable = AValue
Enabled = AValue
end function
private function SetFocused(AValue)
if FFocused &lt;&gt; AValue then
  FFocused = AValue
  SetItemIndex( FItemIndex )
end if
end function
public function SetItem(AIndex,AValue)
if AIndex &gt;= 0 and AIndex &lt; ar.Count then
  ar[AIndex]=AValue
  if FUpdate then
    VScrollBar1.OnChange( VScrollBar1 )
  end if
end if
end function
private function SetItemHeight(AValue)
FItemHeight = AValue

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -