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

📄 controls.xml

📁 cShap控制云台运动
💻 XML
📖 第 1 页 / 共 5 页
字号:
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>
<group name="Group1">
</group>
<programe>
public function AddItem(AValue)
n = ar.Count
ar[n]=AValue
if FUpdate then
  Reset()
end if
return n
end function
public function BeginUpdate()
FUpdate = false
end function
public function Clear()
ar.Clear()
if FUpdate then
  Reset()
end if
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)
  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 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
private function Initialize(Sender)
ar=array(10)
FItemIndex=-1
FUpdate = true
FItemHeight = 16
FFocused = false
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
  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
  n = Group1.FindUnit( d )
  if n &gt; -1 then
    ItemIndex = n + VScrollBar1.Pos
    Focused = true
    Sender.Tag = 1
  end if
end if
end function
private function OnLButtonUp(Sender,X,Y)
Sender.Tag = 0
end function
private function OnLoad(Sender)
VScrollBar1.OnChange( VScrollBar1 )
end function
private function OnMouseMove(Sender,X,Y)
if Sender.Tag = 1 then
	d=UnitAtPoint( X, Y, 0 )
	if d &lt;&gt; 0 then
	  if d.ClassId = 1 then
	    n = Group1.FindUnit( d )
	    ItemIndex = n + VScrollBar1.Pos
	  end if
	end if
end if
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( Item1 )
  d.Visible = true
  Group1.Add( d )
