搜索文章:

编程  |  Java技术  |  Asp.net  |  Asp编程  |  VC/C++  |  Delphi  |  编程技术  |  技术问答

请教一个困扰了我很久的问题:WinForm程序被执行之后,……………


问题:  
       
      我在   vs.net   环境中新建了一个   form   窗体,在form   窗体的   [design]   时中,我先从  
       
      toolbox(工具箱)中拖出一个button放在form   窗体上,当我用鼠标点击button控件后,  
       
      因为button控件被选中了,所以button控件的周围会出现   八个   小白框,白框把button  
   
      控件包围住,小白框的底部还有一圈阴影。  
   
      然而,当:   winform程序被执行之后,点击它里面的   button   之后,button控件的周围不会出现  
   
      八个   小白框,请问用何种方式能做到:在程序运行中,button   控件被点击之后,可以出现八个  
   
      小白框????  
   
      谢谢!!!!

  • 参考文章:
  • 标准建模语言UML的动态建模机制
  • 系统约定:用UML描述工作流管理
  • Rational Rose和UML可视化建模基础
  • 通过CMM顶级评估后发展方向之一:软件外包
  • 通过CMM顶级评估后发展方向之三:咨询培训
  • 通过CMM顶级评估后发展方向之六:工具销售
  • 通过CMM顶级评估后发展方向之二:项目托管
  • 在中国开展CMM评估的几点建议
  • 实施CMM时必须解决的认识问题
  • 通过CMM顶级评估后发展方向之四:工程监理
  • 发表者:ajieboy

    运行态的控件当然不行了,可以生成一个设计态的按钮.看看sharpdevelop源码吧

    发表者:timiil

    现成的接口不是没有,但要跟envdte那些家伙打交道,就是说获取designerservice那些,比用gdi+实现麻烦得多。

    发表者:popcorn

    制作一个控件,重写onpaint方法,里面用状态判断  
      bool   isdesign;  
      protected   override   void   onpaint(painteventargs   e){  
          if(isdesign){  
          //画设计状态  
          }  
          else{  
          //画普通状态  
          }  
      }  
       
      isdesign改变的时候invalidate控件  
     

    发表者:ajieboy

    以前我作出来的就是这种效果。根据sharpdevelop来做的,控件不是平常new出来的控件的,是利用.net底层接口,用定义的host生成出来的,放在窗体上就有四周的方框。当时我看了一个来月的sharpdevelop源码才做出来,好好看看吧。

    发表者:jim3

    呵呵,楼主和我做的差不多啊,不知道是做什么用的,有空交流一下  
       
      在.net中我知道的实现有两种方式:  
      1.利用framework的自带的结构,有个例子,链接找不到了,用formdesigner查应该可以查到  
          sharpdevelop用的也是这个,不过比较复杂,不易看懂  
      2.自己动手实现,虽然有点麻烦,不过还是不难的,这个也有程序可以参考,有本书叫<基于组件的开发>  
          第10章就是移动的例子,不过书有点贵  
       
      我用的是第2种方式,他的好处是不依赖framework,很方便支持图形组件的移动等

    发表者:ajieboy

    唉,我当初也是看的头晕,不过公司原因没有做下去,怀念那段日子呀,真想坚持做下去。  
       
      http://www.52dotnet.com/form.jpg  
       
       
       
      host       =   new   defaultdesignerhost();  
      componentchangeservice   changeservice   =   new   componentchangeservice();  
      host.addservice(typeof(system.componentmodel.design.icomponentchangeservice),             changeservice);  
      host.addservice(typeof(system.componentmodel.design.idesigneroptionservice),               new   icsharpcode.sharpdevelop.formdesigner.services.designeroptionservice());  
      host.addservice(typeof(system.componentmodel.design.itypedescriptorfilterservice),   new   typedescriptorfilterservice());  
       
      host.addservice(typeof(system.drawing.design.ipropertyvalueuiservice),   new   propertyvalueuiservice());  
       
      extenderservice   extenderservice   =   new   extenderservice();  
      host.addservice(typeof(system.componentmodel.design.iextenderlistservice),         extenderservice);  
      host.addservice(typeof(system.componentmodel.design.iextenderproviderservice),extenderservice);  
       
      host.addservice(typeof(system.componentmodel.design.idesignerhost),                 host);  
      host.addservice(typeof(system.componentmodel.icontainer),                                     host.container);  
      host.addservice(typeof(system.componentmodel.design.idictionaryservice),       new   dictionaryservice());  
      host.addservice(typeof(system.componentmodel.design.ieventbindingservice),   new   eventbindingservice(host));  
      host.addservice(typeof(system.componentmodel.design.iselectionservice),         new   selectionservice(host));  
       
      host.addservice(typeof(system.componentmodel.design.serialization.inamecreationservice),     new   namecreationservice(host));  
      host.addservice(typeof(system.componentmodel.design.idesignereventservice),   new   designereventservice());  
       
      host.addservice(typeof(system.componentmodel.design.ireferenceservice),   new   referenceservice(host));  
       
       
      host.addservice(typeof(system.componentmodel.design.serialization.idesignerserializationservice),   new   formdesign.designerserializationservice(host));  
       
       
      //   add   toolbox   service  
      host.addservice(typeof(itoolboxservice),   listview1);  
       
      populatetoolbox(listview1);  
       
      host.activate();  
       
      // host.transactionclosed   +=   new   designertransactioncloseeventhandler(transactionfinished);  
       
      if   (designpanel   ==   null)    
      {  
      designpanel   =   new   designpanel(host);  
      }    
      else    
      {  
      designpanel.host   =   host;  
      }  
       
       
       
      // host.addservice(typeof(system.componentmodel.design.imenucommandservice),     new   menucommandservice(host,   designpanel));  
       
      host.addservice(typeof(designpanel),   designpanel);  
       
      host.addservice(typeof(system.componentmodel.design.imenucommandservice),     new   cmconfig.menucommandservice(host,   designpanel));  
       
       
      designpanel.location   =   new   point(0,   0);  
      designpanel.dock           =   dockstyle.fill;  
       
      // this.panel1.controls.add(designpanel);  
       
      listview1.designpanel   =   designpanel;

    .
     
     

     
    相关文章:
    © 2006   www.java-asp.net