Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >如何在C#中启用图片框上的绘图

如何在C#中启用图片框上的绘图
EN

Stack Overflow用户
提问于 2019-09-01 01:16:06
回答 1查看 395关注 0票数 0

我正在尝试使用投影的思想来绘制一个由许多节点组成的网络拓扑,就像一个3D节点一样,但是当我点击应该实现代码的按钮时,什么也没有出现!以下是主要代码:

代码语言:javascript
运行
AI代码解释
复制
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Media;
using System.Text;
using System.Windows.Forms;
using AUV_Topology.AUV_Topology;
using AUV_Topology;

namespace AUV_Topology
{
    public partial class Form2 : Form
    {
        private int iSetupDisplay = -1; // used for making drawing on the graphics 
        static int NodeNum = 0; // an int number is given for each node 
        static bool deploymentButtonWasClicked = false; // flag to check if button "Deploy" is clicked 
        static Sink sink; // sink object from sink class 
        static SensorNode[] SNs;  // array of SNs   
        static int[,] SNsLocation; // to store SN locations 
        static int[,] SNsNighbors; // to store each SN nighbors 
        static int[] SinkNighbors; // to store each SN nighbors 
        static int transmissionRange; // the transmission range for each sensor node
        static double sensorNodeIntialEnergy; // in order to store the energy filled in the text box in the GUI 
        System.IO.StreamWriter writer; // declare a writer object from the straem writer class 
        static Random r = new Random(); // in order to generate a random number 
        static AUV[] auv; // array of AUVs objects from AUV class 
        static int rows, columns; // to get the number of rows and columns from the text boxes in the GUI 
        static int[,] cellsCenters; // an array to store the indexes (col & row) for each center for each cell in the grid topology
        static int[] columnsXs; // the index of each X cordinates in each column 
        static int[] rowsYs; // the index of each Y cordinates
        static int numOfCells; // compute the number of cells by multpling the rows with columns
        static int cellSide; // to compute the length of each side for each cell 

