C#图片加文字、图片水印

C# 给图片加上文字或图片水印 C# 给图片加上文字或图片水印,通过使用GDI+ 给图片上加水印。实现了透明文字与透明图片水印。可设置水印位置。 立即下载

using System;   

using System.Drawing;   

using System.Drawing.Imaging;   

using System.Drawing.Drawing2D;   

using System.IO;   

/// <summary>   

/// 图片位置   

/// </summary>   

public enum ImagePosition   

{   

    LeftTop,        //左上   

    LeftBottom,    //左下   

    RightTop,       //右上   

    RigthBottom,  //右下   

    TopMiddle,     //顶部居中   

    BottomMiddle, //底部居中   

    Center           //中心   

}   

   

/// <summary>   

/// 水印图片的操作管理 Design by Gary Gong From Demetersoft.com   

/// </summary>   

public class WaterImageManage   

{   

    /// <summary>   

    /// 生成一个新的水印图片制作实例   

    /// </summary>   

    public WaterImageManage ()   

    {   

        //   

        // TODO: Add constructor logic here   

        //   

    }   

   

    /// <summary>   

    /// 添加图片水印   

    /// </summary>   

    /// <param name="sourcePicture">源图片文件名</param>   

    /// <param name="waterImage">水印图片文件名</param>   

    /// <param name="alpha">透明度(0.1-1.0数值越小透明度越高)</param>   

    /// <param name="position">位置</param>   

    /// <param name="PicturePath" >图片的路径</param>   

    /// <returns>返回生成于指定文件夹下的水印文件名</returns>   

    public string  DrawImage(string sourcePicture,   

                                      string waterImage,   

                                      float alpha,   

                                      ImagePosition position,   

                                      string PicturePath )   

    {   

        //   

        // 判断参数是否有效   

        //   

        if (sourcePicture == string.Empty || waterImage == string.Empty || alpha == 0.0 || PicturePath == string.Empty)   

        {   

            return sourcePicture;   

        }   

   

        //   

        // 源图片,水印图片全路径   

        //   

        string sourcePictureName = PicturePath + sourcePicture;   

        string waterPictureName = PicturePath + waterImage;   

        string fileSourceExtension = System.IO.Path.GetExtension(sourcePictureName).ToLower();   

        string fileWaterExtension = System.IO.Path.GetExtension(waterPictureName).ToLower();   

        //   

        // 判断文件是否存在,以及类型是否正确   

        //   

        if (System.IO.File.Exists(sourcePictureName) == false ||    

            System.IO.File.Exists(waterPictureName) == false ||(   

            fileSourceExtension != ".gif" &&   

            fileSourceExtension != ".jpg" &&   

            fileSourceExtension != ".png") || (   

            fileWaterExtension != ".gif" &&   

            fileWaterExtension != ".jpg" &&   

            fileWaterExtension != ".png")   

            )   

        {   

            return sourcePicture;   

        }   

   

        //   

        // 目标图片名称及全路径   

        //   

        string targetImage = sourcePictureName.Replace ( System.IO.Path.GetExtension(sourcePictureName),"") + "_1101.jpg";   

   

        //   

        // 将需要加上水印的图片装载到Image对象中   

        //   

        Image imgPhoto = Image.FromFile(sourcePictureName);   

        //   

        // 确定其长宽   

        //   

        int phWidth = imgPhoto.Width;   

        int phHeight = imgPhoto.Height;   

   

        //   

        // 封装 GDI+ 位图,此位图由图形图像及其属性的像素数据组成。   

        //   

        Bitmap bmPhoto = new Bitmap(phWidth, phHeight, PixelFormat.Format24bppRgb);   

   

        //   

        // 设定分辨率   

        //    

        bmPhoto.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution);   

   

        //   

        // 定义一个绘图画面用来装载位图   

        //   

        Graphics grPhoto = Graphics.FromImage(bmPhoto);   

   

        //   

