Winform控件

2023-11-02


工具箱

在这里插入图片描述

button

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

单选框

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

多选框

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

文本框

在这里插入图片描述

在这里插入图片描述

标签

显示提示信息
在这里插入图片描述

在这里插入图片描述

显示图片控件

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
最后的效果
在这里插入图片描述

进度条属性

在这里插入图片描述

在这里插入图片描述

配合button使用的步骤如下:
在这里插入图片描述

在这里插入图片描述

Halcon图片在PictureBox控件中显示

添加Halcon的引用

见我的这篇博文

编写的代码如下

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HalconDotNet;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        HTuple window = new HTuple();
        public Form1()
        {
            InitializeComponent();
            HOperatorSet.OpenWindow(0, 0, pictureBox1.Width, pictureBox1.Height, pictureBox1.Handle, "", "", out window);
            HDevWindowStack.Push(window);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            HOperatorSet.ReadImage(out HObject image, "F://halcon//halconStudy//相机标定//1.png");
            HOperatorSet.GetImageSize(image, out HTuple width, out HTuple heigth);
            HOperatorSet.SetPart(window, 0, 0, heigth - 1, width - 1);
            HOperatorSet.DispObj(image, window);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            HOperatorSet.ReadImage(out HObject image, "F://halcon//halconStudy//相机标定//2.png");
            HOperatorSet.GetImageSize(image, out HTuple width, out HTuple heigth);
            HOperatorSet.SetPart(window, 0, 0, heigth - 1, width - 1);
            HOperatorSet.DispObj(image, window);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            HOperatorSet.ReadImage(out HObject image, "F://halcon//halconStudy//相机标定//3.png");
            HOperatorSet.GetImageSize(image, out HTuple width, out HTuple heigth);
            HOperatorSet.SetPart(window, 0, 0, heigth - 1, width - 1);
            HOperatorSet.DispObj(image, window);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            HOperatorSet.ReadImage(out HObject image, "F://halcon//halconStudy//相机标定//4.png");
            HOperatorSet.GetImageSize(image, out HTuple width, out HTuple heigth);
            HOperatorSet.SetPart(window, 0, 0, heigth - 1, width - 1);
            HOperatorSet.DispObj(image, window);
        }
    }
}

在这里插入图片描述

在PictureBox中显示图像变量HObject

先将之前的代码导入

这个是Halcon的导出代码…
在这里插入图片描述

