C#设计一个带导航菜单的主界面的应用案例

目录

一、关于导航菜单

二、设计一个带导航菜单的主界面

1.Resources.Designer.cs设计

2.主要的设计步骤

(1)窗体静态设计

(2)事件的动作设计

3.涉及到的主要知识点

(1)Control.SendToBack 方法

(2)Control.BringToFront 方法

(3)Control.UpdateZOrder 方法

(4) ListView控件的Items.Add方法

(5) Z-Order


        在C#中,可以使用Windows Forms或WPF来设计带有导航菜单的主界面。

一、关于导航菜单

        导航菜单是一种用户界面元素,用于帮助用户在应用程序的不同部分之间进行导航。它通常包含一个或多个菜单项,每个菜单项都表示一个特定的功能或操作。当用户单击某个菜单项时,应用程序会执行相应的操作或显示与该操作相关的子菜单。

        导航菜单可以出现在应用程序的顶部、底部或侧边,具体取决于应用程序的设计和平台。例如,在Web应用程序中,导航菜单通常出现在页面的顶部或侧边,而在移动应用程序中,导航菜单可能出现在屏幕的底部或顶部。

        导航菜单的主要目的是提供一个直观且一致的方式来访问应用程序的主要功能和特性。它可以帮助用户快速找到他们需要的信息或完成特定的任务,从而提高应用程序的可用性和用户体验。

二、设计一个带导航菜单的主界面

        在窗体中添加一个MenuStrip控件,用来设计菜单栏;添加一个SplitContainer控件,用来将窗体分为两部分;添加一个ListView控件和3个Button控件,并将它们加入SqlitContainer1的左侧部分,用来制作窗体左侧的导航栏;添加一个ImageList组件,用来为ListView列表项提供图标。

1.Resources.Designer.cs设计

        在图片资源管理器中设计项目需要的背景图片和ImageList组件的图片。

        如何加载图片资源详见本文作者写的其他文章:C#手动改变自制窗体的大小-CSDN博客 https://wenchm.blog.csdn.net/article/details/137027140

