DevComponents.DotNetBar2.dll设置样式的使用
有点模仿QQ消息盒子的感觉,代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using DevComponents.DotNetBar; namespace BW_ArasSpirit
{
public partial class SystemMsgBox : Form
{
private static SystemMsgBox _initialize = null; public static SystemMsgBox getinstance()
{
if (_initialize == null)
{
_initialize = new SystemMsgBox();
}
return _initialize;
} #region 变量
private bool boolVisible = false;
#endregion #region 拖动无边框窗体
[DllImport("user32.dll")]//*********************拖动无窗体的控件
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MOVE = 0xF010;
public const int HTCAPTION = 0x0002;
#endregion public SystemMsgBox()
{
InitializeComponent();
} //#region 鼠标Move Hover Leave样式区域
//private void labelShowMsg_MouseMove(object sender, MouseEventArgs e)
//{
// labelShowMsg.ForeColor = Color.FromArgb(50, 50, 50);
//} //private void labelShowMsg_MouseLeave(object sender, EventArgs e)
//{
// labelShowMsg.ForeColor = Color.FromArgb(100, 100, 100);
//}
//#endregion #region 取消窗体关闭事件
private void FormMessage_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
boolVisible = true;
timerShowWindow.Enabled = true;
timerWait.Enabled = false;
}
#endregion #region 窗体关闭
private void btnFormClose_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Close();
}
}
#endregion #region 显示窗体函数
public void ShowWindow(List<Task> wlplist,List<Task> ptasklist)
{
this.Show();
this.Opacity = 0;
boolVisible = false;
timerWait.Interval = 5000;
Point point;
try
{
point = frmSet.point;
}
catch (Exception e)
{
throw e;
}
this.Location = new Point((((point.X+10) + (point.X -10))/2)- (this.Size.Width/2), Screen.PrimaryScreen.Bounds.Height - 40 - this.Size.Height);
timerShowWindow.Enabled = true;
int wlpcount = wlplist.Count;
int pacount = ptasklist.Count;
if (wlpcount == 0)
{
lbltasklist.Text = "项目流任务-" + ptasklist[0].Ptaskname + " (" + ptasklist.Count + ")";
labelXTitle.Text ="消息盒子"+" ("+"1"+")";
}
if (pacount == 0)
{
lblwlplist.Text = "工作流任务-" + wlplist[0].Wlptaskname + " (" + wlplist.Count + ")";
labelXTitle.Text = "消息盒子" + " (" + "1" + ")";
}
if (wlpcount != 0 && pacount != 0)
{
lbltasklist.Text = "项目流任务-" + ptasklist[0].Ptaskname + " (" + ptasklist.Count + ")";
lblwlplist.Text = "工作流任务-" + wlplist[0].Wlptaskname + " (" + wlplist.Count + ")";
labelXTitle.Text = "消息盒子" + " (" + "2" + ")";
}
}
#endregion #region 控制窗体显示
private void timerShowWindow_Tick(object sender, EventArgs e)
{
if (!boolVisible)
{
this.Opacity += 0.1;
if (this.Opacity >= 1)
{
timerShowWindow.Enabled = false;
timerWait.Enabled = false;
boolVisible = false;
}
}
else
{
this.Opacity -= 0.1;
if (this.Opacity == 0)
{
boolVisible = false;
this.Hide();
timerShowWindow.Enabled = false;
timerWait.Enabled = false;
}
}
}
#endregion #region 等待
private void timerWait_Tick(object sender, EventArgs e)
{
timerShowWindow.Enabled = false;
timerWait.Enabled = false;
}
#endregion #region 移动无边框窗体事件
private void labelXTitle_MouseDown(object sender, MouseEventArgs e)
{
//ReleaseCapture();
//SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);//*********************调用移动无窗体控件函数
}
#endregion public delegate void MyDelegate(bool istrue);
public event MyDelegate MyEvent;
private void label1_Click(object sender, EventArgs e)
{
try
{
MyEvent(true);
this.Hide();
}
catch (Exception exp)
{
throw exp;
}
} public static bool istrueexit = false;
private void SystemMsgBox_Load(object sender, EventArgs e)
{ } //private void labelXTitle_MouseMove(object sender, MouseEventArgs e)
//{
// labelXTitle.ForeColor = Color.Red;
// labelXTitle.Font = new Font(labelXTitle.Font, FontStyle.Bold | FontStyle.Underline);
//} //private void labelXTitle_MouseLeave(object sender, EventArgs e)
//{
// labelXTitle.ForeColor = Color.White;
// labelXTitle.Font = new Font(labelXTitle.Font, FontStyle.Bold);
//}
}
} mian.cs public SystemMsgBox smb = SystemMsgBox.getinstance();
private void niIcon_MouseDown(object sender, MouseEventArgs e)
{
if (isRun && IsCloseWindow == "0")
{
point = Cursor.Position;
if (!smb.Visible)
{
smb.MyEvent +=new SystemMsgBox.MyDelegate(this.getreturnvalue);
smb.ShowWindow(wlptasklist,ptasklist);
timerpoint.Start();
}
}
} private Point lastpoint;
private void timerpoint_Tick(object sender, EventArgs e)
{
if (lastpoint == null) return;
if (smb.Visible)
{
//定义范围
//起始位置
lastpoint = Cursor.Position;
if (lastpoint.Y > point.Y + 100 || lastpoint.Y < point.Y - 100)
{
//超出高度隐藏
smb.Hide();
timerpoint.Stop();
}
//根据y的范围判定x的取值
int x = (((point.X + 10) + (point.X - 10)) / 2) - (211 / 2);
int y = Screen.PrimaryScreen.Bounds.Height - 40 - 97; //图标的上方,判断窗体的范围
if (lastpoint.Y < y || lastpoint.Y != y)
{
if (lastpoint.X < x || lastpoint.X > x + 211)
{
smb.Hide();
}
}
//图标的下方,判断图标的范围
//if (lastpoint.Y > y || lastpoint.Y != y)
//{
// if (lastpoint.X < x + 211 / 2 - 10 || lastpoint.X > x + 211 / 2 + 10)
// {
// smb.Hide();
// }
//}
}
}
DevComponents.DotNetBar2.dll设置样式的使用的更多相关文章
- [C#]AdvPropertyGrid的使用示例(第三方控件:DevComponents.DotNetBar2.dll)
开发环境:Visual Studio 2019 .NET版本:4.5.2 效果如下: 1.初始化界面: 2.属性“人物”-自定义控件显示: 3.属性“地址”-自定义窗体显示: 4.属性“性别”-枚举显 ...
- DotNetBar 中 SuperGridControl 加载数据、获取数据、设置样式
1.加载数据 构建列 //加载列 GridColumn gd = new GridColumn(); gd.Name = "第1"; gd.HeaderText = "第 ...
- word-wrap&&word-break,奇偶行、列设置样式
1.word-wrap和word-break区分. 来源场景:机械租赁mvc驾驶员信息查看: 当备注的文字多的时候,第一列的值成这模样: 解决方案:设置table 的td可自动换行.首先table设置 ...
- 注意Android里TextView控件的一个小坑,用android:theme来设置样式时动态载入的layout会丢失该样式
注意Android里TextView控件的一个小坑,用android:theme来设置样式时动态载入的layout会丢失该样式 这个坑,必须要注意呀, 比如在用ListView的时候,如果在List_ ...
- Vue系列: 如何通过组件的属性props设置样式
比如我们要在vue中显示百度地图,然后将相关的代码包装成组件,然后需要由外部来设置组件的高度,关于props的介绍,可以参考: http://cn.vuejs.org/guide/components ...
- 【使用 DOM】为DOM元素设置样式
1. 使用样式表 可以通过document.styleSheets属性访问文档中可用的CSS样式表,它会返回一组对象集合,这些对象代表了与文档管理的各个样式表. 每个样式表 都由一个CSSStyleS ...
- 【温故而知新-Javascript】为DOM元素设置样式
1. 使用样式表 可以通过document.styleSheets属性访问文档中可用的CSS样式表,它会返回一组对象集合,这些对象代表了与文档管理的各个样式表. 每个样式表 都由一个CSSStyleS ...
- 通过JavaScript设置样式和jQuey设置样式,还有随机数抛出水果的习题
一:通过JavaScript的方式设置样式(:拿习题为例): var shuiguo = document.getElementById('fruit'); shuiguo.style.bac ...
- c# Chart设置样式
一.chart属性熟悉 能够对C# chart控件属性熟悉起帮助的code, 现在分享给大家,Chart Operate Demo Code Download,如有帮助,别忘点个赞. Chart ...
随机推荐
- Ubuntu18安装LAMP环境详细步骤
Ubuntu18安装Lamp环境 1.su root 切换root账号(root账户权限高不用总输入sudo) 更新源 阿里源网址:https://opsx.alibaba.com/mirror 更 ...
- 常见的http错误
错误类型: 1xx(临时响应) 表示临时响应并需要请求者继续执行操作的状态代码. 2xx (成功) 表示成功处理了请求的状态代码. 3xx (重定向) 表示要完成请求,需要进一步操作. 通常,这些状态 ...
- Flink集群模式部署及案例执行
一.软件要求 Flink在所有类UNIX的环境[例如linux,mac os x和cygwin]上运行,并期望集群由一个 主节点和一个或多个工作节点组成.在开始设置系统之前,确保在每个节点上都安装了一 ...
- js 月份选择器(只选择到月)
需要如下js https://pan.baidu.com/s/1c1T9wY0 在html中添加如下代码 <input onclick="setmonth(this)" /& ...
- UVALive 3634 数据结构模拟
这题真是坑啊,题意不明,其实就是往桟里面压入空的set集合,所以之前的询问大小都是只有0,只有add的时候,才会产生新的占空间的集合 用stack和set直接进行模拟 #include <ios ...
- HDU_2255 二分图最佳完美匹配 KM匈牙利算法
一开始还没看懂这个算法,后来看了陶叔去年的PPT的实例演示才弄懂 用一个lx[]和ly[]来记录X和Y集合中点的权值,有个定理是 lx[i]+ly[j]==w[i][j](边权值) 则该点是最佳匹配, ...
- LIS是什么?【通讯】
Ⅲ最后一点,通讯. 从字面意义来看,通讯是一种沟通形式,信息交互的媒介.在LIS中,通讯主要指的是仪器通讯,也就是仪器与电脑-LIS系统的信息交互方式,也可以称为仪器接口. 在LIS中,通讯是最基础也 ...
- hive的join优化
“国际大学生节”又称“世界大学生节”.“世界学生日”.“国际学生日”.1946年,世界各国学生代表于布拉格召开全世界学生大会,宣布把每年的11月17日定为“世界大学生节”,以加强全世界大学生的团结和友 ...
- 基于百度语音识别API的Python语音识别小程序
一.功能概述 实现语音为文字,可以扩展到多种场景进行工作,这里只实现其基本的语言接收及转换功能. 在语言录入时,根据语言内容的多少与停顿时间,自动截取音频进行转换. 工作示例: 二.软件环境 操作系统 ...
- jquery---利用jquery插件生成二维码
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/jquer ...