        public Form2()
        {
            InitializeComponent();
            // Create a file for output named TraceFile.txt.
            Stream myFile = File.Create("C:/Users/AMCT/Desktop/TraceFile2.txt");
            TextWriterTraceListener myTextListener = new TextWriterTraceListener(myFile);
            Trace.Listeners.Add(myTextListener);
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        public delegate void UpdateControlsDelegate();

        [TypeConverter(typeof(ExpandableObjectConverter))]
        public struct Point3D
        {
            public int X { get; set; }
            public int Y { get; set; }
            public int Z { get; set; }
            public Point3D(int x, int y, int z) : this()
            {
                this.X = x;
                this.Y = y;
                this.Z = z;
            }
        }

        public static SoundPlayer player = new SoundPlayer("C:/Users/AMCT/Desktop/project/C#-Code-VisualStudio-2010/GAAPS/Sonar_pings.wav");
        public static int tr;

        //***Deployment***//

        #region nodesDeployment

        private void nodesDeployment_Click_1(object sender, EventArgs e)
        {
            //chromosome size
            rows = 10;
            columns = 10;
            int numOfGridCells = rows * columns; // Calculate the total number of the cells for the grid topology 
            tr = Convert.ToInt32(TransRange.Text);
            calculateCellsCenters(200, 200, 700, 700, numOfGridCells, 500, 500); // Compute all the center points (Xc,Yc) for all cells of the partitioned region (grid) 
            if (NumSN.Text != string.Empty) // to check that the user has entered the number of nodes for this topology 
            {
                topology2.Visible = true;
                NodeNum = Convert.ToInt32(NumSN.Text); // get the number from the text box
                sensorNodeIntialEnergy = Convert.ToDouble(SNEnergy.Text);
                Point3D[] auvLocation2D = new Point3D[4];
                for (int i = 0; i < 4; i++)
                    auvLocation2D[i] = new Point3D(cellsCenters[0, 0], cellsCenters[1, 8], 700 - i * 100);
                Point3D p3d = new Point3D(542, 600, 210);
                PointF point2Dsink = Project(p3d);
                sink = new Sink("Sink", 1, point2Dsink.X, point2Dsink.Y, 100);
                auv = new AUV[4];
                for (int i = 0; i < 4; i++)
                {
                    PointF point2D = Project(auvLocation2D[i]);
                    int d = 700 - i * 100;
                    auv[i] = new AUV(point2D.X, point2D.Y, d, sink, i);
                }
                SNs = new SensorNode[NodeNum];
                for (int i = 0; i < NodeNum; i++)
                    SNs[i] = new SensorNode(i, "SN" + i, r.Next(355, 750) % (topology2.Width), sensorNodeIntialEnergy, sink, auv[0], 0);
                nodesCoordinations(); // choose XY coordinates for each sensor node 
                generateRoutingTable(); // build the routing table for each sensor node
                deploymentButtonWasClicked = true;
            }
            makeDrawing(); // Draw
        }

        #endregion

        //***Nodes Coordinates***//

        #region Nodes Coordinates ( used by deployment process ) 

        public void nodesCoordinations()
        {
            SNsLocation = new int[2, NodeNum]; // build an array of size n which is equal to the number of nodes that was chosen by the user to store all SNs locations

            # region SNs Locations

            for (int i = 0; i < NodeNum; i++)
                if (NodeNum != 0)
                {
                    SNsLocation[0, i] = r.Next(300, 800) % (topology2.Width); // choose random X coordinate between 300 & 800 pixel
                    SNsLocation[1, i] = r.Next(260, 725) % (topology2.Width); // choose random Y coordinate between 260 & 725 pixel 
                }
        }

        # endregion

        public void generateRoutingTable()
        {

            /// Size of SNsNighbors Array = [node #, Nighbors #]
            double D; // Euclidean distance 
            SNsNighbors = new int[NodeNum, NodeNum];
            SinkNighbors = new int[NodeNum];
            transmissionRange = Convert.ToInt32(TransRange.Text);

            /// This Method estimate the Euclidean distance between SNs = (D)
            /// Suppose that the transmission rane for all nodes = 150
            /// if d <= Transmission Rang of SNi, SNi can communicate with SNj 
            for (int i = 0; i < NodeNum; i++) // For all SNs
                for (int j = 0; j < NodeNum; j++) // For all SNs
                {
                    if (i != j)
                    {
                        double Xn = SNsLocation[0, i]; // 0 for x - axis 
                        double Yn = SNsLocation[1, i]; // 1 for y - axis 
                        double Xs = SNsLocation[0, j]; // 0 for x - axis
                        double Ys = SNsLocation[1, j]; // 1 for y - axis
                        D = Math.Pow((Math.Pow(Xn - Xs, 2) + Math.Pow(Yn - Ys, 2)), 0.5);
                        // the transmission range is 150 
                        if (D <= transmissionRange)
                            SNsNighbors[i, j] = 1; // SNj is nighbore for SNi
                        else
                            SNsNighbors[i, j] = 0; // SNj is NOT nighbore for SNi
                    }
                    else
                        SNsNighbors[i, j] = 0; // SNj is NOT nighbore for SNi
                }
        }

        #endregion nodesDeployment

        //***Paint  Handlers***//

        #region Paint  handlers

        private void topology_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Font font = new Font("Times New Roman", 7.0f); // choose the type of font and its size
            StringFormat format = new StringFormat(); // declare string format
            format.Alignment = StringAlignment.Center; // declare string alignment
            Graphics g = e.Graphics;
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; // declare the quality for the drawings
            Pen transmissionRangeColor = Pens.LightCyan; // the color used to draw the ellipse which repesents the transmission range for each node 
            Pen nodeNieghbors = Pens.LightSeaGreen; // the color used to draw the green lines between sensor nodes which indicates direct connection between nodes 
            Pen sinkNieghbors = Pens.Azure;
            Brush nodeName = Brushes.White; // the color used for strings used to name the nodes 
            Brush auvSendMsg = Brushes.Red; // the color used for strings used to name the nodes 

            #region Display Sink

            if (deploymentButtonWasClicked) // chech if the "Deploy" button was clicked
            {

                DrawImage("C:/Users/AMCT/Desktop/project/C#-Code-VisualStudio-2010/GAAPS/Sink.png", e.Graphics, sink.sinkX, sink.sinkY, 35, 45);
                DrawString("Sink", e.Graphics, font, nodeName, new Point3D(600, 600 + 34, 233), 5);// Display the sink name

                #region Draw Grid

                topology2.Invalidate();
                DrawGrid(numOfCells, cellSide, 800, e.Graphics);
                DrawGrid(numOfCells, cellSide, 700, e.Graphics);
                DrawGrid(numOfCells, cellSide, 600, e.Graphics);
                DrawGrid(numOfCells, cellSide, 500, e.Graphics);
                DrawGrid(numOfCells, cellSide, 400, e.Graphics);
                for (int j = 0; j < rows; j++)
                    for (int i = 0; i < columns; i++)
                    {
                        DrawRectangle(e.Graphics, Brushes.SteelBlue, new Point3D(cellsCenters[0, i], cellsCenters[1, j], 800));
                        DrawRectangle(e.Graphics, Brushes.SteelBlue, new Point3D(cellsCenters[0, i], cellsCenters[1, j], 700));
                        DrawRectangle(e.Graphics, Brushes.SteelBlue, new Point3D(cellsCenters[0, i], cellsCenters[1, j], 600));
                        DrawRectangle(e.Graphics, Brushes.SteelBlue, new Point3D(cellsCenters[0, i], cellsCenters[1, j], 500));
                        DrawRectangle(e.Graphics, Brushes.SteelBlue, new Point3D(cellsCenters[0, i], cellsCenters[1, j], 400));
                    }
                base.OnPaint(e);

                #endregion

                #region Display Sensor Nodes

                /// node[0,i] means >> x-axis 
                /// node [1,i] means >> y-axis

                for (int n = 0; n < NodeNum; n++)
                {
                    DrawSensor(new Point3D(SNsLocation[0, n], SNsLocation[1, n], 760), new Point3D(SNsLocation[0, n], SNsLocation[1, n], SNs[n].snDepth), e.Graphics);
                    //DrawTransmissionRange(e.Graphics, transmissionRangeColor, new Point3D(SNsLocation[0, n],SNsLocation[1, n],SNs[n].snDepth), transmissionRange);
                    DrawString("SN" + (n + 1), e.Graphics, font, nodeName, new Point3D(SNsLocation[0, n] - 30, SNsLocation[1, n] - 10, SNs[n].snDepth), 12); // display node name
                    /*for (int i = 0; i < NodeNum - 1; i++)
                    {
                        if (SNsNighbors[n, i] == 1) // Green line between nieghbors
                            DrawLine(e.Graphics, nodeNieghbors, new Point3D(SNsLocation[0, n] + 5, SNsLocation[1, n] + 5, SNs[n].snDepth), new Point3D(SNsLocation[0, i] + 5, SNsLocation[1, i] + 5,SNs[i].snDepth));
                    }*/
                }

                #endregion

                #region AUV-Animation

                for (int i = 0; i < 4; i++)
                {
                    DrawImage("C:/Users/AMCT/Desktop/project/C#-Code-VisualStudio-2010/GAAPS/AUVs-Icon.png", e.Graphics, auv[i].auvX, auv[i].auvY, 45, 20);
                    base.OnPaint(e);
                }
            }

            #endregion

            # endregion

            // finish painting
        }

