记录一下实现界面水印的方法

本文详细介绍了如何使用HTML5和JavaScript在用户界面上添加水印效果。通过结合CSS样式和JavaScript动态绘制,实现在网页中自定义文字或图像水印,增强界面的版权保护。
摘要由CSDN通过智能技术生成
<script>
  // 这里定义一个不会定义的唯一id名
  let id = '123456789qwe'
 // str 是我们需要定义水印内容
 // ctxWidth 是我们单个水印内容的宽度,ctxHeight 是我们单个水印内容的高度
 // fontSize是水印内容字体 大小
 // color是我们水印内容颜色
  let setCanvas = (str, ctxWidth = 150, ctxHeight = 120, fontSize=14, color="#eeeee") => {
  // 如果存在改id则将其节点删除
   if(document.getElementById(id)) {
    document.removeChild(document.getElementById(id))
   }
   // 定义canvas节点
    let canvas = document.createElement('canvas')
    canvas.width = ctxWidth
    canvas.height = ctxHeight
    let ctx = canvas.getContext('2d')
    // 这里先进行清除画布
    ctx.clearRect(0, 0, ctxWidth, ctxHeight)
    //  画布的旋转度
    ctx.rotate((25 * Math.PI) / 180)
    // 画布内容的字体设置
    ctx.font = `${fontSize}px makeRandom`
    // 画布文本颜色填充
    ctx.fillStyle = color
    // 定义内容基线
    ctx.textBaseline = 'Middle'
     // 渲染画布文字内容包括内容和横纵坐标
    ctx.fillText(str, ctxWidth / 4, ctxHeigh
MLSkin is a skin component under Delphi, inherited based on Delphi standard components, and extends a lot of practical attribute functions for developers to call; in use, there is little difference between the standard VCL components, but the display style is very different, it can easily achieve the effect like QQ skin, and want to change the display The style you want to do is just to reload a picture; most of the components in it can be used alone, without the need to rely on the skin of the form, the display effect can be customized, very flexible; the current set of skin components provides more than 50 common components, more than 20 practical Demo, can be very convenient and quick implementation of you The effect you want. Website http://www.pngui.com/filedownload Feature: Support one touch skin, you can set the picture and color into the background of the form. The hue, saturation and brightness of the skin can be adjusted arbitrarily. The original picture resource management library can quickly and conveniently manage the pictures needed in the program. The unique image resource attribute supports the direct use of the detailed path of picture ID or local image file to call image resources. Easy to achieve the shadow of the form, the shape of the special form effect, simple to only need to set up two pictures. You can add any number of pictures, buttons and text on the form title bar. Memo, Edit, ListView and other components support transparent background, the border effect can be customized, add the commonly used search box and password input box. Redefined Toolbar, showing very beautiful style, and supporting horizontal and vertical display. Menu beautification, transparent effect, as long as you set up a picture, you can make your menu style different. You can display MainMenu on the title bar and display the location that you can customize. Almost all components can set their display styles individually, and most of the container com
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值