I Love You !

一个很无聊的小程序:

下面直接给出代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Text;

namespace WFADeskTopShow
{
    public partial class DesktopWindow : Form
    {
        public DesktopWindow()
        {
            InitializeComponent();
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.ShowInTaskbar = false;
            this.Load += new EventHandler(this_Load);
            p1.Size = new Size(40, 40);
            this.lb1.Location = new Point(30, 75);
            this.lb2.Location = new Point(30, 100);
            this.tb1.Location = new Point(150, 75);
            this.tb2.Location = new Point(150, 100);
            this.bt1.Location = new Point(50, 125);
            this.bt2.Location = new Point(150, 125);
            p1.Location = new Point(190, 190);
            p1.BorderStyle = BorderStyle.Fixed3D;
            this.Controls.Add(lb1);
            this.Controls.Add(lb2);
            this.Controls.Add(tb1);
            this.Controls.Add(tb2);
            this.Controls.Add(bt1);
            this.Controls.Add(bt2);
            this.Controls.Add(p1);
            this.bt1.Click += new EventHandler(bt1_Click);
            this.bt2.Click += new EventHandler(bt2_Click);
            this.p1.Click += new EventHandler(p1_Click);
            this.BackColor = Color.Transparent;

        }

        void p1_Click(object sender, EventArgs e)
        {
            cd.ShowDialog();
            {
                p1.BackColor = cd.Color;
                fontColor = this.p1.BackColor;
            };
        }

        void bt2_Click(object sender, EventArgs e)
        {
            this.Close();
            this.Dispose();
            Application.ExitThread();
        }

        void control_Paint(object sender, PaintEventArgs e)
        {
            Font f = new Font("宋体",stringSize);//System.Drawing.SystemColors.Control&&fontColor==Color.Transparent
            if (fontColor == SystemColors.Control)
            {
                fontColor = Color.Cyan;
                bt2.BackColor = fontColor;
                bt2.Size = new Size(25, 18);
                bt2.Text = "关";
            }
            SolidBrush sb = new SolidBrush(fontColor);
            e.Graphics.DrawString(s, f, sb, this.Width / 2 -400 , this.Height / 2 - 400);
            f.Dispose();
            sb.Dispose();
        }

        void bt1_Click(object sender, EventArgs e)
        {
            if (tb1.Text != "")
            {
                s = tb1.Text;
                try
                {
                    stringSize = Convert.ToInt32(tb2.Text.ToString().Trim());
                    this.TransparencyKey = System.Drawing.SystemColors.Control;
                    this.BackColor = System.Drawing.SystemColors.Control;
                    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                    this.WindowState = FormWindowState.Maximized;
                    //this.lb1.Hide();
                    //this.tb2.Hide();
                    //this.tb1.Hide();
                    //this.tb2.Hide();
                    //this.bt1.Hide();
                    fontColor = p1.BackColor;
                    p1.Dispose();
                    cd.Dispose();
                    this.lb1.Dispose();
                    this.lb2.Dispose();
                    this.tb1.Dispose();
                    this.tb2.Dispose();
                    this.bt1.Dispose();
                    this.bt2.Location = new Point(0, 0);
                    bt2.FlatStyle = FlatStyle.Popup;
                    this.Controls.Add(control);
                    control.Location = new Point(0, 0);
                    control.Size = this.Size;
                    this.control.Paint += new PaintEventHandler(control_Paint);
                }
                catch
                {
                    MessageBox.Show("字体大小应该数值型的比如“100”是请修改字体大小!");
                }
            }
            else
            {
                MessageBox.Show("请输入内容");
            }
           
           
        }
        void this_Load(object sender, EventArgs e)
        {
            this.lb1.Text = "请输入内容:";
            this.bt1.Text = "确定";
            this.bt2.Text = "取消";
            this.lb2.Text = "请输入大小:";
        }

        Label lb1 = new Label();
        Label lb2 = new Label();
        TextBox tb1 = new TextBox();
        TextBox tb2 = new TextBox();
        Button bt1 = new Button();
        Button bt2 = new Button();
        Panel p1 = new Panel();
        Control control = new Control();
        ColorDialog cd = new ColorDialog();
        static string s;
        static int stringSize;
        static Color fontColor;


    }
}

 

效果概览:

(1).

(2).

下面是一个示例代码,展示了如何在 Verilog 中将字符串 "HLJU,I LOVE YOU!" 的 ASCII 码赋值给深度为 32、宽度为 8 的存储器: ```verilog module memory( input [7:0] addr, input [7:0] data_in, input write_enable, output reg [7:0] data_out ); // 定义一个 32x8 的存储器 reg [7:0] mem [0:31]; always @(posedge clk) begin if (write_enable) begin // 将数据写入存储器中的对应地址 mem[addr] <= data_in; end // 从存储器中读出对应地址的数据 data_out <= mem[addr]; end initial begin // 将字符串 "HLJU,I LOVE YOU!" 的 ASCII 码赋值给存储器 mem[0] <= 72; // H mem[1] <= 76; // L mem[2] <= 74; // J mem[3] <= 85; // U mem[4] <= 44; // , mem[5] <= 73; // I mem[6] <= 32; // 空格 mem[7] <= 76; // L mem[8] <= 79; // O mem[9] <= 86; // V mem[10] <= 69; // E mem[11] <= 32; // 空格 mem[12] <= 89; // Y mem[13] <= 79; // O mem[14] <= 85; // U mem[15] <= 33; // ! // 将存储器中的数据输出到仿真波形中进行验证 $display("mem[0] = %c", mem[0]); $display("mem[1] = %c", mem[1]); $display("mem[2] = %c", mem[2]); $display("mem[3] = %c", mem[3]); $display("mem[4] = %c", mem[4]); $display("mem[5] = %c", mem[5]); $display("mem[6] = %c", mem[6]); $display("mem[7] = %c", mem[7]); $display("mem[8] = %c", mem[8]); $display("mem[9] = %c", mem[9]); $display("mem[10] = %c", mem[10]); $display("mem[11] = %c", mem[11]); $display("mem[12] = %c", mem[12]); $display("mem[13] = %c", mem[13]); $display("mem[14] = %c", mem[14]); $display("mem[15] = %c", mem[15]); end endmodule ``` 在这个模块中,我们定义了一个 32x8 的存储器,并在 `initial` 代码块中将字符串 "HLJU,I LOVE YOU!" 的 ASCII 码赋值给存储器。在仿真中,我们输出存储器中的数据,以验证数据是否正确赋值。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值