小编gbk*_*gbk的帖子

如何使Button的返回值为"OK"

使用c#,WinForms,.net FrameWork 4.5 VS 2012

尝试创建小程序.目前尝试使用类似的东西

 private void buttonAddNewEntry_Click(object sender, EventArgs e)
    {
        AddNewEntry a = new AddNewEntry();
        if (a.ShowDialog() == DialogResult.OK)
        {
            carInStock.Add(a.myCar);
        }
        UpdateGrid();
    }
Run Code Online (Sandbox Code Playgroud)

但是在我的WinForm中我没有按下OK,问题 - 如何将我的按钮的返回结果设置为OK?

.net c# return-value winforms visual-studio-2012

1
推荐指数
1
解决办法
363
查看次数

ildasm和.ldarg - 里面发生了什么?

使用c#,Net framework 4.5 notePad

尝试理解CIL(IL)语言的原理.目前创建2个简单方法

 public static Int32 Add(Int32 a, Int32 b)
    {
        return a + b;
    }
    public Int32 Add1(Int32 a, Int32 b)
    {
        return a + b;
    }
Run Code Online (Sandbox Code Playgroud)

在ildasm.exe打开后得到了

ildasm结果

为什么在Add方法CIL中使用堆栈0中的加载参数和堆栈1中的第二个 - 在方法Add1中使用堆栈0或者我错过了什么?

.net c# il cil visual-studio-2012

1
推荐指数
1
解决办法
392
查看次数

无法注册“捆绑包标识符”

几天前,我React Native's在 Udemy 上购买了课程。现在我对XCode中实现的配置有一个问题。

在此输入图像描述

我该如何修复它?

xcode ios bundle-identifier

1
推荐指数
1
解决办法
3298
查看次数

如何正确地结束所有程序的过程

我的程序有事件onClosing- 只是隐藏它.但我还需要实现程序的关闭 - 尝试使用任务栏通知项的上下文菜单.

码:

    private void FormMainForm_FormClosing(object sender, FormClosingEventArgs e)
    {
        //canceling closing form
        e.Cancel = true;
        //hide form 
        this.WindowState = FormWindowState.Minimized;
    }

    private void toolStripMenuItem1_Click(object sender, EventArgs e)
    {
        //hide icon from tray
        notifyIcon.Visible = false;
        //get current process
        Process proc = Process.GetCurrentProcess();
        //kill it and close programm
        proc.Kill();
    }
Run Code Online (Sandbox Code Playgroud)

但也读了一下,kill()终止所有工作并"杀死"进程,认为关闭程序可能不正常 - 某些数据可能被破坏或未被存储

还尝试使用proc.closeMainWindow();proc.Close()-但PROGRAMM没有影响-关闭所有窗口,但过程仍在运行.

问题:.kill()这是关闭程序的正确方法,还是另一种方法呢?

c# kill process winforms

0
推荐指数
1
解决办法
1155
查看次数

CAShapeLayer 的位置不正确

我有一个UIViewviewProgress. 它是图像中的白框。我想要一个圆形的进度条,也就是图片中的绿色圆圈。进度条应该留在白框内,但正如您所看到的那样。

我如何让它留在里面viewProgress?在这里你有我的动画功能:

func animateView() {

        let circle = viewProgress // viewProgress is a UIView

        var progressCircle = CAShapeLayer()

        let circlePath = UIBezierPath(arcCenter: circle.center, radius: circle.bounds.midX, startAngle: -CGFloat(M_PI_2), endAngle: CGFloat(3.0 * M_PI_2), clockwise: true)

        progressCircle = CAShapeLayer ()
        progressCircle.path = circlePath.CGPath
        progressCircle.strokeColor = UIColor.whiteColor().CGColor
        progressCircle.fillColor = UIColor.clearColor().CGColor
        progressCircle.lineWidth = 10.0

        circle.layer.addSublayer(progressCircle)

        let animation = CABasicAnimation(keyPath: "strokeEnd")
        animation.fromValue = 0
        animation.toValue = 0.4
        animation.duration = 1
        animation.fillMode = kCAFillModeForwards
        animation.removedOnCompletion = false

        progressCircle.addAnimation(animation, forKey: "ani") …
Run Code Online (Sandbox Code Playgroud)

position cabasicanimation cashapelayer ios swift

0
推荐指数
1
解决办法
2907
查看次数