委托哪里出问题? 200分 up都有!

musclecn 2007-06-01 01:49:32
ppc下开发。窗口login 里有个进度条,想在类1中调用这个进度条
public delegate void dgpross(int dq,int max);//定义委托
public static void pross(int d, int z)
{
login fg = new login();
if (fg.InvokeRequired)
{
fg.Invoke(new dgpross(pross), new object[] { d, z });

}
else
{
fg.pBar1.Minimum = 0;
fg.pBar1.Maximum = z;
if (fg.pBar1.Value <= fg.pBar1.Maximum)
{
fg.pBar1.Value = d;

}
}
}


类1 中a是socket当前接收到的字节数,调用委托:

if (a < 100)
{
login.dgpross d1 =new login.dgpross(login.pross);
d1(a, 100);
}

现在进度条没有反映!大家帮我看看哪里出问题了。
...全文
1011 88 打赏 收藏 转发到动态 举报
写回复
用AI写文章
88 条回复
切换为时间正序
请发表友善的回复…
发表回复
liubin911 2007-06-05
  • 打赏
  • 举报
回复
up
zyip 2007-06-05
  • 打赏
  • 举报
回复
多少分可以发200分的帖子
chuxue1342 2007-06-05
  • 打赏
  • 举报
回复
先顶再说!
Ivony 2007-06-05
  • 打赏
  • 举报
回复
名字乱七八糟,代码稀里糊涂,我就看见一个无限递归调用:


fg.Invoke(new dgpross(pross), new object[] { d, z });
你这里可是调用本身?
windykuang 2007-06-05
  • 打赏
  • 举报
回复
UP
mingtian200808 2007-06-05
  • 打赏
  • 举报
回复
还没真正用过
klxie_001 2007-06-05
  • 打赏
  • 举报
回复
还没真正用过,以后要关注这里了,多学多做。
Jinglecat 2007-06-05
  • 打赏
  • 举报
回复
先顶起再说
qnzn 2007-06-05
  • 打赏
  • 举报
回复
Up一
xiaoliangwh 2007-06-04
  • 打赏
  • 举报
回复
up
hplyl 2007-06-04
  • 打赏
  • 举报
回复
有点难度,只能帮你顶一下了
fw629 2007-06-04
  • 打赏
  • 举报
回复
┌──┐
│顶你│ ╭───────╮
 └──┘  ┏━━━━━━━┓ │ 既然有分, │
  ┏┓  ┏┫    |||┣┓∠ 这贴就顶了 │
  ┣┫  ┗┫━━ ┃ ━━┣┛ ╰───────╯