        //同样,由于水印是图片,我们也需要定义一个Image来装载它   

        //   

        Image imgWatermark = new Bitmap(waterPictureName);   

           

        //   

        // 获取水印图片的高度和宽度   

        //   

        int wmWidth = imgWatermark.Width;   

        int wmHeight = imgWatermark.Height;   

   

        //SmoothingMode:指定是否将平滑处理(消除锯齿)应用于直线、曲线和已填充区域的边缘。   

        // 成员名称   说明    

        // AntiAlias      指定消除锯齿的呈现。     

        // Default        指定不消除锯齿。     

        // HighQuality  指定高质量、低速度呈现。     

        // HighSpeed   指定高速度、低质量呈现。     

        // Invalid        指定一个无效模式。     

        // None          指定不消除锯齿。    

        grPhoto.SmoothingMode = SmoothingMode.AntiAlias;   

   

        //   

        // 第一次描绘,将我们的底图描绘在绘图画面上   

        //   

        grPhoto.DrawImage(imgPhoto,                                             

                                    new Rectangle(0, 0, phWidth, phHeight),    

                                    0,        

                                    0,          

                                    phWidth,      

                                    phHeight,         

                                    GraphicsUnit.Pixel);       

   

        //   

        // 与底图一样,我们需要一个位图来装载水印图片。并设定其分辨率   

        //   

        Bitmap bmWatermark = new Bitmap(bmPhoto);   