在这里插入图片描述
复制到C#项目中
在这里插入图片描述
完整代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HalconDotNet;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        HTuple window = new HTuple();
        public void disp_message(HTuple hv_WindowHandle, HTuple hv_String, HTuple hv_CoordSystem,
    HTuple hv_Row, HTuple hv_Column, HTuple hv_Color, HTuple hv_Box)
        {



            // Local iconic variables 

            // Local control variables 

            HTuple hv_Red = null, hv_Green = null, hv_Blue = null;
            HTuple hv_Row1Part = null, hv_Column1Part = null, hv_Row2Part = null;
            HTuple hv_Column2Part = null, hv_RowWin = null, hv_ColumnWin = null;
            HTuple hv_WidthWin = null, hv_HeightWin = null, hv_MaxAscent = null;
            HTuple hv_MaxDescent = null, hv_MaxWidth = null, hv_MaxHeight = null;
            HTuple hv_R1 = new HTuple(), hv_C1 = new HTuple(), hv_FactorRow = new HTuple();
            HTuple hv_FactorColumn = new HTuple(), hv_UseShadow = null;
            HTuple hv_ShadowColor = null, hv_Exception = new HTuple();
            HTuple hv_Width = new HTuple(), hv_Index = new HTuple();
            HTuple hv_Ascent = new HTuple(), hv_Descent = new HTuple();
            HTuple hv_W = new HTuple(), hv_H = new HTuple(), hv_FrameHeight = new HTuple();
            HTuple hv_FrameWidth = new HTuple(), hv_R2 = new HTuple();
            HTuple hv_C2 = new HTuple(), hv_DrawMode = new HTuple();
            HTuple hv_CurrentColor = new HTuple();
            HTuple hv_Box_COPY_INP_TMP = hv_Box.Clone();
            HTuple hv_Color_COPY_INP_TMP = hv_Color.Clone();
            HTuple hv_Column_COPY_INP_TMP = hv_Column.Clone();
            HTuple hv_Row_COPY_INP_TMP = hv_Row.Clone();
            HTuple hv_String_COPY_INP_TMP = hv_String.Clone();

            // Initialize local and output iconic variables 
            //This procedure displays text in a graphics window.
            //
            //Input parameters:
            //WindowHandle: The WindowHandle of the graphics window, where
            //   the message should be displayed
            //String: A tuple of strings containing the text message to be displayed
            //CoordSystem: If set to 'window', the text position is given
            //   with respect to the window coordinate system.
            //   If set to 'image', image coordinates are used.
            //   (This may be useful in zoomed images.)
            //Row: The row coordinate of the desired text position
            //   If set to -1, a default value of 12 is used.
            //Column: The column coordinate of the desired text position
            //   If set to -1, a default value of 12 is used.
            //Color: defines the color of the text as string.
            //   If set to [], '' or 'auto' the currently set color is used.
            //   If a tuple of strings is passed, the colors are used cyclically
            //   for each new textline.
            //Box: If Box[0] is set to 'true', the text is written within an orange box.
            //     If set to' false', no box is displayed.
            //     If set to a color string (e.g. 'white', '#FF00CC', etc.),
            //       the text is written in a box of that color.
            //     An optional second value for Box (Box[1]) controls if a shadow is displayed:
            //       'true' -> display a shadow in a default color
            //       'false' -> display no shadow (same as if no second value is given)
            //       otherwise -> use given string as color string for the shadow color
            //
            //Prepare window
            HOperatorSet.GetRgb(hv_WindowHandle, out hv_Red, out hv_Green, out hv_Blue);
            HOperatorSet.GetPart(hv_WindowHandle, out hv_Row1Part, out hv_Column1Part, out hv_Row2Part,
                out hv_Column2Part);
            HOperatorSet.GetWindowExtents(hv_WindowHandle, out hv_RowWin, out hv_ColumnWin,
                out hv_WidthWin, out hv_HeightWin);
            HOperatorSet.SetPart(hv_WindowHandle, 0, 0, hv_HeightWin - 1, hv_WidthWin - 1);
            //
            //default settings
            if ((int)(new HTuple(hv_Row_COPY_INP_TMP.TupleEqual(-1))) != 0)
            {
                hv_Row_COPY_INP_TMP = 12;
            }
            if ((int)(new HTuple(hv_Column_COPY_INP_TMP.TupleEqual(-1))) != 0)
            {
                hv_Column_COPY_INP_TMP = 12;
            }
            if ((int)(new HTuple(hv_Color_COPY_INP_TMP.TupleEqual(new HTuple()))) != 0)
            {
                hv_Color_COPY_INP_TMP = "";
            }
            //
            hv_String_COPY_INP_TMP = ((("" + hv_String_COPY_INP_TMP) + "")).TupleSplit("\n");
            //
            //Estimate extentions of text depending on font size.
            HOperatorSet.GetFontExtents(hv_WindowHandle, out hv_MaxAscent, out hv_MaxDescent,
                out hv_MaxWidth, out hv_MaxHeight);
            if ((int)(new HTuple(hv_CoordSystem.TupleEqual("window"))) != 0)
            {
                hv_R1 = hv_Row_COPY_INP_TMP.Clone();
                hv_C1 = hv_Column_COPY_INP_TMP.Clone();
            }
            else
            {
                //Transform image to window coordinates
                hv_FactorRow = (1.0 * hv_HeightWin) / ((hv_Row2Part - hv_Row1Part) + 1);
                hv_FactorColumn = (1.0 * hv_WidthWin) / ((hv_Column2Part - hv_Column1Part) + 1);
                hv_R1 = ((hv_Row_COPY_INP_TMP - hv_Row1Part) + 0.5) * hv_FactorRow;
                hv_C1 = ((hv_Column_COPY_INP_TMP - hv_Column1Part) + 0.5) * hv_FactorColumn;
            }
            //
            //Display text box depending on text size
            hv_UseShadow = 1;
            hv_ShadowColor = "gray";
            if ((int)(new HTuple(((hv_Box_COPY_INP_TMP.TupleSelect(0))).TupleEqual("true"))) != 0)
            {
                if (hv_Box_COPY_INP_TMP == null)
                    hv_Box_COPY_INP_TMP = new HTuple();
                hv_Box_COPY_INP_TMP[0] = "#fce9d4";
                hv_ShadowColor = "#f28d26";
            }
            if ((int)(new HTuple((new HTuple(hv_Box_COPY_INP_TMP.TupleLength())).TupleGreater(
                1))) != 0)
            {
                if ((int)(new HTuple(((hv_Box_COPY_INP_TMP.TupleSelect(1))).TupleEqual("true"))) != 0)
                {
                    //Use default ShadowColor set above
                }
                else if ((int)(new HTuple(((hv_Box_COPY_INP_TMP.TupleSelect(1))).TupleEqual(
                    "false"))) != 0)
                {
                    hv_UseShadow = 0;
                }
                else
                {
                    hv_ShadowColor = hv_Box_COPY_INP_TMP[1];
                    //Valid color?
                    try
                    {
                        HOperatorSet.SetColor(hv_WindowHandle, hv_Box_COPY_INP_TMP.TupleSelect(
                            1));
                    }
                    // catch (Exception) 
                    catch (HalconException HDevExpDefaultException1)
                    {
                        HDevExpDefaultException1.ToHTuple(out hv_Exception);
                        hv_Exception = "Wrong value of control parameter Box[1] (must be a 'true', 'false', or a valid color string)";
                        throw new HalconException(hv_Exception);
                    }
                }
            }
            if ((int)(new HTuple(((hv_Box_COPY_INP_TMP.TupleSelect(0))).TupleNotEqual("false"))) != 0)
            {
                //Valid color?
                try
                {
                    HOperatorSet.SetColor(hv_WindowHandle, hv_Box_COPY_INP_TMP.TupleSelect(0));
                }
                // catch (Exception) 
                catch (HalconException HDevExpDefaultException1)
                {
                    HDevExpDefaultException1.ToHTuple(out hv_Exception);
                    hv_Exception = "Wrong value of control parameter Box[0] (must be a 'true', 'false', or a valid color string)";
                    throw new HalconException(hv_Exception);
                }
                //Calculate box extents
                hv_String_COPY_INP_TMP = (" " + hv_String_COPY_INP_TMP) + " ";
                hv_Width = new HTuple();
                for (hv_Index = 0; (int)hv_Index <= (int)((new HTuple(hv_String_COPY_INP_TMP.TupleLength()
                    )) - 1); hv_Index = (int)hv_Index + 1)
                {
                    HOperatorSet.GetStringExtents(hv_WindowHandle, hv_String_COPY_INP_TMP.TupleSelect(
                        hv_Index), out hv_Ascent, out hv_Descent, out hv_W, out hv_H);
                    hv_Width = hv_Width.TupleConcat(hv_W);
                }
                hv_FrameHeight = hv_MaxHeight * (new HTuple(hv_String_COPY_INP_TMP.TupleLength()
                    ));
                hv_FrameWidth = (((new HTuple(0)).TupleConcat(hv_Width))).TupleMax();
                hv_R2 = hv_R1 + hv_FrameHeight;
                hv_C2 = hv_C1 + hv_FrameWidth;
                //Display rectangles
                HOperatorSet.GetDraw(hv_WindowHandle, out hv_DrawMode);
                HOperatorSet.SetDraw(hv_WindowHandle, "fill");
                //Set shadow color
                HOperatorSet.SetColor(hv_WindowHandle, hv_ShadowColor);
                if ((int)(hv_UseShadow) != 0)
                {
                    HOperatorSet.DispRectangle1(hv_WindowHandle, hv_R1 + 1, hv_C1 + 1, hv_R2 + 1, hv_C2 + 1);
                }
                //Set box color
                HOperatorSet.SetColor(hv_WindowHandle, hv_Box_COPY_INP_TMP.TupleSelect(0));
                HOperatorSet.DispRectangle1(hv_WindowHandle, hv_R1, hv_C1, hv_R2, hv_C2);
                HOperatorSet.SetDraw(hv_WindowHandle, hv_DrawMode);
            }
            //Write text.
            for (hv_Index = 0; (int)hv_Index <= (int)((new HTuple(hv_String_COPY_INP_TMP.TupleLength()
                )) - 1); hv_Index = (int)hv_Index + 1)
            {
                hv_CurrentColor = hv_Color_COPY_INP_TMP.TupleSelect(hv_Index % (new HTuple(hv_Color_COPY_INP_TMP.TupleLength()
                    )));
                if ((int)((new HTuple(hv_CurrentColor.TupleNotEqual(""))).TupleAnd(new HTuple(hv_CurrentColor.TupleNotEqual(
                    "auto")))) != 0)
                {
                    HOperatorSet.SetColor(hv_WindowHandle, hv_CurrentColor);
                }
                else
                {
                    HOperatorSet.SetRgb(hv_WindowHandle, hv_Red, hv_Green, hv_Blue);
                }
                hv_Row_COPY_INP_TMP = hv_R1 + (hv_MaxHeight * hv_Index);
                HOperatorSet.SetTposition(hv_WindowHandle, hv_Row_COPY_INP_TMP, hv_C1);
                HOperatorSet.WriteString(hv_WindowHandle, hv_String_COPY_INP_TMP.TupleSelect(
                    hv_Index));
            }
            //Reset changed window settings
            HOperatorSet.SetRgb(hv_WindowHandle, hv_Red, hv_Green, hv_Blue);
            HOperatorSet.SetPart(hv_WindowHandle, hv_Row1Part, hv_Column1Part, hv_Row2Part,
                hv_Column2Part);

            return;
        }
        public Form1()
        {
            InitializeComponent();
            HOperatorSet.OpenWindow(0, 0, pictureBox1.Width, pictureBox1.Height, pictureBox1.Handle, "", "", out window);
            HDevWindowStack.Push(window);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            HOperatorSet.ReadImage(out HObject image, "F://halcon//halconStudy//相机标定//1.png");
            HOperatorSet.GetImageSize(image, out HTuple width, out HTuple heigth);
            HOperatorSet.SetPart(window, 0, 0, heigth - 1, width - 1);
            HOperatorSet.DispObj(image, window);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            HOperatorSet.ReadImage(out HObject image, "F://halcon//halconStudy//相机标定//2.png");
            HOperatorSet.GetImageSize(image, out HTuple width, out HTuple heigth);
            HOperatorSet.SetPart(window, 0, 0, heigth - 1, width - 1);
            HOperatorSet.DispObj(image, window);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            HOperatorSet.ReadImage(out HObject image, "F://halcon//halconStudy//相机标定//3.png");
            HOperatorSet.GetImageSize(image, out HTuple width, out HTuple heigth);
            HOperatorSet.SetPart(window, 0, 0, heigth - 1, width - 1);
            HOperatorSet.DispObj(image, window);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            HOperatorSet.ReadImage(out HObject image, "F://halcon//halconStudy//相机标定//4.png");
            HOperatorSet.GetImageSize(image, out HTuple width, out HTuple heigth);
            HOperatorSet.SetPart(window, 0, 0, heigth - 1, width - 1);
            HOperatorSet.DispObj(image, window);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            // Local iconic variables 

            HObject ho_Image20230323135129, ho_GrayImage;
            HObject ho_Regions, ho_RegionOpening, ho_ConnectedRegions;
            HObject ho_ObjectSelected = null;

            // Local control variables 

            HTuple hv_WindowHandle = null, hv_Mean = null;
            HTuple hv_Deviation = null, hv_Number = null, hv_Index = null;
            HTuple hv_Area = new HTuple(), hv_Row = new HTuple(), hv_Column = new HTuple();
            HTuple hv_Mean1 = new HTuple(), hv_Deviation1 = new HTuple();
            // Initialize local and output iconic variables 
            HOperatorSet.GenEmptyObj(out ho_Image20230323135129);
            HOperatorSet.GenEmptyObj(out ho_GrayImage);
            HOperatorSet.GenEmptyObj(out ho_Regions);
            HOperatorSet.GenEmptyObj(out ho_RegionOpening);
            HOperatorSet.GenEmptyObj(out ho_ConnectedRegions);
            HOperatorSet.GenEmptyObj(out ho_ObjectSelected);
            if (HDevWindowStack.IsOpen())
            {
                HOperatorSet.CloseWindow(HDevWindowStack.Pop());
            }
            HOperatorSet.SetWindowAttr("background_color", "black");
            HOperatorSet.OpenWindow(0, 0, 512, 512, 0, "", "", out hv_WindowHandle);
            HDevWindowStack.Push(hv_WindowHandle);
            ho_Image20230323135129.Dispose();
            HOperatorSet.ReadImage(out ho_Image20230323135129, "F:/halcon/halconStudy/image/b.png");
            ho_GrayImage.Dispose();
            HOperatorSet.Rgb1ToGray(ho_Image20230323135129, out ho_GrayImage);
            ho_Regions.Dispose();
            HOperatorSet.Threshold(ho_GrayImage, out ho_Regions, 83, 226);
            ho_RegionOpening.Dispose();
            HOperatorSet.OpeningRectangle1(ho_Regions, out ho_RegionOpening, 10, 10);
            ho_ConnectedRegions.Dispose();
            HOperatorSet.Connection(ho_RegionOpening, out ho_ConnectedRegions);
            HOperatorSet.Intensity(ho_ConnectedRegions, ho_GrayImage, out hv_Mean, out hv_Deviation);

            HOperatorSet.CountObj(ho_ConnectedRegions, out hv_Number);
            HTuple end_val10 = hv_Number;
            HTuple step_val10 = 1;
            for (hv_Index = 1; hv_Index.Continue(end_val10, step_val10); hv_Index = hv_Index.TupleAdd(step_val10))
            {
                ho_ObjectSelected.Dispose();
                HOperatorSet.SelectObj(ho_ConnectedRegions, out ho_ObjectSelected, hv_Index);
                HOperatorSet.AreaCenter(ho_ObjectSelected, out hv_Area, out hv_Row, out hv_Column);
                HOperatorSet.Intensity(ho_ObjectSelected, ho_GrayImage, out hv_Mean1, out hv_Deviation1);
                if (HDevWindowStack.IsOpen())
                {
                    HOperatorSet.DispObj(ho_Image20230323135129, HDevWindowStack.GetActive()
                        );
                }
                if ((int)((new HTuple(hv_Mean1.TupleGreater(217 - 3))).TupleAnd(new HTuple(hv_Mean1.TupleLess(
                    217 + 3)))) != 0)
                {
                    disp_message(hv_WindowHandle, "黄色", "Image20230323135129", hv_Row,
                        hv_Column, "black", "true");
                }
                if ((int)((new HTuple(hv_Mean1.TupleGreater(124 - 1))).TupleAnd(new HTuple(hv_Mean1.TupleLess(
                    124 + 1)))) != 0)
                {
                    disp_message(hv_WindowHandle, "绿色", "Image20230323135129", hv_Row,
                        hv_Column, "black", "true");
                }
                if ((int)((new HTuple(hv_Mean1.TupleGreater(91 - 3))).TupleAnd(new HTuple(hv_Mean1.TupleLess(
                    91 + 3)))) != 0)
                {
                    disp_message(hv_WindowHandle, "红色", "Image20230323135129", hv_Row,
                        hv_Column, "black", "true");
                }
                if ((int)((new HTuple(hv_Mean1.TupleGreater(122 - 1))).TupleAnd(new HTuple(hv_Mean1.TupleLess(
                    122 + 1)))) != 0)
                {
                    disp_message(hv_WindowHandle, "蓝色", "Image20230323135129", hv_Row,
                        hv_Column, "black", "true");
                }
            }
        }
    }
}