┏┳┫┣┳┓ ┃ ━━━━━ ┃
┃    ┃ ┗━━━┳━━━┛
┗━━━━┻━━━━▇▇▇┛ ()000o
          ┃ ┃  (````)
          ┃ ┃   )``/
          ┛ ┗━━(__/

ERPCoder 2007-06-04
  • 打赏
  • 举报
回复
以后有空定要细细解究...
wzd24 2007-06-04
  • 打赏
  • 举报
回复
没有见过这样写的!!
为什么要让Procss做两件事呢?
把它们分开来做成两个方法!
musclecn 2007-06-04
  • 打赏
  • 举报
回复
那应该如何写? 累计发分:350 一直没有解决。
zhnzzy 2007-06-04
  • 打赏
  • 举报
回复
if (fg.InvokeRequired)
{
fg.Invoke(new dgpross(pross), new object[] { d, z });

}
反射是不是有问题
spkl1 2007-06-04
  • 打赏
  • 举报
回复


1.你的调用是fg.invoke``委托函数一直在UI线程中运行`估计是这个原因``试试直接调用委托``或开子线程
2.委托函数没有return``加return试试
3.调用是否有循环
4.d1(a, 100)``a为字节数``是否越界``>100了?

水平有限``能想到的就这些``
Love_My 2007-06-04
  • 打赏
  • 举报
回复
总觉得委托是只再自定义控件会用一下.
cengjizuihao 2007-06-04
  • 打赏
  • 举报
回复
. ┌──┐
│顶你│ ╭───────╮
 └──┘  ┏━━━━━━━┓ │ 既然有分, │
  ┏┓  ┏┫    |||┣┓∠ 这贴就顶了 │
  ┣┫  ┗┫━━ ┃ ━━┣┛ ╰───────╯
┏┳┫┣┳┓ ┃ ━━━━━ ┃
┃    ┃ ┗━━━┳━━━┛
┗━━━━┻━━━━▇▇▇┛ ()000o
          ┃ ┃  (````)
          ┃ ┃   )``/
          ┛ ┗━━(__/
cengjizuihao 2007-06-04
  • 打赏
  • 举报
回复
up
加载更多回复(68)
hapter 1:Refactoring,a First Example 重构,第一个例子   The Starting Point 起点   The First Step in Refactoring 重构第一步   Decomposing and Redistributing the Statement Method 解并重组slalemenl方法   Replacing the Conditional Logic on Price Code with Polymorphism 用多态代替价格条件逻辑代码   Final Thoughts 结语  Chapter 2:Principles in Refactoring 重构原则   Defining Refactoring 何谓重构   Why Should You Refactor? 为何重构   When Should You Refactor? 何时重构   What Do I Tell My Manager? 怎样说服经理   Problems with Refactoring 重构的问题   Refactoring and Design 重构与设计   Refactoring and Performance 重构与性能   Where Did Refactoring Come From? 重构的起源  Chapter 3:Bad Smells in Code(by Kent Beck and Martin Fowler) 代码坏昧   Duplicated Code 重复代码   Long Method 过长方法   Large Class 过长类   Long Parameter List 过长参数列表   Divergent Change 发散式变化   Shotgun Surgery 霰弹式修改   Feature Envy 特性依恋   Data Clumps 数据泥团   Primitive Obsession 基本类型偏执   Switch Statements switch语句   Parallel Inheritance Hierarchies 平行继承体系   Lazy Class 冗余类   Speculative Generality 理论上的一般性   Temporary Field 临时字段   Message Chains 消息链   Middle Man 中间人   Inappropriate Intimacy 过度亲密   Alternative Classes with Different Interfaces 接口不同的等效类  Incomplete Library Class 不完整的库类   Data Class 数据类   Refused Bequest 拒绝继承   Comments 注释过多  Chapter 4:Building Tests 构建测试   The Value of Self-testing Code 自测试代码的重要性   The JUnit Testing Framework Junit测试框架   Adding More Tests 添加更多测试  Chapter 5:Toward a Catalog of Refactorings 重构目录   Format of the Refactorings 重构描述的格式   Finding References 寻找引用   How Mature Are These Refactorings? 这些重构的成熟度如何 Chapter 6:Composing Methods 组合方法   Extract Method 提取方法   Inline Method 内联方法   Inline Temp 内联临时变量   *Replace Temp with Query 用查询方法代替临时变量   Introduce Explaining Variable 引入解释性变量   Split Temporary Variable 离临时变量   *Remove Assignments to Parameters 去除参数赋值   Replace Method with Method Object 用方法对象代替方法   Substitute Algorithm 替换算法  Chapter 7:Moving Features Between Objects 在对象之间移动特性  *Move Method 移动方法   Move Field 移动字段   Extract Class 提取类   Inline Class 内联类   Hide Delegate 隐藏委托类   Remove Middle Man 去除中间人   Introduce Foreign Method 引入外加方法   *Introduce Local Extension 引入本地扩展类  Chapter 8:Organizing Data 组织数据   Self Encapsulate Field 自封装字段   Replace Data Value with Object 用对象代替数据值   Change Value to Reference 将值对象改为引用对象   Change Reference to Value 将引用对象改为值对象   Replace Array with Object 用对象代替数组   Duplicate Observed Data 重复被观察数据   *Change Unidirectional Associationto Bidirectional 将单向关联改为双向   Change Bidirectional Association to Unidirectional 将双向关联改为单向   *Replace Magic Number with Symbolic Constant 用字面常量代替魔数   Encapsulate Field 封装字段   Encapsulate Collection 封装集合   Replace Record with Data Class 用数据类代替记录   *ReplaceType Code with Class 用类代替类型码   Replace Type Code with Subclasses 用子类代替类型码   Replace Type Code with State/Strategy用State/Strategy 代替类型码   Replace Subclass with Fields 用字段代替子类  Chapter 9:Simplifying Conditional Expressions 简化条件语句   Decompose Conditional 解条件语句   Consolidate Conditional Expression 合并条件语句   Consolidate Duplicate Conditional Fragments 合并重复的条件片段   Remove Control Flag 去除控制标志   Replace Nested Conditional with Guard Clauses 用守卫语句代替嵌套条件语句   Replace Conditional with Polymorphism 用多态代替条件语句   Introduce Null Object 引入Null对象   Introduce Assertion 引入断言  Chapter 10:Making Method Calls Simpler 简化方法调用   Rename Method 重命名方法   Add Parameter 添加参数   Remove Parameter 去除参数   Separate query from Modifier 将查询方法与修改方法离   Parameterize Method 参数化方法   Replace Parameter with Explicit Methods 用显式方法代替参数  Preserve Whole Object 保持对象完整   Replace Parameter with Method 用方法代替参数   Introduce Parameter Object 引入参数对象   Remove Setting Method 去除设置方法   Hide Method 隐藏方法   Replace Constructor with Factory Method 用工厂方法代替构造器   Encapsulate Downcast 封装向下转型   Replace Error Code with Exception 用异常代替错误码   Replace Exception with Test 用测试代替异常  Chapter 11:Dealing with Generalization 处理泛化关系   Pull Up Field 上移字段   Pull UP Method 上移方法   Pull Up Constructor Body 上移构造器主体   Push Down Method 下移方法   Push Down Field 下移字段   Extract Subclass 提取子类   Extract Superclass 提取超类   Extract Interface 提取接口   Collapse Hierarchy 合并继承层次   Form Template Method 形成Template Method   Replace Inheritance with Delegation 用委托代替继承   Replace Delegation with Inheritance 用继承代替委托  Chapter 12:Big Refactorings(by Kent Beck and Martin Fowler) 大型重构   Tease Apart Inheritance 解继承层次   Convert Procedural Design to Objects 将过程式设计转换为面向对象   Separate Domain from Presentation 将领域逻辑与表现离   Extract Hierarchy 提取继承层次  Chapter 13:Refactoring,Reuse,and Reality(by William Opdyke) 重构,复用与现实   A Reality Check 现实的检验   Whv Are Developers Reluctant to Refactor Their Programs? 开发人员为何不愿重构程序   A Reality Check(Revisited) 再谈现实的检验   Resources and References for Refactoring 重构的资源和参考文献   Implications Regarding Software Reuse and Technology Transfer 对软件复用与技术传播的意义   A Final Note 结语   References 参考文献  Chapter 14:Refactoring Tools(by Don Roberts and John Brant) 重构工具   Refactoring with a Tool 使用工具重构   Technical Criteria for a Refactoring Tool 重构工具的技术标准   Practical Criteria for a Refactoring Tool 重构工具的实用标准   Wrap Up 结语  Chapter 15:Putting It All Together(by Kent Beck) 集大成  References参考文献  List of Soundbites 要点列表  Updates 更新内容  Index 索引
Chapter 1:Refactoring,a First Example 重构,第一个例子   The Starting Point 起点   The First Step in Refactoring 重构第一步   Decomposing and Redistributing the Statement Method 解并重组slalemenl方法   Replacing the Conditional Logic on Price Code with Polymorphism 用多态代替价格条件逻辑代码   Final Thoughts 结语  Chapter 2:Principles in Refactoring 重构原则   Defining Refactoring 何谓重构   Why Should You Refactor? 为何重构   When Should You Refactor? 何时重构   What Do I Tell My Manager? 怎样说服经理   Problems with Refactoring 重构的问题   Refactoring and Design 重构与设计   Refactoring and Performance 重构与性能   Where Did Refactoring Come From? 重构的起源  Chapter 3:Bad Smells in Code(by Kent Beck and Martin Fowler) 代码坏昧   Duplicated Code 重复代码   Long Method 过长方法   Large Class 过长类   Long Parameter List 过长参数列表   Divergent Change 发散式变化   Shotgun Surgery 霰弹式修改   Feature Envy 特性依恋   Data Clumps 数据泥团   Primitive Obsession 基本类型偏执   Switch Statements switch语句   Parallel Inheritance Hierarchies 平行继承体系   Lazy Class 冗余类   Speculative Generality 理论上的一般性   Temporary Field 临时字段   Message Chains 消息链   Middle Man 中间人   Inappropriate Intimacy 过度亲密   Alternative Classes with Different Interfaces 接口不同的等效类  Incomplete Library Class 不完整的库类   Data Class 数据类   Refused Bequest 拒绝继承   Comments 注释过多  Chapter 4:Building Tests 构建测试   The Value of Self-testing Code 自测试代码的重要性   The JUnit Testing Framework Junit测试框架   Adding More Tests 添加更多测试  Chapter 5:Toward a Catalog of Refactorings 重构目录   Format of the Refactorings 重构描述的格式   Finding References 寻找引用   How Mature Are These Refactorings? 这些重构的成熟度如何 Chapter 6:Composing Methods 组合方法   Extract Method 提取方法   Inline Method 内联方法   Inline Temp 内联临时变量   *Replace Temp with Query 用查询方法代替临时变量   Introduce Explaining Variable 引入解释性变量   Split Temporary Variable 离临时变量   *Remove Assignments to Parameters 去除参数赋值   Replace Method with Method Object 用方法对象代替方法   Substitute Algorithm 替换算法  Chapter 7:Moving Features Between Objects 在对象之间移动特性  *Move Method 移动方法   Move Field 移动字段   Extract Class 提取类   Inline Class 内联类   Hide Delegate 隐藏委托类   Remove Middle Man 去除中间人   Introduce Foreign Method 引入外加方法   *Introduce Local Extension 引入本地扩展类  Chapter 8:Organizing Data 组织数据   Self Encapsulate Field 自封装字段   Replace Data Value with Object 用对象代替数据值   Change Value to Reference 将值对象改为引用对象   Change Reference to Value 将引用对象改为值对象   Replace Array with Object 用对象代替数组   Duplicate Observed Data 重复被观察数据   *Change Unidirectional Associationto Bidirectional 将单向关联改为双向   Change Bidirectional Association to Unidirectional 将双向关联改为单向   *Replace Magic Number with Symbolic Constant 用字面常量代替魔数   Encapsulate Field 封装字段   Encapsulate Collection 封装集合   Replace Record with Data Class 用数据类代替记录   *ReplaceType Code with Class 用类代替类型码   Replace Type Code with Subclasses 用子类代替类型码   Replace Type Code with State/Strategy用State/Strategy 代替类型码   Replace Subclass with Fields 用字段代替子类  Chapter 9:Simplifying Conditional Expressions 简化条件语句   Decompose Conditional 解条件语句   Consolidate Conditional Expression 合并条件语句   Consolidate Duplicate Conditional Fragments 合并重复的条件片段   Remove Control Flag 去除控制标志   Replace Nested Conditional with Guard Clauses 用守卫语句代替嵌套条件语句   Replace Conditional with Polymorphism 用多态代替条件语句   Introduce Null Object 引入Null对象   Introduce Assertion 引入断言  Chapter 10:Making Method Calls Simpler 简化方法调用   Rename Method 重命名方法   Add Parameter 添加参数   Remove Parameter 去除参数   Separate query from Modifier 将查询方法与修改方法离   Parameterize Method 参数化方法   Replace Parameter with Explicit Methods 用显式方法代替参数  Preserve Whole Object 保持对象完整   Replace Parameter with Method 用方法代替参数   Introduce Parameter Object 引入参数对象   Remove Setting Method 去除设置方法   Hide Method 隐藏方法   Replace Constructor with Factory Method 用工厂方法代替构造器   Encapsulate Downcast 封装向下转型   Replace Error Code with Exception 用异常代替错误码   Replace Exception with Test 用测试代替异常  Chapter 11:Dealing with Generalization 处理泛化关系   Pull Up Field 上移字段   Pull UP Method 上移方法   Pull Up Constructor Body 上移构造器主体   Push Down Method 下移方法   Push Down Field 下移字段   Extract Subclass 提取子类   Extract Superclass 提取超类   Extract Interface 提取接口   Collapse Hierarchy 合并继承层次   Form Template Method 形成Template Method   Replace Inheritance with Delegation 用委托代替继承   Replace Delegation with Inheritance 用继承代替委托  Chapter 12:Big Refactorings(by Kent Beck and Martin Fowler) 大型重构   Tease Apart Inheritance 解继承层次   Convert Procedural Design to Objects 将过程式设计转换为面向对象   Separate Domain from Presentation 将领域逻辑与表现离   Extract Hierarchy 提取继承层次  Chapter 13:Refactoring,Reuse,and Reality(by William Opdyke) 重构,复用与现实   A Reality Check 现实的检验   Whv Are Developers Reluctant to Refactor Their Programs? 开发人员为何不愿重构程序   A Reality Check(Revisited) 再谈现实的检验   Resources and References for Refactoring 重构的资源和参考文献   Implications Regarding Software Reuse and Technology Transfer 对软件复用与技术传播的意义   A Final Note 结语   References 参考文献  Chapter 14:Refactoring Tools(by Don Roberts and John Brant) 重构工具   Refactoring with a Tool 使用工具重构   Technical Criteria for a Refactoring Tool 重构工具的技术标准   Practical Criteria for a Refactoring Tool 重构工具的实用标准   Wrap Up 结语  Chapter 15:Putting It All Together(by Kent Beck) 集大成  References参考文献  List of Soundbites 要点列表  Updates 更新内容  Index 索引
Chapter 1:Refactoring,a First Example 重构,第一个例子   The Starting Point 起点   The First Step in Refactoring 重构第一步   Decomposing and Redistributing the Statement Method 解并重组slalemenl方法   Replacing the Conditional Logic on Price Code with Polymorphism 用多态代替价格条件逻辑代码   Final Thoughts 结语  Chapter 2:Principles in Refactoring 重构原则   Defining Refactoring 何谓重构   Why Should You Refactor? 为何重构   When Should You Refactor? 何时重构   What Do I Tell My Manager? 怎样说服经理   Problems with Refactoring 重构的问题   Refactoring and Design 重构与设计   Refactoring and Performance 重构与性能   Where Did Refactoring Come From? 重构的起源  Chapter 3:Bad Smells in Code(by Kent Beck and Martin Fowler) 代码坏昧   Duplicated Code 重复代码   Long Method 过长方法   Large Class 过长类   Long Parameter List 过长参数列表   Divergent Change 发散式变化   Shotgun Surgery 霰弹式修改   Feature Envy 特性依恋   Data Clumps 数据泥团   Primitive Obsession 基本类型偏执   Switch Statements switch语句   Parallel Inheritance Hierarchies 平行继承体系   Lazy Class 冗余类   Speculative Generality 理论上的一般性   Temporary Field 临时字段   Message Chains 消息链   Middle Man 中间人   Inappropriate Intimacy 过度亲密   Alternative Classes with Different Interfaces 接口不同的等效类  Incomplete Library Class 不完整的库类   Data Class 数据类   Refused Bequest 拒绝继承   Comments 注释过多  Chapter 4:Building Tests 构建测试   The Value of Self-testing Code 自测试代码的重要性   The JUnit Testing Framework Junit测试框架   Adding More Tests 添加更多测试  Chapter 5:Toward a Catalog of Refactorings 重构目录   Format of the Refactorings 重构描述的格式   Finding References 寻找引用   How Mature Are These Refactorings? 这些重构的成熟度如何 Chapter 6:Composing Methods 组合方法   Extract Method 提取方法   Inline Method 内联方法   Inline Temp 内联临时变量   *Replace Temp with Query 用查询方法代替临时变量   Introduce Explaining Variable 引入解释性变量   Split Temporary Variable 离临时变量   *Remove Assignments to Parameters 去除参数赋值   Replace Method with Method Object 用方法对象代替方法   Substitute Algorithm 替换算法  Chapter 7:Moving Features Between Objects 在对象之间移动特性  *Move Method 移动方法   Move Field 移动字段   Extract Class 提取类   Inline Class 内联类   Hide Delegate 隐藏委托类   Remove Middle Man 去除中间人   Introduce Foreign Method 引入外加方法   *Introduce Local Extension 引入本地扩展类  Chapter 8:Organizing Data 组织数据   Self Encapsulate Field 自封装字段   Replace Data Value with Object 用对象代替数据值   Change Value to Reference 将值对象改为引用对象   Change Reference to Value 将引用对象改为值对象   Replace Array with Object 用对象代替数组   Duplicate Observed Data 重复被观察数据   *Change Unidirectional Associationto Bidirectional 将单向关联改为双向   Change Bidirectional Association to Unidirectional 将双向关联改为单向   *Replace Magic Number with Symbolic Constant 用字面常量代替魔数   Encapsulate Field 封装字段   Encapsulate Collection 封装集合   Replace Record with Data Class 用数据类代替记录   *ReplaceType Code with Class 用类代替类型码   Replace Type Code with Subclasses 用子类代替类型码   Replace Type Code with State/Strategy用State/Strategy 代替类型码   Replace Subclass with Fields 用字段代替子类  Chapter 9:Simplifying Conditional Expressions 简化条件语句   Decompose Conditional 解条件语句   Consolidate Conditional Expression 合并条件语句   Consolidate Duplicate Conditional Fragments 合并重复的条件片段   Remove Control Flag 去除控制标志   Replace Nested Conditional with Guard Clauses 用守卫语句代替嵌套条件语句   Replace Conditional with Polymorphism 用多态代替条件语句   Introduce Null Object 引入Null对象   Introduce Assertion 引入断言  Chapter 10:Making Method Calls Simpler 简化方法调用   Rename Method 重命名方法   Add Parameter 添加参数   Remove Parameter 去除参数   Separate query from Modifier 将查询方法与修改方法离   Parameterize Method 参数化方法   Replace Parameter with Explicit Methods 用显式方法代替参数  Preserve Whole Object 保持对象完整   Replace Parameter with Method 用方法代替参数   Introduce Parameter Object 引入参数对象   Remove Setting Method 去除设置方法   Hide Method 隐藏方法   Replace Constructor with Factory Method 用工厂方法代替构造器   Encapsulate Downcast 封装向下转型   Replace Error Code with Exception 用异常代替错误码   Replace Exception with Test 用测试代替异常  Chapter 11:Dealing with Generalization 处理泛化关系   Pull Up Field 上移字段   Pull UP Method 上移方法   Pull Up Constructor Body 上移构造器主体   Push Down Method 下移方法   Push Down Field 下移字段   Extract Subclass 提取子类   Extract Superclass 提取超类   Extract Interface 提取接口   Collapse Hierarchy 合并继承层次   Form Template Method 形成Template Method   Replace Inheritance with Delegation 用委托代替继承   Replace Delegation with Inheritance 用继承代替委托  Chapter 12:Big Refactorings(by Kent Beck and Martin Fowler) 大型重构   Tease Apart Inheritance 解继承层次   Convert Procedural Design to Objects 将过程式设计转换为面向对象   Separate Domain from Presentation 将领域逻辑与表现离   Extract Hierarchy 提取继承层次  Chapter 13:Refactoring,Reuse,and Reality(by William Opdyke) 重构,复用与现实   A Reality Check 现实的检验   Whv Are Developers Reluctant to Refactor Their Programs? 开发人员为何不愿重构程序   A Reality Check(Revisited) 再谈现实的检验   Resources and References for Refactoring 重构的资源和参考文献   Implications Regarding Software Reuse and Technology Transfer 对软件复用与技术传播的意义   A Final Note 结语   References 参考文献  Chapter 14:Refactoring Tools(by Don Roberts and John Brant) 重构工具   Refactoring with a Tool 使用工具重构   Technical Criteria for a Refactoring Tool 重构工具的技术标准   Practical Criteria for a Refactoring Tool 重构工具的实用标准   Wrap Up 结语  Chapter 15:Putting It All Together(by Kent Beck) 集大成  References参考文献  List of Soundbites 要点列表  Updates 更新内容  Index 索引

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