        /// <summary>
        /// Draws a sensor at the specified position(s)
        /// </summary>
        private void DrawSensor(Point3D from, Point3D to, Graphics gr)
        {
            DrawLine(gr, Pens.Maroon, from, to);
            DrawSphere(gr, Pens.Black, Brushes.Gold, to, 6);
        }

        /// <summary>
        /// Draws a sensor at the specified position(s)
        /// </summary>
        private void DrawSendingSensor(Point3D from, Point3D to, Graphics gr)
        {
            DrawLine(gr, Pens.Maroon, from, to);
            DrawSphere(gr, Pens.Black, Brushes.Black, to, 6);
        }

        /// <summary>
        /// Draws a sphere as a Circle at the specified position
        /// </summary>
        private void DrawSphere(Graphics gr, Pen outline, Brush fill, Point3D center, float radius)
        {
            PointF center2D = Project(center);
            gr.FillEllipse(fill, center2D.X - radius, center2D.Y - radius, radius * 2, radius * 2);
            gr.DrawEllipse(outline, center2D.X - radius, center2D.Y - radius, radius * 2, radius * 2);
        }

        /// <summary>
        /// Draws the grid at the specified depth
        /// </summary>
        private void DrawGrid(int numOfCells, int cellSize, int depth, Graphics gr)
        {
            Pen p = Pens.SteelBlue;
            for (int i = 0; i < Math.Sqrt(numOfCells) + 1; i++)
            {
                // Vertical
                DrawLine(gr, p, new Point3D(i * cellSize + 200, 200, depth), new Point3D(i * cellSize + 200, 700, depth));
                // Horizontal
                DrawLine(gr, p, new Point3D(200, i * cellSize + 200, depth), new Point3D(700, i * cellSize + 200, depth));
            }
        }

