using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lskj.Business.Impl;
using Lskj.Control;
namespace Lskj.Main4.Control
{
public partial class CornerLab : UserControl
{
public Label LabelNum { get { return lbl_mark_num; } }
public CornerLab()
{
InitializeComponent();
}
#region 设置公共圆角的角标数量
///
/// 说明:设置公共圆角的角标数量
/// 创建人:王一帆
/// 创建日期:2021-06-21
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// The source of the event.
/// The instance containing the event data.
public void SetMenuNum(int num)
{
if (num < 1)
{
this.cb_mark.Visible = false;
this.lbl_mark_num.Visible = false;
this.Visible = false;
}
else
{
this.cb_mark.Visible = true;
this.lbl_mark_num.Visible = true;
this.lbl_mark_num.BringToFront();
if (num < 10)
{
this.lbl_mark_num.Location = new Point(6, 6);
}
if (num > 99)
num = 99;
this.lbl_mark_num.Text = num + "";
}
}
public void SetMenuNum_special(int num)
{
if (num < 1)
{
this.cb_mark.Visible = false;
this.lbl_mark_num.Visible = false;
this.Visible = false;
}
else
{
this.cb_mark.Visible = true;
this.lbl_mark_num.Visible = true;
this.lbl_mark_num.BringToFront();
if (num < 10)
{
this.lbl_mark_num.Location = new Point(5, 4);
}
if (num > 99)
{
this.lbl_mark_num.Location = new Point(2, 4);
num = 99;
}
this.lbl_mark_num.Text = num + "";
}
}
#endregion
///
/// 说明:重绘圆角
/// 创建人:龚宇超
/// 创建日期:2017-08-16
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// The source of the event.
/// The instance containing the event data.
private void MenuItem_Paint(object sender, PaintEventArgs e)
{
try
{
System.Drawing.Drawing2D.GraphicsPath oPath = new System.Drawing.Drawing2D.GraphicsPath();
int x = 0;
int y = 0;
int thisWidth = this.Width;
int thisHeight = this.Height;
int angle = 20;
if (angle > 0)
{
System.Drawing.Graphics g = CreateGraphics();
oPath.AddArc(x, y, angle, angle, 180, 90); // 左上角
oPath.AddArc(thisWidth - angle, y, angle, angle, 270, 90); // 右上角
oPath.AddArc(thisWidth - angle, thisHeight - angle, angle, angle, 0, 90); // 右下角
oPath.AddArc(x, thisHeight - angle, angle, angle, 90, 90); // 左下角
oPath.CloseAllFigures();
Region = new System.Drawing.Region(oPath);
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message,ex.Message);
}
}
}
}