wend
Element1.SetBounds( Left, Top, Width, Height )
Item1.SetBounds( Left + 2, Top + 2, Width - 4, FItemHeight - 1 )
VScrollBar1.SetBounds( Right - 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 &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 = y + FItemHeight
	i = i + 1
wend
VScrollBar1.OnChange( VScrollBar1 )
end function
private function SetEnable(AValue)
VScrollBar1.Enable = AValue
Enabled = AValue
end function
private function SetFocused(AValue)
FFocused = AValue
SetItemIndex( FItemIndex )
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
OnResize( this )
end function
private function SetItemIndex(AValue)
if ( AValue &gt;= -1 ) and ( AValue &lt; ar.Count ) then
  i=0
  while i &lt; Group1.UnitCount
    d = Group1.Units[i]
    d.Selected = false
    d.Focused = false
    i=i+1
  wend
  FItemIndex = AValue
  if FItemIndex &lt; VScrollBar1.Pos then
	  VScrollBar1.Pos = FItemIndex
  else if FItemIndex - VScrollBar1.Pos &gt;= Group1.UnitCount then
    VScrollBar1.Pos = FItemIndex - Group1.UnitCount + 1
  end if
  i=FItemIndex-VScrollBar1.Pos
  if( i &gt;= 0 ) and ( i &lt; Group1.UnitCount ) then
    d=Group1.Units[i]
    d.Selected = true
    if FFocused then
      d.Focused = true
    end if
  end if
end if
end function
private function SetItems(AValue)
ar.Text=AValue
if FUpdate then
  Reset()
end if
end function
</programe>
</sheet>
<sheet name="StatusPanel" bounds="7,36,230,53">
<text name="Text1" bounds="7,36,230,53" origin="95,48" border="$0" fontname="瀹嬩綋" fontsize="12" wordwrap="false" multiline="false" textalign="4"/>
<line name="Line1" origin="95,84" linecolor="$80000010">
<points>
7,53,6
7,36,2
230,36,2
</points>
</line>
<line name="Line2" origin="95,84" linecolor="$80000014">
<points>
7,53,6
230,53,2
230,36,2
</points>
</line>
</sheet>
<sheet name="Button" bounds="15,15,73,33" origin="60,24" Default="false">
<rect name="rect3" bounds="1,1,58,18" origin="29.5,9.5" visible="false" linetype="0" linewidth="0" backcolor="$97E5" frontcolor="$CFF0FF" pattern="244"/>
<text name="text1" bounds="3,3,55,15" origin="6.7,12.3" backcolor="$E7D7D6" frontcolor="$FDFDFD" pattern="244" border="$0" fontname="瀹嬩綋" fontsize="12" borderinterval="0" text="Button"/>
<rect name="Rect2" bounds="2,2,56,16" origin="31,12" linetype="0" linewidth="0"/>
<line name="line1" linecolor="$743C00" endcap="1">
<points>
1,0,6
57,0,2
58,1,2
58,17,2
57,18,2
1,18,2
0,17,2
0,1.2,2
0.95,0,3
</points>
</line>
<programe>
property Caption read FCaption write SetCaption
property Enable read GetEnable write SetEnable editor Bool
property Focused read FFocused write SetFocused editor Bool
private function GetEnable()
return Enabled
end function
private function Initialize(Sender)
FFocused=false
FCaption=&apos;Button&apos;
end function
published function OnClick(Sender)
end function
public function OnKeyDown(Sender,Key)
if Key = 37 or Key = 38 then
  i=0
  prior = 0
  last = 0
  t = 0
  while i &lt; Parent.UnitCount
    d = Parent.Units[i]
    if d.Type = Type and d.Id = Id then
      if d.Enable then
        if d = this then
          prior = t
        else
          t = d
        end if
        last = d
      end if
    end if
    i = i + 1
  wend
  if prior &lt;&gt; 0 then
    prior.Focused = true
  else
    last.Focused = true
  end if
else if Key = 39 or Key = 40 then
  i=0
  first = 0
  next = 0
  t = 0
  while i &lt; Parent.UnitCount
    d = Parent.Units[i]
    if d.Type = Type and d.Id = Id then
      if d.Enable then
        if d = this then
          t = d
        else if t &lt;&gt; 0 then
          next = d
          t = 0
        end if
        if first = 0 then
          first = d
        end if
      end if
    end if
    i = i + 1
  wend
  if next &lt;&gt; 0 then
    next.Focused = true
  else
    first.Focused = true
  end if
else if ( Key = 32 ) or ( Key = 13 ) then
  OnClick( Sender )
else
  s = &apos;(&apos; + chr( Key ) + &apos;)&apos;
  if At( s, Caption ) &gt; 0 then
    Focused = true
    OnClick( Sender )
  end if
end if
end function
private function OnLButtonDown(Sender,X,Y)
Focused = true
end function
private function OnLButtonUp(Sender,X,Y)
Text1.BackColor = $E7D7D6
Text1.FrontColor = $FDFDFD
end function
private function OnMouseEnter(Sender)
rect3.Visible = true
Text1.SetBounds( Left + 3, Top + 3, Width - 5, Height - 5 )
end function
private function OnMouseExit(Sender)
rect3.Visible = false
Text1.SetBounds( Left + 1, Top + 1, Width - 1, Height - 1 )
end function
private function OnResize(Sender)
n=Text1.GetTextWidth( FCaption ) + 6
if n &gt; Width - 6 then
  Width = n + 6
end if
if Height &lt; 22 then
  Height = 22
end if
Line1.x[0] = Left + 2;Line1.Y[0] = Top
Line1.x[1] = Right - 2;Line1.Y[1] = Top
Line1.x[2] = Right;Line1.Y[2] = Top + 2
Line1.x[3] = Right;Line1.Y[3] = Bottom - 2
Line1.x[4] = Right - 2;Line1.Y[4] = Bottom
Line1.x[5] = Left + 2;Line1.Y[5] = Bottom
Line1.x[6] = Left;Line1.Y[6] = Bottom - 2
Line1.x[7] = Left;Line1.Y[7] = Top + 2
Line1.x[8] = Left + 2;Line1.Y[8] = Top
Line1.Refresh()
Rect2.SetBounds( Left + 2, Top + 2, Width - 4, Height - 4 )
Rect3.SetBounds( Left + 1, Top + 1, Width - 1, Height - 1 )
if Rect3.Visible then
  Text1.SetBounds( Left + 3, Top + 3, Width - 5, Height - 5 )
else
  Text1.SetBounds( Left + 1, Top + 1, Width - 1, Height - 1 )
end if
end function
private function SetCaption(AValue)
FCaption=AValue
Text1.Text=AValue
OnResize( this )
end function
private function SetEnable(AValue)
Enabled = AValue
if AValue then
  Text1.FontColor = $80000012
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
  Text1.BackColor = $FDFDFD
  Text1.FrontColor = $E7D7D6
  Rect3.Visible = false
  Rect2.LineType = 15
else

⌨️ 快捷键说明

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