        bmWatermark.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution);   

           

        //   

        // 继续,将水印图片装载到一个绘图画面grWatermark   

        //   

        Graphics grWatermark = Graphics.FromImage(bmWatermark);   

   

        //   

        //ImageAttributes 对象包含有关在呈现时如何操作位图和图元文件颜色的信息。   

        //          

        ImageAttributes imageAttributes = new ImageAttributes();   

   

        //   

        //Colormap: 定义转换颜色的映射   

        //   

        ColorMap colorMap = new ColorMap();   

   

        //   

        //我的水印图被定义成拥有绿色背景色的图片被替换成透明   

        //   

        colorMap.OldColor = Color.FromArgb(255, 0, 255, 0);   

        colorMap.NewColor = Color.FromArgb(0, 0, 0, 0);   

   

        ColorMap[] remapTable = { colorMap };   

   

        imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap);   

   

        float[][] colorMatrixElements = {    

           new float[] {1.0f,  0.0f,  0.0f,  0.0f, 0.0f}, // red红色   

           new float[] {0.0f,  1.0f,  0.0f,  0.0f, 0.0f}, //green绿色   

           new float[] {0.0f,  0.0f,  1.0f,  0.0f, 0.0f}, //blue蓝色          

           new float[] {0.0f,  0.0f,  0.0f,  alpha, 0.0f}, //透明度        

           new float[] {0.0f,  0.0f,  0.0f,  0.0f, 1.0f}};//   

   

        //  ColorMatrix:定义包含 RGBA 空间坐标的 5 x 5 矩阵。   

        //  ImageAttributes 类的若干方法通过使用颜色矩阵调整图像颜色。   

        ColorMatrix wmColorMatrix = new ColorMatrix(colorMatrixElements);   

   

   

        imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default,   

         ColorAdjustType.Bitmap);   

   

        //   

        //上面设置完颜色,下面开始设置位置   

        //   

        int xPosOfWm;   

        int yPosOfWm;    

   

        switch (position)   

        {   

            case ImagePosition .BottomMiddle :   

                xPosOfWm = (phWidth-wmWidth ) / 2 ;   

                yPosOfWm = phHeight- wmHeight -10;   

                break ;   

            case ImagePosition .Center :   

                xPosOfWm = (phWidth - wmWidth) / 2;   

                yPosOfWm = (phHeight-wmHeight ) / 2;   

                break ;   

            case ImagePosition .LeftBottom :   

                xPosOfWm = 10;   

                yPosOfWm = phHeight - wmHeight - 10;   

                break ;   

            case ImagePosition .LeftTop :   

                xPosOfWm = 10;   

                yPosOfWm = 10;   

                break;   

            case ImagePosition .RightTop :   

                xPosOfWm = phWidth - wmWidth - 10;   

                yPosOfWm = 10;   

                break ;   

            case ImagePosition .RigthBottom :   

                xPosOfWm = phWidth - wmWidth - 10;   

                yPosOfWm = phHeight - wmHeight - 10;   

                break ;   

            case ImagePosition.TopMiddle :   

                xPosOfWm = (phWidth - wmWidth) / 2;   

                yPosOfWm = 10;   

                break ;   

            default:   

                xPosOfWm = 10;   

                yPosOfWm = phHeight - wmHeight - 10;   

                break;   

        }   

   

        //   

        // 第二次绘图,把水印印上去   

        //   

        grWatermark.DrawImage(imgWatermark,   

         new Rectangle(xPosOfWm,   

                             yPosOfWm,   

                             wmWidth,   

                             wmHeight),    

                             0,                 

                             0,             

                             wmWidth,     

                             wmHeight,      

                             GraphicsUnit.Pixel,     

                             imageAttributes);    

   

          

        imgPhoto = bmWatermark;   

        grPhoto.Dispose();   

        grWatermark.Dispose();   

   

        //   

        // 保存文件到服务器的文件夹里面   

        //   

        imgPhoto.Save(targetImage, ImageFormat.Jpeg);   

        imgPhoto.Dispose();   

        imgWatermark.Dispose();   

        return targetImage.Replace (PicturePath,"");   

    }   

   

    /// <summary>   

    /// 在图片上添加水印文字   

    /// </summary>   

    /// <param name="sourcePicture">源图片文件</param>   

    /// <param name="waterWords">需要添加到图片上的文字</param>   

    /// <param name="alpha">透明度</param>   

    /// <param name="position">位置</param>   

    /// <param name="PicturePath">文件路径</param>   

    /// <returns></returns>   

    public string DrawWords(string sourcePicture,   

                                      string waterWords,   

                                      float alpha,   

                                      ImagePosition position,   

                                      string PicturePath)   

    {   

        //   

        // 判断参数是否有效   

        //   

        if (sourcePicture == string.Empty || waterWords == string.Empty || alpha == 0.0 || PicturePath == string.Empty)   

        {   

            return sourcePicture;   

        }   

   

        //   

        // 源图片全路径   

        //   

        string sourcePictureName = PicturePath + sourcePicture;   

        string fileExtension = System.IO.Path.GetExtension(sourcePictureName).ToLower();   

   

        //   

        // 判断文件是否存在,以及文件名是否正确   

        //   

        if (System.IO.File.Exists(sourcePictureName) == false || (   

            fileExtension != ".gif"  &&   

            fileExtension != ".jpg" &&   

            fileExtension != ".png" ))   

        {   

            return sourcePicture;   

        }   

   

        //   

        // 目标图片名称及全路径   

        //   

        string targetImage = sourcePictureName.Replace(System.IO.Path.GetExtension(sourcePictureName), "") + "_0703.jpg";   

   

        //创建一个图片对象用来装载要被添加水印的图片   

        Image imgPhoto = Image.FromFile(sourcePictureName);   

   

        //获取图片的宽和高   

        int phWidth = imgPhoto.Width;   

        int phHeight = imgPhoto.Height;   

   

        //   

        //建立一个bitmap,和我们需要加水印的图片一样大小   

        Bitmap bmPhoto = new Bitmap(phWidth, phHeight, PixelFormat.Format24bppRgb);   

   

        //SetResolution:设置此 Bitmap 的分辨率   

        //这里直接将我们需要添加水印的图片的分辨率赋给了bitmap   

        bmPhoto.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution);   

   

        //Graphics:封装一个 GDI+ 绘图图面。   

        Graphics grPhoto = Graphics.FromImage(bmPhoto);   

   

        //设置图形的品质   

        grPhoto.SmoothingMode = SmoothingMode.AntiAlias;   

   

        //将我们要添加水印的图片按照原始大小描绘(复制)到图形中   

        grPhoto.DrawImage(   

         imgPhoto,                                           //   要添加水印的图片   

         new Rectangle(0, 0, phWidth, phHeight), //  根据要添加的水印图片的宽和高   

         0,                                                     //  X方向从0点开始描绘   

         0,                                                     // Y方向    

         phWidth,                                            //  X方向描绘长度   

         phHeight,                                           //  Y方向描绘长度   

         GraphicsUnit.Pixel);                              // 描绘的单位,这里用的是像素   

   

        //根据图片的大小我们来确定添加上去的文字的大小   

        //在这里我们定义一个数组来确定   

        int[] sizes = new int[] { 16, 14, 12, 10, 8, 6, 4 };   

   

        //字体   

        Font crFont = null;   

        //矩形的宽度和高度,SizeF有三个属性,分别为Height高,width宽,IsEmpty是否为空   

        SizeF crSize = new SizeF();   

   

        //利用一个循环语句来选择我们要添加文字的型号   

        //直到它的长度比图片的宽度小   

        for (int i = 0; i < 7; i++)   

        {   

            crFont = new Font("arial", sizes[i], FontStyle.Bold);   

   

            //测量用指定的 Font 对象绘制并用指定的 StringFormat 对象格式化的指定字符串。   

            crSize = grPhoto.MeasureString(waterWords, crFont);   

   

            // ushort 关键字表示一种整数数据类型   

            if ((ushort)crSize.Width < (ushort)phWidth)   

                break;   

        }   

   

        //截边5%的距离,定义文字显示(由于不同的图片显示的高和宽不同,所以按百分比截取)   

        int yPixlesFromBottom = (int)(phHeight * .05);   

   

        //定义在图片上文字的位置   

        float wmHeight =  crSize.Height;   

        float wmWidth = crSize .Width ;   

   

        float  xPosOfWm;   

        float  yPosOfWm;    

   

        switch (position)   

        {   

            case ImagePosition .BottomMiddle :   

                xPosOfWm = phWidth / 2 ;   

                yPosOfWm = phHeight- wmHeight -10;   

                break ;   

            case ImagePosition .Center :   

                xPosOfWm = phWidth / 2;   

                yPosOfWm = phHeight / 2;   

                break ;   

            case ImagePosition .LeftBottom :   

                xPosOfWm = wmWidth;   

                yPosOfWm = phHeight - wmHeight - 10;   

                break ;   

            case ImagePosition .LeftTop :   

                xPosOfWm = wmWidth/2 ;   

                yPosOfWm = wmHeight / 2;   

                break;   

            case ImagePosition .RightTop :   

                xPosOfWm = phWidth - wmWidth - 10;   

                yPosOfWm = wmHeight;   

                break ;   

            case ImagePosition .RigthBottom :   

                xPosOfWm = phWidth - wmWidth - 10;   

                yPosOfWm = phHeight - wmHeight - 10;   

                break ;   

            case ImagePosition.TopMiddle :   

                xPosOfWm = phWidth / 2;   

                yPosOfWm = wmWidth;   

                break ;   

            default:   

                xPosOfWm = wmWidth;   

                yPosOfWm = phHeight - wmHeight - 10;   

                break;   

        }   

   

        //封装文本布局信息(如对齐、文字方向和 Tab 停靠位),显示操作(如省略号插入和国家标准 (National) 数字替换)和 OpenType 功能。   

        StringFormat StrFormat = new StringFormat();   

   

        //定义需要印的文字居中对齐   

        StrFormat.Alignment = StringAlignment.Center;   

   

        //SolidBrush:定义单色画笔。画笔用于填充图形形状,如矩形、椭圆、扇形、多边形和封闭路径。   

        //这个画笔为描绘阴影的画笔,呈灰色   

        int m_alpha = Convert .ToInt32 ( 256 * alpha);   

        SolidBrush semiTransBrush2 = new SolidBrush(Color.FromArgb(m_alpha, 0, 0, 0));   

   

        //描绘文字信息,这个图层向右和向下偏移一个像素,表示阴影效果   

        //DrawString 在指定矩形并且用指定的 Brush 和 Font 对象绘制指定的文本字符串。   

        grPhoto.DrawString(waterWords,                                    //string of text   

                                   crFont,                                         //font   

                                   semiTransBrush2,                            //Brush   

                                   new PointF(xPosOfWm + 1, yPosOfWm + 1),  //Position   

                                   StrFormat);   

   

        //从四个 ARGB 分量(alpha、红色、绿色和蓝色)值创建 Color 结构,这里设置透明度为153   

        //这个画笔为描绘正式文字的笔刷,呈白色   

        SolidBrush semiTransBrush = new SolidBrush(Color.FromArgb(153, 255, 255, 255));   

   

        //第二次绘制这个图形,建立在第一次描绘的基础上   

        grPhoto.DrawString(waterWords,                 //string of text   

                                   crFont,                                   //font   

                                   semiTransBrush,                           //Brush   

                                   new PointF(xPosOfWm, yPosOfWm),  //Position   

                                   StrFormat);   

   

        //imgPhoto是我们建立的用来装载最终图形的Image对象   

        //bmPhoto是我们用来制作图形的容器,为Bitmap对象   

        imgPhoto = bmPhoto;   

        //释放资源,将定义的Graphics实例grPhoto释放,grPhoto功德圆满   

        grPhoto.Dispose();   

   

        //将grPhoto保存   

        imgPhoto.Save(targetImage, ImageFormat.Jpeg);   

        imgPhoto.Dispose();   

   

        return targetImage.Replace(PicturePath, "");   

    }   

}   

   