// Resources.Designer.cs
//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本:4.0.30319.42000
//
//     对此文件的更改可能会导致不正确的行为,并且如果
//     重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace _176.Properties {
    using System;
    
    
    /// <summary>
    ///   一个强类型的资源类,用于查找本地化的字符串等。
    /// </summary>
    // 此类是由 StronglyTypedResourceBuilder
    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
    // (以 /str 作为命令选项),或重新生成 VS 项目。
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }
        
        /// <summary>
        ///   返回此类使用的缓存的 ResourceManager 实例。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_176.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   重写当前线程的 CurrentUICulture 属性,对
        ///   使用此强类型资源类的所有资源查找执行重写。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
        /// </summary>
        internal static System.Drawing.Bitmap _1 {
            get {
                object obj = ResourceManager.GetObject("_1", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
        /// </summary>
        internal static System.Drawing.Bitmap _2 {
            get {
                object obj = ResourceManager.GetObject("_2", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
        /// </summary>
        internal static System.Drawing.Bitmap _3 {
            get {
                object obj = ResourceManager.GetObject("_3", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
        /// </summary>
        internal static System.Drawing.Bitmap _4 {
            get {
                object obj = ResourceManager.GetObject("_4", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
        /// </summary>
        internal static System.Drawing.Bitmap _5 {
            get {
                object obj = ResourceManager.GetObject("_5", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
        /// </summary>
        internal static System.Drawing.Bitmap _6 {
            get {
                object obj = ResourceManager.GetObject("_6", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
        /// </summary>
        internal static System.Drawing.Bitmap _7 {
            get {
                object obj = ResourceManager.GetObject("_7", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
        /// </summary>
        internal static System.Drawing.Bitmap _8 {
            get {
                object obj = ResourceManager.GetObject("_8", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
        /// </summary>
        internal static System.Drawing.Bitmap _9 {
            get {
                object obj = ResourceManager.GetObject("_9", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
        
        /// <summary>
        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
        /// </summary>
        internal static System.Drawing.Bitmap C_编程词典 {
            get {
                object obj = ResourceManager.GetObject("C_编程词典", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        internal static Bitmap GetObject(string v)
        {
            return v switch
            {
                "C_编程词典" => C_编程词典,
                "_9" => _9,
                "_8" => _8,
                "_7" => _7,
                "_6" => _6,
                "_5" => _5,
                "_4" => _4,
                "_3" => _3,
                "_2" => _2,
                "_1" => _1,
                _ => null
            };
        }
    }
}

2.主要的设计步骤

(1)窗体静态设计

  • 设计一个窗体;
  • 在窗体中设计一个menustrip1控件,默认的控件位于Form1的顶部,重要的设置menustrip1控件的Dock属性设置为Top;最后设计3个MenuItem子控件:设置、打开、编辑;
  • 在窗体剩余空间中添加一个 splitContainer控件,之所以说剩余空间,就是要保证menustrip1控件不被 splitContainer控件包含,这哈斯有menustrip1的Dock属性保证的;
  • 设计图片资源管理器,并给右侧的splitContainer2添加背景图片,Stretch布局;
  • 在左侧的splitContainer2控件里,添加3个button控件,并命名为:设置、打开、编辑;设置控件的Dock属性为Top,设置编辑控件的Dock属性为Top,最后,设置打开按钮的Dock属性为Top;结果是,设置按钮位于splitContainer2控件顶部,编辑按钮位于splitContainer2控件底部,打开按钮位于编辑按钮的顶部;这样的设置很重要;
  • 在左侧的splitContainer2控件里设置按钮和打开按钮之间添加 listView1控件,其Dock属性设置为Fill,这很重要;
  • 添加imageList1控件,并为其添加图片集;
  • 设置 listView1控件的属性,右上角的尖角,选择大图标、imageList1、imageList1;
  • 创建窗体、按钮1~3的Click事件;
// Form1.Designer.cs
namespace _176
{
    partial class Form1
    {
        /// <summary>
        ///  Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        ///  Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        ///  Required method for Designer support - do not modify
        ///  the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            imageList1 = new ImageList(components);
            menuStrip1 = new MenuStrip();
            toolStripMenuItem1 = new ToolStripMenuItem();
            toolStripMenuItem2 = new ToolStripMenuItem();
            toolStripMenuItem3 = new ToolStripMenuItem();
            splitContainer1 = new SplitContainer();
            listView1 = new ListView();
            button3 = new Button();
            button2 = new Button();
            button1 = new Button();
            menuStrip1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
            splitContainer1.Panel1.SuspendLayout();
            splitContainer1.SuspendLayout();
            SuspendLayout();
            // 
            // imageList1
            // 
            imageList1.ColorDepth = ColorDepth.Depth32Bit;
            imageList1.ImageStream = (ImageListStreamer)resources.GetObject("imageList1.ImageStream");
            imageList1.TransparentColor = Color.Transparent;
            imageList1.Images.SetKeyName(0, "1.png");
            imageList1.Images.SetKeyName(1, "2.jpg");
            imageList1.Images.SetKeyName(2, "3.png");
            imageList1.Images.SetKeyName(3, "4.png");
            imageList1.Images.SetKeyName(4, "5.png");
            imageList1.Images.SetKeyName(5, "6.png");
            imageList1.Images.SetKeyName(6, "7.png");
            imageList1.Images.SetKeyName(7, "8.png");
            imageList1.Images.SetKeyName(8, "9.png");
            // 
            // menuStrip1
            // 
            menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem1, toolStripMenuItem2, toolStripMenuItem3 });
            menuStrip1.Location = new Point(0, 0);
            menuStrip1.Name = "menuStrip1";
            menuStrip1.Size = new Size(434, 25);
            menuStrip1.TabIndex = 0;
            menuStrip1.Text = "menuStrip1";
            // 
            // toolStripMenuItem1
            // 
            toolStripMenuItem1.Name = "toolStripMenuItem1";
            toolStripMenuItem1.Size = new Size(44, 21);
            toolStripMenuItem1.Text = "设置";
            // 
            // toolStripMenuItem2
            // 
            toolStripMenuItem2.Name = "toolStripMenuItem2";
            toolStripMenuItem2.Size = new Size(44, 21);
            toolStripMenuItem2.Text = "打开";
            // 
            // toolStripMenuItem3
            // 
            toolStripMenuItem3.Name = "toolStripMenuItem3";
            toolStripMenuItem3.Size = new Size(44, 21);
            toolStripMenuItem3.Text = "编辑";
            // 
            // splitContainer1
            // 
            splitContainer1.Dock = DockStyle.Fill;
            splitContainer1.Location = new Point(0, 25);
            splitContainer1.Name = "splitContainer1";
            // 
            // splitContainer1.Panel1
            // 
            splitContainer1.Panel1.Controls.Add(listView1);
            splitContainer1.Panel1.Controls.Add(button3);
            splitContainer1.Panel1.Controls.Add(button2);
            splitContainer1.Panel1.Controls.Add(button1);
            // 
            // splitContainer1.Panel2
            // 
            splitContainer1.Panel2.BackgroundImage = Properties.Resources.C_编程词典;
            splitContainer1.Panel2.BackgroundImageLayout = ImageLayout.Stretch;
            splitContainer1.Size = new Size(434, 276);
            splitContainer1.SplitterDistance = 144;
            splitContainer1.TabIndex = 1;
            // 
            // listView1
            // 
            listView1.Dock = DockStyle.Fill;
            listView1.LargeImageList = imageList1;
            listView1.Location = new Point(0, 23);
            listView1.Name = "listView1";
            listView1.Size = new Size(144, 207);
            listView1.SmallImageList = imageList1;
            listView1.TabIndex = 3;
            listView1.UseCompatibleStateImageBehavior = false;
            // 
            // button3
            // 
            button3.Dock = DockStyle.Bottom;
            button3.Location = new Point(0, 230);
            button3.Name = "button3";
            button3.Size = new Size(144, 23);
            button3.TabIndex = 2;
            button3.Text = "编辑";
            button3.UseVisualStyleBackColor = true;
            button3.Click += Button3_Click;
            // 
            // button2
            // 
            button2.Dock = DockStyle.Bottom;
            button2.Location = new Point(0, 253);
            button2.Name = "button2";
            button2.Size = new Size(144, 23);
            button2.TabIndex = 1;
            button2.Text = "打开";
            button2.UseVisualStyleBackColor = true;
            button2.Click += Button2_Click;
            // 
            // button1
            // 
            button1.Dock = DockStyle.Top;
            button1.Location = new Point(0, 0);
            button1.Name = "button1";
            button1.Size = new Size(144, 23);
            button1.TabIndex = 0;
            button1.Text = "设置";
            button1.UseVisualStyleBackColor = true;
            button1.Click += Button1_Click;
            // 
            // Form1
            // 
            AutoScaleDimensions = new SizeF(7F, 17F);
            AutoScaleMode = AutoScaleMode.Font;
            ClientSize = new Size(434, 301);
            Controls.Add(splitContainer1);
            Controls.Add(menuStrip1);
            MainMenuStrip = menuStrip1;
            Name = "Form1";
            StartPosition = FormStartPosition.CenterScreen;
            Text = "带导航菜单的窗体";
            Load += Form1_Load;
            menuStrip1.ResumeLayout(false);
            menuStrip1.PerformLayout();
            splitContainer1.Panel1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)splitContainer1).EndInit();
            splitContainer1.ResumeLayout(false);
            ResumeLayout(false);
            PerformLayout();
        }

        #endregion

        private ImageList imageList1;
        private MenuStrip menuStrip1;
        private ToolStripMenuItem toolStripMenuItem1;
        private ToolStripMenuItem toolStripMenuItem2;
        private ToolStripMenuItem toolStripMenuItem3;
        private SplitContainer splitContainer1;
        private ListView listView1;
        private Button button3;
        private Button button2;
        private Button button1;
    }
}

(2)事件的动作设计

// Form1.cs
namespace _176
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 默认设置
        /// </summary>
        private void Form1_Load(object sender, EventArgs e)
        {
            listView1.Clear();
            listView1.LargeImageList = imageList1;                                      //设置当前项以大图标的形式显示时用到的图像
            listView1.Items.Add("设置上下班时间", "设置上下班时间", 0);    //向listView1中添加项“设置上下班时间”
            listView1.Items.Add("是否启用短信提醒", "是否启用短信提醒", 1);//向listView1中添加项“是否启用短信提醒”
            listView1.Items.Add("设置密码", "设置密码", 2);               //向listView1中添加项“设置密码”
        }

        /// <summary>
        /// 设置
        /// </summary>
        private void Button1_Click(object sender, EventArgs e)
        {
            listView1.Dock = DockStyle.None;    //设置listView1的绑定属性为未绑定
            button1.Dock = DockStyle.Top;       //设置button1的绑定属性为上端绑定
            button2.Dock = DockStyle.Bottom;    //设置button2的绑定属性为底端绑定
            button3.SendToBack();               //将button3发送到Z顺序的后面
            button3.Dock = DockStyle.Bottom;    //设置button3的绑定属性为底端绑定
            listView1.BringToFront();           //将listView1带到Z顺序的前面
            listView1.Dock = DockStyle.Bottom;  //设置listView1的绑定属性为底端绑定
            listView1.Clear();
            listView1.Items.Add("设置上下班时间", "设置上下班时间", 0);
            listView1.Items.Add("是否启用短信提醒", "是否启用短信提醒", 1);
            listView1.Items.Add("设置密码", "设置密码", 2);
        }

        /// <summary>
        /// 打开
        /// </summary>
        private void Button2_Click(object sender, EventArgs e)
        {
            listView1.Dock = DockStyle.None;  //设置listView1的绑定属性为未绑定
            button2.Dock = DockStyle.Top;     //设置button2的绑定属性为上端绑定
            button1.SendToBack();             //将控件button1发送到Z顺序的后面
            button1.Dock = DockStyle.Top;     //设置button1的绑定属性为上端绑定
            button3.Dock = DockStyle.Bottom;  //设置button3的绑定属性为底端绑定
            listView1.Dock = DockStyle.Bottom;//设置listView1的绑定属性为底端绑定
            listView1.Clear();
            listView1.Items.Add("近期工作记录", "近期工作记录", 3);
            listView1.Items.Add("近期工作计划", "近期工作计划", 4); 
        }

        /// <summary>
        /// 编辑
        /// </summary>
        private void Button3_Click(object sender, EventArgs e)
        {
            listView1.Dock = DockStyle.None;    //设置listView1的绑定属性为未绑定
            button3.SendToBack();               //将button3发送到Z顺序的后面
            button3.Dock = DockStyle.Top;       //设置button3的绑定属性为上端绑定
            button2.SendToBack();               //将button2发送到Z顺序的后面
            button2.Dock = DockStyle.Top;       //设置button2的绑定属性为上端绑定
            button1.SendToBack();               //将button1发送到Z顺序的后面
            button1.Dock = DockStyle.Top;       //设置button1的绑定属性为上端绑定
            listView1.Dock = DockStyle.Bottom;  //设置listView1的绑定属性为底端绑定
            listView1.Clear();
            listView1.Items.Add("编辑工作进度报告", "编辑工作进度报告", 5);
            listView1.Items.Add("编辑项目设计图", "编辑项目设计图", 6);
        }
    }
}

3.涉及到的主要知识点

(1)Control.SendToBack 方法

        将控件发送到 Z 顺序的后面。

public void SendToBack ();

        控件移动到 z 顺序的后面。 如果控件是另一个控件的子控件,则子控件将移动到 z 顺序的后面。 如果控件是顶级控件,则除非控件处于活动状态,否则此方法将无法正常工作。 顶级控件是一个控件,如 Form,它不是另一个控件的子控件。 活动控件是具有输入焦点的可见控件。 若要将 SendToBack 方法与非活动顶级控件一起使用,请先对 控件调用 BringToFront 方法。

(2)Control.BringToFront 方法

         将控件带到 Z 顺序的前面。

public void BringToFront ();

        控件将移动到 z 顺序的前面。 如果控件是另一个控件的子控件,则子控件将移动到 z 顺序的前面。 BringToFront 不会使控件成为顶级控件,也不会引发 Paint 事件。

(3)Control.UpdateZOrder 方法

         按其父级的 z 顺序更新控件。

protected void UpdateZOrder ();

        UpdateZOrder 方法更新控件在其父控件的 z 顺序中的位置。例如,如果此控件是添加到 Control.ControlCollection 中的新创建的控件,则 z 顺序将更新为添加到后面的新控件。

(4) ListView控件的Items.Add方法

        ListView控件的Items属性用来获取包含控件中所有项的集合,其Add方法用来将项添加到ListView列表中。

public virtual ListViewltem Add(string key,string text,int imagelndex)

参    数

说    明

参    数

说    明

key

项的名称

imageIndex

要为该项显示的图像的索引

text

项的文本

返回值

添加到集合中的ListViewItem

(5) Z-Order

        C# 中的 Z-Order 是一种确定窗口或控件在屏幕上的堆叠顺序的方式。它由窗口或控件在坐标系中的 Z 值决定。具有更高 Z 值的窗口或控件位于具有较低 Z 值的窗口或控件之上。
        在 C# 中,您可以使用 SendToBack 方法将指定控件发送到 Z-Order 的末尾,这意味着它将位于所有其他控件之后。这在您想要创建一个透明窗口或控件,并且需要将其放在其他所有控件之后的情况下非常有用。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/554404.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

关于主干布线,你应该知道什么

所有大型建筑都需要复杂的通信网络才能有效运行。这需要多个不同的通信室和电缆将这些房间连接在一起。在这里&#xff0c;骨干布线是任何建筑物通信系统的重要组成部分&#xff0c;可以发挥作用。 那么&#xff0c;什么是骨干布线&#xff1f;它是做什么用的&#xff1f;它究…

Monaco Editor系列(四)版本对比、自定义右键菜单、光标滚动

前言&#xff1a;亲爱的小伙伴们&#xff0c;又见面了&#xff01;上一篇文章我们一起学习了 Monaco Editor 的几个功能&#xff0c;设置内容、多文件编辑、自定义主题&#xff1b;下面让我们继续Monaco Editor的旅程吧&#xff01; 前情提要&#xff1a; 上一篇文章我介绍了M…

Facebook隐私保护:用户数据安全的关键挑战

在数字化时代&#xff0c;数据已成为最宝贵的资源之一。社交媒体平台如Facebook为用户提供了便捷的交流和信息分享工具&#xff0c;但同时也面临着如何保护用户数据安全和隐私的挑战。本文将深入探讨Facebook在数据安全方面面临的关键挑战&#xff0c;以及其如何应对这些挑战&a…

部署Zabbix5.0

一.部署zabbix客户端 端口号10050 zabbix 5.0 版本采用 golang 语言开发的新版本客户端 agent2 。 zabbix 服务端 zabbix_server 默认使用 10051 端口&#xff0c;客户端 zabbix_agent2 默认使用 10050 端口。 1.1.关闭防火墙和selinux安全模块 systemctl disable --now fir…

python中的列表、元组、字典、集合(集合篇)

数据类型定义符号访问元素是否可变是否重复是否有序列表 [ ]索引可变可重复有序元组&#xff08;&#xff09;索引不可变可重复有序字典{key&#xff1a;value}键可变可重复无序集合{ }可变不可重复无序 基本概念 python语言中的集合是无序的、可变的容器类对象&#xff0c;所…

【Web】HTML基础

专栏文章索引&#xff1a;Web 有问题可私聊&#xff1a;QQ&#xff1a;3375119339 目录 一、HTML介绍 1.HTML 定义 2.标签语法 3.HTML 基本骨架 4.标签的关系 5.HTML 注释 二、标签 1.排版标签 1.1 标题标签 1.2 段落标签 1.3 换行标签 1.4 水平线标签 1.5 文本格…

Python学习(四)

文件操作 想想我们平常对文件的基本操作&#xff0c;大概可以分为三个步骤(简称文件操作三步走): ① 打开文件 ② 读写文件 ③ 关闭文件 注意:可以只打开和关闭文件&#xff0c;不进行任何读写 在Python&#xff0c;使用open函数&#xff0c;可以打开一个已经存在的文件&…

4.16作业

1.总结keil5下载代码和编译代码需要注意的事项 一、在编译代码时需要先点击魔术棒点击 修改flash Downlond 和pack 二、可以通过F12转跳到对应的函数中&#xff0c;查看函数的原型 三、注释出现乱码通过 Edit中的中的来修改 四、要先bulid在load 2.总结STM32Cubemx的使用方…

【UE 材质】表面湿润效果

效果 步骤 1. 创建一个材质函数&#xff0c;这里命名为“MF_Weather_Wetness”&#xff0c;打开材质函数添加如下节点 其中输入的默认值分别为&#xff1a; 其中&#xff0c;“Desaturation”节点用于控制饱和度&#xff0c;我们通过给“Fraction”引脚输入一个负值来增加饱和…

【AR开发示例】实现AR管线巡检

写在前面的话 这是一篇旧文档&#xff0c;代码仓库见 https://gitee.com/tanyunxiu/AR-pipe 本文档是基于超图移动端SDK的AR模块开发的示例&#xff0c;仅供参考&#xff0c;SDK在持续迭代中&#xff0c;相关描述可能有变化。 示例介绍 这是一个使用AR查看墙内管线的基础示…

授权协议OAuth 2.0之除了授权码许可还有什么授权流程?

写在前面 源码 。 本文看下OAuth2.0的另外3中授权流程&#xff0c;资源拥有者凭据许可&#xff0c;客户端许可&#xff0c;隐式许可。分别看下具体的使用流程以及该使用场景。 1&#xff1a;资源拥有者凭据许可 资源拥有者凭据许可&#xff0c;这里资源拥有者的凭据是什么呢&…

【C++核心】面向对象的三大特性

面向对象的三大特性 一、封装性1. 封装性的意义1.1 表现事物1.2 权限控制1.3 成员属性设置为私有 2. 封装性的衍生知识2.1 struct和class区别2.2 友元2.2.1 全局函数做友元2.2.2 类做友元2.2.3 成员函数做友元 二、继承性1. 继承的语法2. 继承方式3. 继承中的对象模型3.1 说明3…

17 如何查看Hadoop中wordCount源码

1.进入官网下载源码并进行解压操作&#xff1a; 我们使用的是hadoop-3.1.4版本&#xff0c;直接进入官网进行下载&#xff1a;https://archive.apache.org/dist/hadoop/common/hadoop-3.1.4/ 下载得到的文件如下图所示&#xff1a; 解压后的文件&#xff1a; 2.使用Idea打开此项…

vue3.0项目生成标签条形码(插件:jsbarcode)并打印(插件:Print.js)支持pda扫码枪扫描

文章目录 功能场景生成条形码设置打印功能踩坑 功能场景 功能场景&#xff1a;供应链中对一些货品根据赋码规则进行赋码&#xff0c;赋码之后生成根据赋码结果生成条形码&#xff0c;执行打印功能&#xff0c;贴在货品之上&#xff0c;打印之后可以用pda的手枪进行扫描&#x…

(亲测有效)win7安装nodejs高版本(18.8.0)

现在学习vue3,vite,使用pnpm创建项目都需要高版本的nodejs了&#xff0c;win7最高只能安装13版本&#xff0c;好多已经不支持了。当然此篇只是以安装18.8.0为例&#xff0c;可以替换成更高的18或者20版本&#xff0c;只是太高的话可能出现冲突&#xff0c;够用就好。希望对各位…

如何修改WordPress数据库表前缀以提高安全性

WordPress作为世界上最受欢迎的内容管理系统之一&#xff0c;吸引了数以百万计的用户。然而&#xff0c;正因为其广泛的使用&#xff0c;WordPress网站也成为了黑客攻击的目标之一。其中一个最常见的安全漏洞是使用默认的数据库表前缀wp_&#xff0c;使得黑客能够更轻松地进行大…

分布式调度器

xxl-job介绍 xxl-job 是一个轻量级分布式任务调度框架&#xff0c;支持动态添加、修改、删除定时任务&#xff0c;支持海量任务分片执行&#xff0c;支持任务执行日志在线查看和分页查询&#xff0c;同时支持任务失败告警和重试机制&#xff0c;支持分布式部署和高可用。xxl-j…

亚马逊云科技官方重磅发布GenAI应用开发学习路线(全免费)

今天小李哥给大家分享的是亚马逊云科技&#xff08;AWS&#xff09;最近官方发布的GenAI应用开发最佳学习路线&#xff0c;不仅内容非常全面更主要的是全部免费&#xff01;大家动动小手就能成为GenAI开发大&#x1f42e;&#xff01; 1️⃣这个GenAI开发学习路线包括什么&…

跟着Datawhale重学数据结构与算法(2)———数组知识

数组定义 数组是一种数据结构&#xff0c;用于存储一系列相同类型的元素。在大多数编程语言中&#xff0c;数组中的每个元素都有一个索引&#xff0c;通常从0开始。 数组的特点 固定大小&#xff1a;一旦定义&#xff0c;数组的大小通常是固定的&#xff0c;不能动态增减。相…

虚拟机数据恢复—KVM虚拟机磁盘文件数据恢复案例

虚拟化数据恢复环境&故障&#xff1a; KVM是Kernel-based Virtual Machine的简称&#xff0c;是一个开源的系统虚拟化模块&#xff0c;自Linux2.6.20版本之后集成在Linux的各个主要发行版本中。KVM使用Linux自身的调度器进行管理。 本案例中的服务器操作系统为Linux&#x…
最新文章