        /// <summary>
        /// Draws a line from one 3DPoint to another
        /// </summary>
        private void DrawLine(Graphics graphics, Pen pen, Point3D p1, Point3D p2)
        {
            PointF pointFrom = Project(p1);
            PointF pointTo = Project(p2);
            graphics.DrawLine(pen, pointFrom, pointTo);
        }

        /// <summary>
        /// Draws a small Rectangle to represent the center point for each cell in the grid 
        /// </summary>
        private void DrawRectangle(Graphics graphics, Brush brush, Point3D center)
        {
            PointF center2D = Project(center);
            graphics.FillRectangle(brush, center2D.X, center2D.Y, 2, 2);
        }

        /// <summary>
        /// Projects a Point3D to a PointF
        /// </summary>
        /// 
        /// <summary>
        /// Draws a string at the specified position
        /// </summary>
        private void DrawString(String s, Graphics gr, Font f, Brush fill, Point3D center, float radius)
        {
            PointF center2D = Project(center);
            gr.DrawString(s, f, fill, center2D.X - radius, center2D.Y - radius);
        }

        /// <summary>
        /// Draws a string at the specified position
        /// </summary>
        private void DrawImage(String path, Graphics gr, float x, float y, int rectX, int rectY)
        {
            gr.DrawImage(new Bitmap(path), new Rectangle((int)x, (int)y, rectX, rectY)); // draw AUV
        }

        /// <summary>
        /// Draws a transmission range for each node at the specified position
        /// </summary>
        private void DrawTransmissionRange(Graphics gr, Pen color, Point3D center, int tRange)
        {
            PointF center2D = Project(center);
            gr.DrawEllipse(color, center2D.X - (tRange / 2) + 5, center2D.Y - (tRange / 2) + 5, tRange, tRange); // draw the tranmission range of node  
        }

        /// <summary>
        /// Converts from 3D point to 2D point
        /// </summary>

        private PointF Project(Point3D p)
        {
            Perspective per = new Perspective();
            return per.Project(p);
        }

        #endregion

        #region Cells Center Points 

