当前位置: 首页 > news >正文

专业的美容网站建设文创产品推广方案

专业的美容网站建设,文创产品推广方案,股份有限公司,劳务外包公司1、创建卡片用户控件 在控件库中添加用户控件(Windows窗体),命名为Card; 在属性/布局栏设置Size为148,128. 2、修改Card.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; u…

1、创建卡片用户控件
在控件库中添加用户控件(Windows窗体),命名为Card;
在属性/布局栏设置Size为148,128.
2、修改Card.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UserControlLib
{
public partial class Card : UserControl
{
public Card()
{
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.Selectable, true);
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.MouseDown += UcSwitch_MouseDown;
}

    [Description("开关切换"), Category("自定义")]public event EventHandler CheckedChanged;void UcSwitch_MouseDown(object sender, MouseEventArgs e){int xMin = switchLocationX - swichArcDiameter;int xMax = switchLocationX + swichLineLen + swichArcDiameter;int yMin= switchLocationY;int yMax = switchLocationY + swichArcDiameter;if (e.X > xMin && e.X < xMax && e.Y > yMin && e.Y < yMax){ChipSwitch = !ChipSwitch;if (CheckedChanged != null){CheckedChanged(this, EventArgs.Empty);}}}private const int SWITCH_ARC_DIAMETER = 24;private const int SWITCH_LINE_LEN = 15;private const int SWITCH_LOCATION_X = 85;private const int SWITCH_LOCATION_Y = 5;int swichArcDiameter = SWITCH_ARC_DIAMETER;int swichLineLen = SWITCH_LINE_LEN;int switchLocationX = SWITCH_LOCATION_X;int switchLocationY = SWITCH_LOCATION_Y;string[] segment;protected override void OnPaint(PaintEventArgs e){base.OnPaint(e);var g = e.Graphics;g.SmoothingMode=SmoothingMode.AntiAlias;g.DrawString(this.ChipName,new Font("Yahei", 12f), new SolidBrush(Color.White),5,5);var fillColor = this.ChipSwitch ? Color.FromArgb(34, 163, 169) : Color.FromArgb(111, 122, 126);GraphicsPath path = new GraphicsPath();path.AddLine(new Point(switchLocationX, switchLocationY), new Point(switchLocationX + swichLineLen, switchLocationY));//g.DrawPath(new Pen(Color.Red,2),path);path.AddArc(new Rectangle(switchLocationX + swichLineLen, switchLocationY, swichArcDiameter, swichArcDiameter), -90, 180);//g.DrawPath(new Pen(Color.Red, 2), path);path.AddLine(new Point(switchLocationX + swichLineLen, switchLocationY + swichArcDiameter), new Point(switchLocationX, switchLocationY + swichArcDiameter));//g.DrawPath(new Pen(Color.Red, 2), path);path.AddArc(new Rectangle(switchLocationX - swichArcDiameter, switchLocationY, swichArcDiameter, swichArcDiameter), 90, 180);//g.DrawPath(new Pen(Color.Red, 2), path);g.FillPath(new SolidBrush(fillColor), path);int switchCircleDiameter = swichArcDiameter - 4;int switchTextY = (swichArcDiameter - 10) / 2+ switchLocationY;if (this.ChipSwitch){g.FillEllipse(Brushes.White, new Rectangle(switchLocationX + swichLineLen+2, switchLocationY+2, switchCircleDiameter, switchCircleDiameter));g.DrawString("开", new Font("Yahei", 10f), Brushes.White, new Point(switchLocationX, switchTextY));}else{g.FillEllipse(Brushes.White, new Rectangle(switchLocationX - swichArcDiameter+2, switchLocationY+2, switchCircleDiameter, switchCircleDiameter));g.DrawString("关", new Font("Yahei", 10f), Brushes.White, new Point(switchLocationX, switchTextY));}if (segment!=null && segment.Length>0){for(int i=0;i<segment.Length; i++){g.DrawString(segment[i], new Font("Yahei", 10f), new SolidBrush(Color.White), 5, 40+25*i);//g.DrawString(this.LatchCount, new Font("Yahei", 12f), new SolidBrush(Color.Blue), 100, 65);}}}#region Propertiesprivate string chipName;[Description("芯片名称"), Category("自定义")]public string ChipName{get { return chipName; }set { chipName = value; Invalidate(); }}private bool chipSwitch;[Description("芯片开关"), Category("自定义")]public bool ChipSwitch{get { return chipSwitch; }set { chipSwitch = value; Invalidate(); }}private string content;[Description("卡片内容"), Category("自定义")]public string Content{get { return  content; }set {  content = value;if(content != null){segment = content.Split(',');}Invalidate();}}//private int statusColor;//[Description("背景颜色"), Category("自定义")]//public int StatusColor//{//    get { return statusColor; }//    set { //        statusColor = value;//        switch (statusColor)//        {//            case 1://                this.BackColor = Color.FromArgb(0xFFD965);//                break;//            case 2://                this.BackColor = Color.FromArgb(0xC55A11); //                break;//            default://                this.BackColor = Color.FromArgb(0x70AD47);//                break;//        }//    }//}#endregion
}

}

http://www.yayakq.cn/news/119088/

相关文章:

  • 黄岩做网站网站建设最新模板
  • 中国矿井建设相关媒体网站海南网页制作
  • 四川交投建设工程股份有限公司网站数据分析师要学什么课程
  • 建手机网站价格wordpress 经典
  • ASP做网站源代码购物网站建设论文
  • wap网站不流行网站正在建设中的图片大全
  • 上海网站定制公司海南营销网站建设
  • 深圳建站公司是如何做好营销型网站的vs做网站开发吗
  • 邯郸做网站如何查询网站点击量
  • 自己的网站怎么做seo今天的新闻内容
  • 好点的网站建设公司临淄百度信息网
  • 专业网站制作的公司营销网站用户体验有哪些
  • 做网站 上海wordpress 慢 2019
  • 做美食类网站分析海口智能建站详情
  • dede世界杯网站模板seo关键词优化系统
  • 创建一个网站主页婚纱摄影网站的设计与实现论文
  • 口碑好的网站建设服务在线seo工具
  • 站长工具ip地址查询域名服务器做jsp网站教程视频教程
  • 手机怎么制作网站教程视频建个网站多少钱
  • 合肥企业自助建站wordpress微官网主题下载
  • 个人网站appseo排名首页
  • 温州网站建设wzwmwl做网站1g1核够吗
  • wordpress改造成mip站移动端原型
  • 做生产计划类的网站wordpress改变文章字体大小
  • 淘宝网站是用什么开发的做外汇网站代理商
  • 龙岗区住房和建设局在线网站wordpress 展示模板
  • 想要弄一个网站怎么弄做免费网站怎么赚钱
  • 微软网站设计安庆 网站建设
  • 建设网站用什么语言网站建设一年多少钱
  • 做门窗五金的网站ui参考网站