/// <summary>   

/// 装载水印图片的相关信息   

/// </summary>   

public class WaterImage   

{   

    public WaterImage ()   

    {   

   

    }   

   

    private string m_sourcePicture;   

    /// <summary>   

    /// 源图片地址名字(带后缀)   

    /// </summary>   

    public string SourcePicture   

    {   

        get { return m_sourcePicture; }   

        set { m_sourcePicture = value; }   

    }   

   

    private string  m_waterImager;   

    /// <summary>   

    /// 水印图片名字(带后缀)   

    /// </summary>   

    public string  WaterPicture   

    {   

        get { return m_waterImager; }   

        set { m_waterImager = value; }   

    }   

   

    private float  m_alpha;   

    /// <summary>   

    /// 水印图片文字的透明度   

    /// </summary>   

    public float  Alpha   

    {   

        get { return m_alpha; }   

        set { m_alpha = value; }   

    }   

   

    private ImagePosition  m_postition;   

    /// <summary>   

    /// 水印图片或文字在图片中的位置   

    /// </summary>   

    public ImagePosition  Position   

    {   

        get { return m_postition; }   

        set { m_postition = value; }   

    }   

   

    private string  m_words;   

    /// <summary>   

    /// 水印文字的内容   

    /// </summary>   

    public string  Words   

