当前位置:网站首页>C WinForm development: how to add pictures to project resources
C WinForm development: how to add pictures to project resources
2022-07-28 03:18:00 【Dusk and starry sky】
C#WinForm Development : How to add pictures to the project resource file (Resources) in
introduction
Operation steps
Application instance
Function extension
introduction
stay C#Winform In development , Sometimes you need to insert some pictures into the control , Common are pictureBox The control of Image attribute . that , How should we add existing pictures to the project resource file ?Operation steps
stay VS 2017 Create a new one in “Windows Form application ” project , Then save two pictures to the desktop . here , Project name: “cyTest”, The name of the picture is “JapaneseBoy” and “WhiteBoard”, At this point the preparatory work is complete .
stay “ Solution explorer ” In the view , double-click “Properities -> Resources.resx” Options :
In the pop-up “Resources.resx” Window , single click " Add resources " After the option “ Inverted triangle ” Icon . then , In the drop-down menu that appears , single click " Add existing file " Options :
Find the path to save the picture , Select two pictures , single click “ open ” button :
“ Solution explorer ” In the view “cyTest” Under the project , Automatic generation “Resources” Folder and two pictures added . thus , Pictures have been successfully added to the project resource file .
Application instance
In the Form For example, insert two pictures in :
stay Form Drag and drop two in pictureBox Control :
Write the following program code :
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;
namespace cyTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Image cyImage1, cyImage2;
private void Form1_Load(object sender, EventArgs e)
{
cyImage1 = Properties.Resources.JapaneseBoy;
pictureBox1.Image = cyImage1;
pictureBox1.Height = cyImage1.Height;
pictureBox1.Width = cyImage1.Width;
pictureBox1.Location = new Point(10, 10);
cyImage2 = Properties.Resources.WhiteBoard;
pictureBox2.Image = cyImage2;
pictureBox2.Height = cyImage2.Height;
pictureBox2.Width = cyImage2.Width;
pictureBox2.Location = new Point(700, 10);
}
}
}
边栏推荐
- 数据湖(十七):Flink与Iceberg整合DataStream API操作
- Uniapp——拨打电话、发送短信
- Hotel VR panoramic display shooting provides more opportunities for cooperation and negotiation
- ELS timer
- 力扣(LeetCode)208. 实现 Trie (前缀树)(2022.07.27)
- [download file] uniapp develops small programs, downloads files and saves them locally
- 图像去噪综合比较研究
- 嵌入式分享合集22
- [stream] parallel stream and sequential stream
- 机器人工程是否有红利期
猜你喜欢

Interview experience: first tier cities move bricks and face software testing posts. 5000 is enough

RBD块存储设备的扩容以及缩容操作(六)

Softek Barcode Reader 9.1.5

Thread Foundation

Data Lake (XVII): Flink and iceberg integrate datastream API operations

More than 50 interviews have been summarized, and notes and detailed explanations have been taken from April to June (including core test sites and 6 large factories)

QFileDevice、QFile、QSaveFile、QTemporaryFile

Stm32f407 ------- FPU learning
![[stream] parallel stream and sequential stream](/img/e1/b8728962c14df56241aa6973c0c706.png)
[stream] parallel stream and sequential stream
![[2022 Niuke Game 2 J question link with arithmetic progress] three part set three part / three part extreme value / linear equation fitting least square method](/img/4f/56033956739971d821637ae54be1bd.png)
[2022 Niuke Game 2 J question link with arithmetic progress] three part set three part / three part extreme value / linear equation fitting least square method
随机推荐
数据湖(十七):Flink与Iceberg整合DataStream API操作
clientY vs pageY
Kubernetes-----介绍
When QML uses layout layout, a large number of < unknown file >: QML qquicklayoutattached: binding loop detected for property circular binding warnings appear
汇总了50多场面试,4-6月面经笔记和详解(含核心考点及6家大厂)
[download file] uniapp develops small programs, downloads files and saves them locally
C#WinForm开发:如何将图片添加到项目资源文件(Resources)中
What kind of job is social phobia suitable for? Can you do we media?
Scheme sharing | experts gather to jointly explore accent AI speech recognition
行业洞察 | 语音识别真的超过人耳朵了吗?
在线问题反馈模块实战(十六):实现查详情功能
OA项目之我的审批(会议查询&会议签字)
ECCV 2022 | open source for generative knowledge distillation of classification, detection and segmentation
20条心灵鸡汤唯美句子,句句温情暖心!
数字孪生技术驱动智能工厂减负赋能提升运维效益
随机森林与集成方法学习笔记
意外收获史诗级分布式资源,从基础到进阶都干货满满,大佬就是强!
关于权重衰退和丢弃法
Redis通信协议--RESP协议
Digital twin technology drives smart factory to reduce burden and enhance operation and maintenance benefits