如果使用之前导出文件中定义的展示方法,存在显示问题(不在控件中显示)
在这里插入图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Winform控件 的相关文章

  • Jupyter notebook快速入门教程

    本篇将给大家介绍一款超级好用的工具 Jupyter notebook 为什么要介绍这款工具呢 如果你想使用Python学习数据分析或数据挖掘 那么它应该是你第一个应该知道并会使用的工具 它很容易上手 用起来非常方便 是个对新手非常友好的工具
  • Matlab快速创建矩阵的方法(创建特殊矩阵)

    在matlab的使用过程中经常会需要用到矩阵 有时想要创建一些数据比较多的矩阵 对矩阵的内容要求可能并不高或者要创建一些特殊矩阵 下面将提供一些matlab内部提供的一些快速创建矩阵的方法 1 创建单位矩阵 eye n 创建n n的单位矩阵

随机推荐

  • GitHub托管HTML页面,让其他人轻松访问自己的页面

    如何通过GitHub来托管自己写的HTML页面 能够轻松让其他人访问你的页面 还可以通过GitHub让多人参与进来你的项目 以下是详细步骤 1 创建账户 登陆https github com 注册成功 1 https guides gith
  • SpringBoot2.0学习笔记:(九) Spring Boot中集成Mybatis与Druid

    一 项目的搭建 Druid对Spring boot做了很好的适配 所有的工作都只需要在配置文件中完成 具体的Druid在Spring Boot中的配置可以看 GitHub文档 首先看一下项目引入的jar包
  • flink学习46:flinkSQL自定义函数

    标量函数 实例 表值函数 聚合函数
  • 点击登录按钮弹出登录模态框

  • 拯救者y7000笔记本VMware虚拟机打开蓝屏问题

    VMware虚拟机安装后开启虚拟机蓝屏检查步骤 一 必须确定你的CPU开启了虚拟化才行 要先开启虚拟化再去控制面板里设置 查看是否开启虚拟化方法 在win10系统最下方任务栏空白处 右键鼠标打开任务管理器 也可以点击快捷键Ctrl Alt
  • go语言实现邮件发送

    go语言实现邮件发送 安装相关的包 go get github com jordan wright email 代码篇 package main import fmt github com jordan wright email log n
  • Zotero软件与ChatGPT连用模版

    Zotero软件与ChatGPT连用模版 整体流程 其他配置 全文 AskPDF position 10 color 0EA293 trigger 本文 这篇文章 论文 You are a helpful assistant Context
  • 缓存一致性问题解决方案

    通常情况下 我们使用缓存的主要目的是为了提升查询的性能 大多数情况下 是这样使用缓存的 当数据库有数据更新时 在很长的一段时间内 决定于缓存的过期时间 用户请求从缓存中获取到的都可能是旧值 而非数据库的最新值 那么 该如何更新缓存呢 目前有
  • Python实现电商订单的数据分析

    一 数据信息 数据集 阿里云天池 数据来源 说明 本数据集共有104557条数据 共计11个字段 字段 id 序号 orderID 订单id userID 用户id goodsID 商品id orderAmount 订单总额 payment
  • 【Python刷题】P1

    Python刷题P1 第一题 第二题 第一题 1 给定一个非空的字符串 s 检查是否可以通过由它的一个子串重复多次构成 示例 1 输入 s abab 输出 true 解释 可由子串 ab 重复两次构成 示例 2 输入 s aba 输出 fa
  • C语言程序设计(谭浩强第五版)——例题

    C语言程序设计 谭浩强第五版 例题 第1章 程序设计和C语言 第2章 算法 程序的灵魂 第3章 最简单的C程序设计 顺序程序设计 第4章 选择结构程序设计 第5章 循环结构程序设计 第6章 利用数组处理批量数据 第7章 用函数实现模块化程序
  • 【算法基础】基于pytorch的BP神经网络算法代码+数据集

    实现功能 1 数据回归 基于多输入单输出数据集 2 代码最后使用matplotlib绘制了 训练次数 loss值 折线图进行训练结果展示 注 1 代码亲测可成功运行 2 以下代码通过cuda调用GPU训练 如果cuda报错则需检查GPU训练
  • python基础学习06_if条件判断(多重判断、嵌套、三目运算)

    一 条件语句 条件成立执行某些代码 条件不成立执行哪些代码 二 IF 条件判断 IF简单条件判断 多重判断 IF嵌套 三目运算符 1 if 简单条件判断 if if True print 条件成 执 的代码1 print 条件成 执 的代码
  • 微信小程序开发记录(一)弹出框和模态框介绍

    弹出框和模态框的简介和使用方法如下
  • k8s踩坑2——scheduler 、controller-manager Unhealthy

    查看master组件状态时出现错误 root k8s master kubectl get cs Warning v1 ComponentStatus is deprecated in v1 19 NAME STATUS MESSAGE E
  • ActiveMQ Redelivery Policy(消息重发策略)

    官方文档 http activemq apache org redelivery policy html 在事务控制里抛出异常 txManager会进行rollback处理 在activeMQ里 消息默认会redelivery到客户端6次
  • 教你用Mock实现复杂登陆接口下如何优雅的获取Token

    哈喽大家好 我是阿Q 背景 今天又双叒叕被抓壮丁了 被安排进了新的项目组进行任务开发 加入新项目后的第一件事 当然是先研究下同事的代码喽 在 学习 代码的过程中竟然惊奇的发现同事写了测试用例 对于一直使用PostMan来进行接口测试的我表示
  • MultipartFile中transferTo(File file)的路径问题

    今天看到layui的文件上传的控件 就尝试了一下 简单创建了一个SpringMVC项目 记得在配置文件中注入以下Bean
  • Pytorch 多GPU训练

    Pytorch 多GPU训练 目录 Pytorch 多GPU训练 1 导入库 2 指定GPU 2 1 单GPU声明 2 2 多GPU声明 3 数据放到GPU 4 把模型网络放到GPU 重要 torch nn DataParallel DP
  • Winform控件

    Winform控件 button 单选框 多选框 文本框 标签 显示图片控件 进度条属性 Halcon图片在PictureBox控件中显示 添加Halcon的引用 编写的代码如下 在PictureBox中显示图像变量HObject 先将之前