    {   

        get { return m_words; }   

        set { m_words = value; }   

    }   

        

} 

 

C# 图片添加水印(图片或者文字) 1、在网上查看了很多 资料,一般合成图片的方法,有两种;这种要简单、灵活些; 2、做成一哥demo,供学习参考; 立即下载

相关推荐

C# 为图片添加水印文字

C# 为图片添加水印文字 一个DEMO。

PDF添加文本或者图片

使用的工具itextsharp,免费的 下载地址: 具体代码: using iTextSharp.text; using iTextSharp.text.pdf; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 {

huxiansheng__的博客 460

c# 上传图片加水印,包含加文字水印和图片水印两种方式

类引入后,直接调用即可,非常方便简单,支持图片或文字,文字可调整透明度和色彩、文字大小、字体等。

C#加水印操作(各种集锦)

1.给图片加水印 public byte[] GetWatermarkPic(byte[] bytes, string txt) { MemoryStream ms = new MemoryStream(bytes); Image pic = System.Drawing.Image.FromStream(ms); //创建一把刷子 //防止索引像素格式引发异常的像素格式 Bitmap bmp = new Bitmap(pic.Width, pic.Height, PixelFormat.Format32b

m0_51159082的博客 5575

Arm CCA架构:硬件级机密计算与安全隔离技术解析

机密计算(Confidential Computing)通过硬件级隔离技术构建可信执行环境(TEE),是当前云安全和数据隐私保护的核心方案。Armv9-A引入的CCA架构采用物理地址空间隔离和Granule保护表(GPT)机制,实现4KB颗粒度的内存访问控制。该技术通过标准化的RMI/RSI接口规范,为虚拟化环境和安全敏感应用提供硬件级保护,特别适用于金融交易、医疗数据处理等需要严格隔离的场景。相比传统TEE方案,Arm CCA在隔离等级和动态权限管理方面具有显著优势,其Realm World设计为机密计算

weixin_30905133的博客 566

NFS服务器配置与autofs自动挂载

NFS服务器配置autofs自动挂载 环境: hostname ip OS server 192.168.220.138 centos7 client 192.168.220.139 centos7 一、NFS概述 NFS(Network File System)网络文件系统。最大功能就是通过网络,让不同的机器、不同的操作系统可以共享彼此的文件。 二、端口 [root@se...

DoloresOOO的博客 1030

C#实现图片添加水印

3、在项目的bin目录下创建目录images,将图片6p.jpg复制到该目录下,当然这个目录你放在别的位置也行。例如,在图像上添加版权或名称。我们可能还需要在文档中创建水印。1、VS2019添加一个控制台程序,当然别的类型程序也可,代码是一样的。2、项目引用System.Drawing.dll。如何在图像上添加水印。把图片复制到项目的指定目录下。效果相当的帅,要加鸡腿了。有时我们需要在图像上。

hqwest的专栏 2074

Proteus课设原理图及报告

1. I/O 口:32 个可编程 I/O 引脚,分成 4 个并行 I/O 端口 (P0, P1, P2, P3),P0 功能段选 a、b、c、d、e、f、g、dp 使其中部分点亮,P2 功能为位选 1、2、4.按键操作分析:P3.0-设置时钟的时间,P3.1-确定更改的时钟时间,P3.2-对。时钟设置标志 0 不设置,1 设置时,2 设置分,3 设置秒。P3.0 按下的次数对应 不设置,设置时,设置分,

2303_76688805的博客 1184

ASP.NET(C#)图片加文字、图片水印

ASP.NET(C#)图片加文字、图片水印一、图片上加文字://using System.Drawing;//using System.IO;//using System.Drawing.Imaging;private void AddTextToImg(string fileName,string text){ if(!File.Exists(MapPath(

wonsoft的专栏 2万+

告别Keil4!手把手教你用Keil C51 V9.61编译51单片机代码(附最新激活方法)

本文详细介绍了Keil C51 V9.61在51单片机开发中的全栈升级指南,包括编译速度提升、调试器性能优化和现代开发支持等核心优势。通过智能安装方案、项目迁移实战和新特性深度应用,帮助开发者告别Keil4,大幅提升开发效率。附有最新激活方法和实用技巧,适用于嵌入式开发工程师。

weixin_26886855的博客 422

【ESP32使用MAX98357播放音频】

在物联网和智能家居领域,音频播放功能越来越受到重视。ESP32作为一款功能强大的微控制器,结合MAX98357音频放大器模块,可以实现高品质的音频播放。本文将详细介绍如何使用ESP32的I2S接口通过MAX98357进行音频播放。

vor234的博客 7535

C#给图片加文字和图片的水印

C#给图片加文字和图片的水印 /// &lt;summary&gt; /// WaterMark 的摘要说明 /// &lt;/summary&gt; /// 图片加水印 /// &lt;param name="strCopyright"&gt;要加入的文字 &lt;/param&gt; ...

这里将承载一段最初的记忆 350

HanLP的分词

HanLP的分词

sikh_0529的博客 1万+

ASP.NET(C#)图片加文字、图片水印(转)

一、图片上加文字://using System.Drawing;//using System.IO;//using System.Drawing.Imaging;private void AddTextToImg(string fileName,string text){ if(!File.Exists(MapPath(fileName))) {...

weixin_30709061的博客 357

使用 IMDb API 获取电影评分和评论的 Python 爬虫

电影是人们娱乐生活中的重要组成部分,随着电影产业的快速发展,观众对电影的评价也越来越多样化。IMDb(互联网电影数据库)作为全球最大的电影评分和评论平台之一,收录了成千上万部电影、电视节目及其相关数据。它提供了一个强大的 API 接口,允许开发者访问电影的评分、评论、演员信息等数据。本文将带你一步一步实现一个 Python 爬虫,使用 IMDb API 获取电影的评分和评论。我们将通过这个爬虫来分析一些热门电影的观众反馈,并可视化分析结果。

2201_76125261的博客 1055

基于PChmi.dll的PLC报警显示和记录(C#)

本文介绍了如何使用C#编写基于PChmi.dll的程序,实现PLC报警的显示和记录功能。通过订阅PLC的报警事件,我们可以实时显示报警信息,并通过日志文件记录报警历史。PLC(可编程逻辑控制器)在工业自动化领域中扮演着重要的角色,而报警显示和记录是PLC应用中常见的需求。本文将介绍如何使用C#编写基于PChmi.dll的程序,实现PLC报警的显示和记录功能。当然,这只是实现报警显示和记录的基本框架,具体的实现方式可能因不同的PLC和HMI库而有所差异。你需要根据你所使用的具体库和设备进行相应的调整和修改。

ByteLegend的博客 1673

c# 图片加图片水印、文字水印和图片文字水印

加水印类: Code usingSystem; usingSystem.Drawing; usingSystem.Drawing.Imaging; usingSystem.Drawing.Drawing2D; publicclassDrawImg { privatestringWorkingDirectory=string.Empty;//路径...

a32232730的博客 238

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

C#给图片加文字水印

C#给图片加文字水印 public class TxtWaterMark { public enum WaterPositionMode { LeftTop,//左上 LeftBottom,//左下 RightTo...

这里将承载一段最初的记忆 677

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

C#给图片加水印文字或图片

/// &lt;summary&gt; /// WaterMark 的摘要说明 /// &lt;/summary&gt; /// 图片加水印 /// &lt;param name="strCopyright"&gt;要加入的文字 &lt;/param&gt; /// &lt;param name="strM...

浅丶巷 2132

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

ASP.NET C# 图片加文字、图片水印二版本

ASP.NET(C#)图片加文字、图片水印 一、图片上加文字: //using System.Drawing; //using System.IO; //using System.Drawing.Imaging; private void AddTextToImg(string fileName,string text) ...

weixin_30338461的博客 131

ASP.NET(C#)图片加文字、图片水印,神啊,看看吧

ASP.NET(C#)图片加文字、图片水印 一、图片上加文字: //using System.Drawing; //using System.IO; //using System.Drawing.Imaging; private void AddTextToImg(string fileName,string text) { if(!File.Exists(MapPat...

weixin_30878361的博客 115

C#图片加水印图片和文字

代码usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.IO;u...

aiman5818的博客 348
上一篇: DevExpress GridControl SummaryItem的Custom Summary
下一篇: 职位与岗位的区别
「已注销」
博客等级 码龄14年 117粉丝 43原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值