        public void calculateCellsCenters(int intialPointX, int intialPointY, int lastPointX, int lastPointY, int cells, int squareGridX, int squareGridY)
        {
            double diagonalLengthEachCell;
            numOfCells = cells;
            int netArea = squareGridX * squareGridY;
            double cellArea = netArea / numOfCells;
            FileStream fs = new FileStream("C:/Users/AMCT/Desktop/testPositions.txt", FileMode.Append, FileAccess.Write);
            cellSide = (int)Math.Sqrt(cellArea);
            int centerPointEachCell;
            columnsXs = new int[columns + 1];
            cellsCenters = new int[2, rows]; // 0 for the point on the x axis and 1 for the point on the y axis so this is why the first element of size 2
            rowsYs = new int[rows + 1];
            diagonalLengthEachCell = cellSide * Math.Sqrt(2);
            centerPointEachCell = (int)diagonalLengthEachCell / 3;
            columnsXs[0] = intialPointX; //  to let the first point for the first column equal to 300 later on

            //Calculate The Columns Points
            for (int k = 1; k < (columns + 1); k++)
                columnsXs[k] = columnsXs[k - 1] + cellSide;
            rowsYs[0] = intialPointY; // its equal to 175 in our case to let the first pint for the first column equal to 200 later on

            //Calculate The Rows Points
            for (int s = 1; s < (rows + 1); s++)

                rowsYs[s] = rowsYs[s - 1] + cellSide;

            /***calculate-centers***/
            using (StreamWriter sw = new StreamWriter(fs))
            {
                for (int i = 0; i < rows; i++)
                {
                    cellsCenters[1, i] = rowsYs[i] + centerPointEachCell;
                    for (int j = 0; j < columns; j++)
                    {
                        cellsCenters[0, j] = columnsXs[j] + centerPointEachCell;
                        sw.Write("({0},{1}) ", cellsCenters[0, j], cellsCenters[1, i]);
                    }
                    sw.WriteLine();
                }
            }
        }

        #endregion

        public void makeDrawing()
        {
            iSetupDisplay = 0;
            if (iSetupDisplay != -1)
            {
                iSetupDisplay += 10;
                if (iSetupDisplay >= topology2.Width)
                    iSetupDisplay = -1;
                topology2.Refresh();
            }
        }
    }
}

我在前面的代码中使用了此方法来启用绘图:

代码语言:javascript
运行
AI代码解释
复制
public void makeDrawing()
{
    iSetupDisplay = 0;
    if (iSetupDisplay != -1)
    {
        iSetupDisplay += 10;
        if (iSetupDisplay >= topology2.Width)
            iSetupDisplay = -1;
        topology2.Refresh();
    }
}

但是我不能得到我想要的画在图片盒上的东西!下面的代码是我用来进行投影的代码:

代码语言:javascript
运行
AI代码解释
复制
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using AUVtopology;

namespace AUV_Topology
{
    [TypeConverter(typeof(ExpandableObjectConverter))]

    public class Perspective
    {
        public float X_shift { get; set; }
        public float Y_shift { get; set; }
        public float X_x { get; set; }
        public float X_y { get; set; }
        public float X_z { get; set; }
        public float Y_x { get; set; }
        public float Y_y { get; set; }
        public float Y_z { get; set; }
        public Perspective()
        {
            this.X_shift = 420;
            this.Y_shift = -400;
            this.X_x = -0.4f;
            this.X_y = 1.0f;
            this.X_z = 0.0f;
            this.Y_x = 0.4f;
            this.Y_y = 0.0f;
            this.Y_z = 1.0f;
        }

        public PointF Project(Form1.Point3D p)
        {
            return new PointF(X_shift + X_x * p.X + X_y * p.Y + X_z * p.Z, Y_shift + Y_x * p.X + Y_y * p.Y + Y_z * p.Z);
        }

        public PointF Project(Form2.Point3D p)
        {
            return new PointF(X_shift + X_x * p.X + X_y * p.Y + X_z * p.Z, Y_shift + Y_x * p.X + Y_y * p.Y + Y_z * p.Z);
        }
    }

    public class PerspectiveGrid : Control
    {
        private Perspective _perspective;
        public Perspective Perspective
        {
            get { return _perspective; }
            set
            {
                _perspective = value;
                Invalidate();
            }
        }

        public PerspectiveGrid()
        {
            Perspective = new Perspective
            {
                X_shift = 420,
                Y_shift = -400,
                X_x = -0.4f,
                X_y = 1.0f,
                X_z = 0.0f,
                Y_x = 0.4f,
                Y_y = 0.0f,
                Y_z = 1.0f,
            };
        }
    }
}

问题出在我用来启用绘图的方法还是别的什么?!

EN

回答 1

Stack Overflow用户

发布于 2019-09-01 02:52:04

很简单。您只需要获取图像框的图形上下文。

