Files
lserp_cs_6.0/插件库/Lskj.Main/Control/CornerLab.cs
T
cyf ab56a9bcf7 基线 SVN r240
SVN-Revision: r240
2025-02-06 06:46:06 +00:00

125 lines
4.3 KiB
C#

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.Main.Control
{
public partial class CornerLab : UserControl
{
public Label LabelNum { get { return lbl_mark_num; } }
public CornerLab()
{
InitializeComponent();
}
#region 设置公共圆角的角标数量
/// <summary>
/// <para>说明:设置公共圆角的角标数量</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2021-06-21 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="PaintEventArgs"/> instance containing the event data.</param>
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
/// <summary>
/// <para>说明:重绘圆角</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="PaintEventArgs"/> instance containing the event data.</param>
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);
}
}
}
}