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

📄 bcjq036.txt

📁 c++ builder 的一些txt文档
💻 TXT
字号:

C++ Builder开发者:程序员之家
var how_many_ads = 3;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
 
  
  
    
      
        
          
            首页   
              | 控件天堂 | 控件使用                   
              | 编程技巧                    
              |  源代码 |  编程工具 |        
               系统补丁 |  电子书籍 | 技术论坛                    
              |  相关链接                 
                           
                         
                       
                     
                     
                       
                         
                           
                             
                           
                 
       if (ad==1) {document.write(''+'');}               
       if (ad==2) {document.write(''+'');}               
       if (ad==3) {document.write(''+'');}               
                              
                           
                        
                                    
                        
                      
                    
                  
                  
                    
                      
                        
                          
                       
                     
var marqueecontents=''+scroll_text+''           
if (document.all)           
document.write(''+marqueecontents+'')           
function regenerate(){           
window.location.reload()           
}           
function regenerate2(){           
if (document.layers){           
setTimeout("window.onresize=regenerate",450)           
intializemarquee()           
}           
}           
function intializemarquee(){           
document.cmarquee01.document.cmarquee02.document.write(marqueecontents)           
document.cmarquee01.document.cmarquee02.document.close()           
thelength=document.cmarquee01.document.cmarquee02.document.height           
scrollit()           
}           
function scrollit(){           
if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){           
document.cmarquee01.document.cmarquee02.top-=speed           
setTimeout("scrollit()",100)           
}           
else{           
document.cmarquee01.document.cmarquee02.top=marqueeheight           
scrollit()           
}           
}           
window.onload=regenerate2           
                       
                         
                       
                     
                   
                 
                 
                   
                     
                       
                         
                           
                             
                               
                  当前位置
    
    
                    编程技巧            
                            
                          
                        
                        
                        
                          
                            
                              
                    CB的Form最小化时无动画的原因        
                          
                    
                      
                        
                          
                          Delphi & BCB 中的的主窗口都是TApplication,  
            一般情况下,这个窗口居于屏幕中间,大小为0x0。底部TaskBar上的按钮也是TApplication窗口。应用程序的主窗口如TForm1,不是TApplicaiton  
            的子窗口,但他不具有WS_EX_APPWINDOW的属性,所以不在TaskBar上产生Button。当最小化的时候,由于TApplication窗口是0x0的,所以如果有动化会很难看,所以VCL中采用SystemParametersInfo这个API使得最小化TApplication窗口无动化。至于TForm1,因为底部Taskbar上的Button不是他的,所以VCL中直接HIDE了TForm1。这样,使得整体上看起来无动化。
 
            可以在VCL的源码forms.pas中发现如下代码:
 
            procedure TApplication.Minimize;
 
            begin
 
            if not IsIconic(FHandle) then
 
            begin
 
            NormalizeTopMosts;
 
            SetActiveWindow(FHandle);
 
            ShowWinNoAnimate(FHandle, SW_MINIMIZE);
 
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
            if Assigned(FOnMinimize) then FOnMinimize(Self);
 
            end;
 
            end;
 
            procedure TApplication.Restore;
 
            begin
 
            if IsIconic(FHandle) then
 
            begin
 
            SetActiveWindow(FHandle);
 
            ShowWinNoAnimate(FHandle, SW_RESTORE);
 
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
            {以下省略}
 
            end;
 
            再看一下
 
            ShowWinNoAnimate:
 
            procedure ShowWinNoAnimate(Handle: HWnd; CmdShow: Integer);
 
            var
 
            Animation: Boolean;
 
            begin
 
            Animation := GetAnimation;
 
            if Animation then SetAnimation(False); (1)
 
            ^^^^^^^^^^^^^^^^^^^^^
 
            ShowWindow(Handle, CmdShow);
 
            if Animation then SetAnimation(True);
 
            end;
 
            再看一下 SetAnimation:
 
            procedure SetAnimation(Value: Boolean);
 
            var Info: TAnimationInfo;
 
            begin
 
            Info.cbSize := SizeOf(TAnimationInfo);
 
            BOOL(Info.iMinAnimate) := Value;
 
            SystemParametersInfo(SPI_SETANIMATION, SizeOf(Info), @Info, 0);
 
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
            原来在这里。
 
            end;
 
            让我们再看一下当TForm1要Minimize时他干什么。因为TForm是从TCustomForm  
            继承过来的,他自己没有响应WM_SYSCOMMAND的方法,所以使用的是  
            TCustomForm的。
 
            procedure TCustomForm.WMSysCommand(var Message: TWMSysCommand);
 
            begin
 
            if (Message.CmdType and $FFF0 = SC_MINIMIZE) and
 
            (Application.MainForm = Self) then
 
            Application.Minimize
 
            ^^^^^^^^^^^^^^^^^^^^
 
            这一句的执行结果是最小化了TApplication,隐藏了
 
            Form1。
 
            else
 
            inherited;
 
            end;
 
            你可以注释掉以上的(1)句,就会发现Tapplication最小化时有了动画,但很难看。
 
            哦有一个解决方法如下:
 
            首先是要用SetWindowLong将Form1变成WS_EX_APPWINDOW,但这样一来旧必须  
            隐藏Application窗口。
 
            使用ShowWindow(application.handle,SW_HIDE);另外,  
            我们还必须改VCL的源码。在Forms.pas中,
 
            将上面那个TCustomForm.WMSysCommand 注释掉if,只剩下inherited,这样,Form1在最小化时旧不会击活application的窗口了。
 
            具体改变方法如下。
 
            1.拷贝一个Forms.pas到当前目录,从Project Source中删除缺省的
 
            Forms单元, 然后将Forms.pas作为一个新单元加入到Project中。
 
            2.更改Project Source如下:
 
            program Project1;
 
            uses windows,
 
            ^^^^^^^^^
 
            Unit1 in 'Unit1.pas' {Form1},
 
            Forms in 'forms.pas';
 
            {$R *.RES}
 
            begin
 
            Application.Initialize;
 
            Application.CreateForm(TForm1, Form1);
 
            SetWindowLong(form1.handle,GWL_EXSTYLE,GetWindowLong(form1.handle,
 
            GWL_EXSTYLE) or WS_EX_APPWINDOW);
 
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
            form1.show;
 
            ^^^^^^^^^^^
 
            showwindow(application.handle,sw_hide);
 
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
            Application.Run;
 
            end.
 
            以上打了 ^ 的均为添加的代码。
 
            3.将Forms.pas中的TCustomForm.WMSysCommand更改为如下:大家也可以试一试不改的效果。
 
            procedure TCustomForm.WMSysCommand(var Message: TWMSysCommand);
 
            begin
 
            {
 
            if (Message.CmdType and $FFF0 = SC_MINIMIZE) and
 
            (Application.MainForm = Self) then
 
            Application.Minimize else
 
            }
 
            -------------------------------- 注释掉了。
 
            inherited;
 
            end;
 
            通过以上步骤,基本上旧可以实现动画缩放了。     
                             
                           
                               
                       
                             
                               
                             
                  if (ad==1) {document.write(''+'');}             
                  if (ad==2) {document.write(''+'');}             
                  if (ad==3) {document.write(''+'');}             
                                               
                             
                           
                         
                       
                  
                   
                     
                       
                     
                     
                         
                     
                   
                      
                    
                  
                
              
              
                
                  
                    
                      
            C++ Builder开发者®           
              2000年06月01日 站长:唐朝           
                     
                   
                 
               
               
                 
               
             
             
           
           
           
           

⌨️ 快捷键说明

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