代码语言:javascript
运行
AI代码解释
复制
Graphics g = Graphics.FromImage(this.pictureBox1.Image);

在此之后,您可以使用我的示例中的"g“来绘制任何您想要绘制的线条,等等。这并不是说这仍然需要您在绘制到图片框后使其无效,但您不必将绘制代码放在Form_Paint中,也不需要打乱缓冲设置。就我个人而言,我更喜欢这种方法而不是在Form_paint中绘制,因为它是持久的,并且不必(手动)在每一帧中重新绘制。

要证明它有效,请执行以下操作:

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57742575

复制
相关文章
网页防止复制js代码
第一种 {tabs-pane label="代码"} document.body.oncontextmenu=document.body.ondragstart= document.body.onselectstart=document.body.onbeforecopy=function(){return false;}; document.body.onselect=document.body.oncopy=document.body.onmouseup=function(){document.sele
堡主
2023/03/04
18K0
镜像分层原理及容器层写时复制
在进行docker pull 下载镜像的时候,通过下图可以看到镜像是分层下载并解压的。如nginx:1.20.2的镜像,其镜像是分为6层。
用户7353950
2022/06/23
5280
镜像分层原理及容器层写时复制
防止网站被镜像
查看自己的网站是否被镜像 在搜索引擎中搜索自己网站的完整标题 语法:intitle 你的网站标题 JS跳转 <script type="text/javascript"> if (document.domain !== 'www.roaing.com'){ window.location.href='https://www.roaing.com'; } </script> 注:域名修改为自己的 屏蔽镜像站IP .htaccess文件,添加如下代码 Order Allow,De
R0A1NG
2022/02/18
9830
博客网站保护版权,防止复制查看源代码的方法
放入WordPress主题文件footer.php最下方(/body前面)即可,效果图如下:
小狐狸说事
2023/01/06
8140
博客网站保护版权,防止复制查看源代码的方法
linux内核写时复制机制源代码解读
韩传华,就职于国内一家半导体公司,主要从事linux相关系统软件开发工作,负责Soc芯片BringUp及系统软件开发,乐于分享喜欢学习,喜欢专研Linux内核源代码。
Linux阅码场
2020/09/01
4.8K0
jQuery 双击事件(dblclick)时,不触发单击事件(click)
在jQuery的事件绑定中,执行双击事件(dblclick)时能触发两次单击事件(click)。即一个标签元素(如div等),如果元素同时绑定了单击事件(click)和双击事件(dblclick),那么执行单击事件(click)时,不会触发双击事件(dblclick), 执行双击事件(dblclick)时却会触发两次单击事件(click)。 先看一下点击事件的执行顺序:
飞奔去旅行
2019/06/13
5.4K0
清空代码防止查看源代码
<html> <head> <script language="javascript"> function clear(){  Source=document.body.firstChild.data;  document.open();  document.close();  document.title="看不到源代码";  document.body.innerHTML=Source; } </script> </head> <body onload=clear()> </body> </html> 
跟着阿笨一起玩NET
2018/09/18
7180
防止网站被恶意镜像或反向代理
首先介绍一下防止镜像的思路,由于有之前使用PHP实现301跳转的经验,所以这次也是在服务器层面进行301跳转的处理。
团团生活志
2022/08/16
6650
phpCOW机制(写时复制)
写时复制(Copy-on-Write,也缩写为COW),顾名思义,就是在写入时才真正复制一份内存进行修改。 COW最早应用在*nix系统中对线程与内存使用的优化,后面广泛的被使用在各种编程语言中,如C++的STL等。 在PHP内核中,COW也是主要的内存优化手段。 在前面关于变量和内存的讨论中,引用计数对变量的销毁与回收中起着至关重要的标识作用。 引用计数存在的意义,就是为了使得COW可以正常运作,从而实现对内存的优化使用。
仙士可
2019/12/19
6520
phpCOW机制(写时复制)
写时复制集合 —— CopyOnWriteArrayList
" JUC 下面还有一个系列的类,都是 CopyOnWriteXXX ,意思是写时复制,这个究竟是怎么回事?那就以 CopyOnWriteArrayList 为切入点,一起了解写时复制是怎么回事? "
程序员小航
2020/11/23
6280
写时复制集合 —— CopyOnWriteArrayList
防止iframe代码分享
看上图:又抓住两个iframe镜像我的域名了,但是我已经不怕了,因为我从上次就吸取教训,加上了防iframe的代码 在此我把代码分享给大家,虽然我也还是网上找的,但是网上很多都无效,但是这个代码我亲测,百试百灵! 代码请加在网站首页,不会加的联系我! <script> this.top.location !== this.location && (this.top.location = this.location); </script>
Youngxj
2018/06/07
1.3K0
容器镜像之腾挪大法: Harbor镜像远程复制视频演示
(本文发布时,Harbor在Github上已获得2875颗星:https://github.com/vmware/harbor)
Henry Zhang
2019/04/12
1.2K0
容器镜像之腾挪大法: Harbor镜像远程复制视频演示
docker导出所有镜像_怎么把docker镜像复制出来
本文由 qingchuwudi 译制或原创,除非另有声明,在不与原著版权冲突的前提下,本作品采用署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)进行许可。
全栈程序员站长
2022/10/04
1.8K0
PageGuard.js 防止网站内容复制和检测开发者工具代码
检测开发者工具的话,整合了各种较新的方法,经测试是支持 Chrome (包括单独窗口打开的情况)和 Firefox (在单独窗口打开时,只有打开控制台时才能检测到),其他浏览器还没有测试,不过估计 chromium 内核的浏览器也都是支持的
网站那些事
2018/05/06
4.5K5
PageGuard.js 防止网站内容复制和检测开发者工具代码
选择篇(039)-单击按钮时event.target是什么?
导致事件的最深嵌套元素是事件的目标。你可以通过event.stopPropagation停止冒泡
齐丶先丶森
2022/05/12
1.6K0
Android应用防止so注入防止动态调试参考代码
由于公司应用需要过安全测试,测试那边说有so注入漏洞,所以找到了这份代码,并成功通过测试。
用户1696846
2019/12/30
3.7K0
php7 写时复制
在《php7引用计数》的文章中,我们知道,对于复制类型的变量,在赋值时,我们并没有重新复制一份数据,而是让新变量的zend_value中相应的指针指向原来的数据,同时增加引用计数。
跑马溜溜的球
2020/12/07
3.5K0
php7 写时复制
写时复制技术(详解版)
我们知道了一个进程如何采用请求调页,仅调入包括第一条指令的页面,从而能够很 快开始执行。然而,通过系统调用 fork() 的进程创建最初可以通过使用类似于页面共享的技术,绕过请求调页的需要。这种技术提供了快速的进程创建,并最小化必须分配给新创建进程的新页面的数量。
用户5546570
2020/02/13
1.7K1
Android应用防止so注入防止动态调试参考代码
由于公司应用需要过安全测试,测试那边说有so注入漏洞,所以找到了这份代码,并成功通过测试。
用户1696846
2023/08/25
6840
写时复制技术详解(COW)
写时复制(Copy-on-write,简称COW)是一种计算机程序设计领域的优化策略。其核心思想是,如果有多个调用者(callers)同时请求相同资源(如内存或磁盘上的数据存储),他们会共同获取相同的指针指向相同的资源,直到某个调用者试图修改资源的内容时,系统才会真正复制一份专用副本(private copy)给该调用者,而其他调用者所见到的最初的资源仍然保持不变。这过程对其他的调用者都是透明的。此作法主要的优点是如果调用者没有修改该资源,就不会有副本(private copy)被创建,因此多个调用者只是读取操作时可以共享同一份资源。
小梁编程汇
2021/12/08
5.3K0

相似问题

CSS在jsp、tomcat和servlet中未正确加载

20

JS和CSS不在html中加载

32

Servlet重定向错误/ jsp无法加载css

24

CSS和JS文件不在Laravel中加载。

26

路径404在jsp/servlet中加载js文件

12
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文