社区
C#
帖子详情
类方面的问题
cs3005
2005-08-17 09:24:44
我想写个类,改变我窗口上的控件的属性。
如何改变
...全文
75
4
打赏
收藏
类方面的问题
我想写个类,改变我窗口上的控件的属性。 如何改变
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
cocainy
2005-08-17
打赏
举报
回复
using System;
using System.Windows.Forms;
namespace WindowsApp
{
/// <summary>
/// Timer 的摘要说明。
/// </summary>
public class MyTimer
{
private System.Timers.Timer theTimer;
public System.IntPtr handleTextBox;
public double Interval
{
get{return this.theTimer.Interval;}
set{this.theTimer.Interval=value;}
}
public bool Enabled
{
get{return this.theTimer.Enabled;}
set{this.theTimer.Enabled=value;}
}
public MyTimer()
{
//
// TODO: 在此处添加构造函数逻辑
//
//
//Timer
//
//
this.theTimer = new System.Timers.Timer();
this.theTimer.Interval = 1000;
this.theTimer.Enabled = false;
this.theTimer.Elapsed += new System.Timers.ElapsedEventHandler(this.theTimer_Elapsed);
}
private void theTimer_Elapsed(object sender,System.Timers.ElapsedEventArgs e)
{
TextBox textBox = (TextBox)FrmMain.FromHandle(this.handleTextBox);
textBox.Text += e.SignalTime.ToString()+"\r\n";
//Form1.ActiveForm.Opacity = 0.50;
//Form1.ActiveForm.Top -= 10;
MessageBox.Show("时间到啦!","提醒",MessageBoxButtons.OKCancel,MessageBoxIcon.Information,MessageBoxDefaultButton.Button1);
//创建一个线程
}
}
}
cocainy
2005-08-17
打赏
举报
回复
参见以下实例:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using ScheduleService;
namespace WindowsApp
{
/// <summary>
/// FrmMain 的摘要说明。
/// </summary>
public class FrmMain : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
public System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label lblTime;
private System.Windows.Forms.Button button3;
private MyTimer theTimer ;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public FrmMain()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.lblTime = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.theTimer = new MyTimer();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(24, 8);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 32);
this.button1.TabIndex = 0;
this.button1.Text = "TestProcess";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(136, 8);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(80, 32);
this.button2.TabIndex = 1;
this.button2.Text = "TestLog";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(40, 72);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBox1.Size = new System.Drawing.Size(520, 376);
this.textBox1.TabIndex = 2;
this.textBox1.Text = "";
//
// lblTime
//
this.lblTime.Location = new System.Drawing.Point(272, 16);
this.lblTime.Name = "lblTime";
this.lblTime.Size = new System.Drawing.Size(248, 23);
this.lblTime.TabIndex = 3;
//
// button3
//
this.button3.Location = new System.Drawing.Point(24, 40);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(80, 32);
this.button3.TabIndex = 4;
this.button3.Text = "Run Timer";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
//theTimer
//
this.theTimer.Enabled = false;
//
// FrmMain
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(688, 494);
this.Controls.Add(this.button3);
this.Controls.Add(this.lblTime);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "FrmMain";
this.Text = "FrmMain";
this.Load += new System.EventHandler(this.FrmMain_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new FrmMain());
}
private void button2_Click(object sender, System.EventArgs e)
{
//LogAccess.WriteLog("Test","TestButton","BeginToWrite");
lblTime.Text = DateTime.Now.ToString("yyyyMMddHHmmss");
lblTime.Text += "|"+DateTime.Now.ToString();
}
private void FrmMain_Load(object sender, System.EventArgs e)
{
//
}
private void button1_Click(object sender, System.EventArgs e)
{
ThreadManager tm=new ThreadManager();
tm.StartProcess();
}
private void button3_Click(object sender, System.EventArgs e)
{
theTimer.handleTextBox = this.textBox1.Handle;
theTimer.Interval = 2000;
theTimer.Enabled = !theTimer.Enabled;
}
}//the END of FrmMain
}//the END of NameSpace
lovewindy
2005-08-17
打赏
举报
回复
把引用传进去,然后在里面就像操作那个控件一样操作传进来的引用,要改什么样就改什么
jinjazz
2005-08-17
打赏
举报
回复
传个控件引用给你的类,然后改啊
自己动手,实现《天气之子》滤镜REDUX
传统图像处理算法进行“天空分割”存在精度
问题
,导致最终融合的效果普通。为了有效解决这类
问题
,本课程将基于Pytorch实现天空对象的语义分割,并进一步扩展到环境构建、数据集准备、参数调节和运行部署等
方面
内容,最终能够实现远超传统算法的运行效果! 具体内容包括: 1、基于Unet语义分割的基本原理、环境构建、参数调节等2、一种有效的天空分割数据集准备方法,并且获得数据集3、基于OpenCV的Pytorch模型部署方法4、融合效果极好的 SeamlessClone 技术5、饱和度调整、颜色域等基础图像处理知识和编码技术
机器学习一般用来解决哪些
方面
的
问题
?
随着互联网的不断发展,程序员在学习编程语言的种类上也开始偏向于人工智能AI技术
方面
的知识学习了,下面我们就一起来了解一下,关于机器学习我们都需要解决哪些
问题
。 机器学习一般用来解决哪些
方面
的
问题
? 要问机器学习主要能解决什么
问题
,抛开各式各样的机器学习流派和层出不穷的算法模型不谈,机器学习主要解决的是两类
问题
:监督学习和无监督学习。掌握机器学习,主要就是学习这两类
问题
,掌握解决这两类
问题
的基本思路...
二类分类
问题
评价指标
1. 准确率 评价分类
问题
的性能的指标一般是分类准确率,其定义是对于给定的数据,分类正确的样本数占总样本数的比例。但是这一指标在Unbalanced的数据上表现很差。比如说我的样本有990个正样本,10个负样本,我直接把所有样本都预测为正,我的准确率为99%,居然有这么高得准确率,但我的分类方法实际是非常不具有说服力的。 2. 精确率和召回率 对于二分类
问题
常用的评价指标是精确率和召回率
常用的分类
问题
中的损失函数
原文地址:https://redstonewill.com/1584/ 前言 在监督式机器学习中,无论是回归
问题
还是分类
问题
,都少不了使用损失函数(Loss Function)。**损失函数(Loss Function)**是用来估量模型的预测值 f(x) 与真实值 y 的不一致程度。若损失函数很小,表明机器学习模型与数据真实分布很接近,则模型性能良好;若损失函数很大,表明机器学习模型与数据真实分...
Visual Studio 2017 用类向导添加MFC类,直接无法添加MFC类;CFormView相关
问题
---
问题
解决
之前在学习C++相关
方面
的知识,用的软件是VS2017,发现在对项目添加MFC类时出现了
问题
,导致程序无法正确运行。 直接对项目点击添加类,出现的是以下这个界面,如果自行输入类名,你会发现基类是无法自动跳出的,而这个类是一个普通类,不是MFC类。 点击项目---->添加新项---->MFC---->MFC类---->写好就类名,选择基类,就大功告成了。 1、点击...
C#
110,571
社区成员
642,565
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章