<?xml version="1.0" encoding="utf-8"?>
<vg version="800" range="0,0,473,407" caption="设计和运行的区别" bordericons="1" borderstyle="0" scrollbars="0" backcolor="$8000000F" papervisible="false">
<sheet name="sheet1" visible="false">
<text name="text1" origin="18,26" bounds="16,16,56,32" fontname="宋体" fontsize="12" textalign="1" text="设计：" autosize="true"/>
<text name="text2" origin="18,202" bounds="16,192,56,208" fontname="宋体" fontsize="12" textalign="1" text="运行：" autosize="true"/>
<SubWindow name="SubWindow1" origin="181,137" bounds="16,32,456,184">
<rect name="Rect1" origin="16,32" bounds="16,32,456,184" linetype="0"/>
<programe>
<!--
property Doc read GetDoc visible false 
private function GetDoc()
return Control
end function
private function Initialize(Sender)
Control=0
end function
public function LoadFile(AFileName,ADesign)
if Control <> 0 then
  Control.Free()
end if
Control = Create( AFileName, true, ADesign )
Control.BorderStyle = 1
OnResize( This )
Control.Show()
end function
private function OnDestroy(Sender)
if Control <> 0 then
  Control.Free()
end if
end function
private function OnHide(Sender)
if Control <> 0 then
	Control.Hide()
end if
end function
private function OnMove(Sender)
OnResize( Sender )
end function
private function OnResize(Sender)
Rect1.SetBounds( Left, Top, Width, Height )
if Control <> 0 then
  Control.SetBounds( Left, Top, Width, Height )
end if
end function
private function OnShow(Sender)
if Control <> 0 then
	Control.Show()
end if
end function
-->
</programe>
</SubWindow>
<SubWindow name="SubWindow2" origin="429,153" bounds="16,208,456,360">
<rect name="Rect1" origin="264,48" bounds="16,208,456,360" linetype="0"/>
<programe>
<!--
property Doc read GetDoc visible false 
private function GetDoc()
return Control
end function
private function Initialize(Sender)
Control=0
end function
public function LoadFile(AFileName,ADesign)
if Control <> 0 then
  Control.Free()
end if
Control = Create( AFileName, true, ADesign )
Control.BorderStyle = 1
OnResize( This )
Control.Show()
end function
private function OnDestroy(Sender)
if Control <> 0 then
  Control.Free()
end if
end function
private function OnHide(Sender)
if Control <> 0 then
	Control.Hide()
end if
end function
private function OnMove(Sender)
OnResize( Sender )
end function
private function OnResize(Sender)
Rect1.SetBounds( Left, Top, Width, Height )
if Control <> 0 then
  Control.SetBounds( Left, Top, Width, Height )
end if
end function
private function OnShow(Sender)
if Control <> 0 then
	Control.Show()
end if
end function
-->
</programe>
</SubWindow>
<button name="button1" origin="213,379" bounds="184,368,280,390" Caption="关闭" Default="false" Enable="true" Focused="false">
<rect name="rect3" origin="213.5,377.5" bounds="185,369,280,390" visible="false" backcolor="$97E5" frontcolor="$CFF0FF" pattern="244" linetype="0" linewidth="0"/>
<text name="text1" origin="190.7,380.3" bounds="185,369,280,390" backcolor="$E7D7D6" frontcolor="$FDFDFD" pattern="244" fontname="宋体" fontsize="12" fontcolor="$80000012" borderinterval="0" text="关闭"/>
<rect name="Rect2" origin="215,380" bounds="186,370,278,388" linetype="0" linewidth="0"/>
<line name="line1" origin="184,368" linecolor="$743C00" endcap="1" points="186,368,6 278,368,2 280,370,2 280,388,2 278,390,2 186,390,2 184,388,2 184,370,2 186,368,3"/>
<programe>
<!--
property Caption read FCaption write SetCaption
property Default read FDefault write FDefault editor Bool
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='Button'
FDefault = false
end function
published function OnClick(Sender)
Close( 0 )
end function
public function OnKeyDown(Sender,Key)
if Key = 37 or Key = 38 then
  i=0
  prior = 0
  last = 0
  t = 0
  while i < 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 <> 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 < 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 <> 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 <> 0 then
    next.Focused = true
  else
    first.Focused = true
  end if
else if ( Key = 32 ) or ( Key = 13 ) then
  OnClick( Sender )
else
  s = '(' + chr( Key ) + ')'
  if At( s, Caption ) > 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 > Width - 6 then
  Width = n + 6
end if
if Height < 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 < Parent.UnitCount
    d = Parent.Units[i]
    if d <> this and d.HasProperty( 'Focused' ) 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
  Text1.BackColor = $E7D7D6
  Text1.FrontColor = $FDFDFD
  Rect3.Visible = false
  Rect2.LineType = 0
end if
Text1.SetBounds( Left + 1, Top + 1, Width - 1, Height - 1 )
FFocused=AValue
end function
-->
</programe>
</button>
<programe>
<!--
private function OnLoad(Sender)
SubWindow1.LoadFile( ExtractFilePath( FileName ) + "cmcontrols.tbl", true )
SubWindow2.LoadFile( ExtractFilePath( FileName ) + "cmcontrols.tbl", false )
end function
-->
</programe>
</sheet>
</vg>
