重绘DevExpress的XtraMessageBox消息提示框控件
先来看提示框,可以看到框其实是一个去掉最大化、最小化按钮后的窗体,窗体的内容就是我们想要提示的内容,重绘提示框其实就是重绘窗体以及中间部分的内容。
首先重绘窗体,消息提示框的窗体不是XtraForm而是XtraMessageBoxForm,重写CreateFormBorderPainter()方法。
internal class MessageBoxForm : XtraMessageBoxForm
{
protected override FormPainter CreateFormBorderPainter()
{
return new MessageBoxFormPainter(this, LookAndFeel);
}
}
MessageBoxFormPainter继承于FormPainter,窗体样式由此类绘制。窗体可重绘的部分包括窗体边框,border(边框)、caption(标题栏)、Frame(提示框中间部分和提示框左下右边之间部分)但不包括中间内容部分。重绘需要用GraphicsCache对选定区域进行重绘(Rectangle),如标题文字框(TextBounds)、标题栏框(CaptionBounds)等等。详细见下:
internal class MessageBoxFormPainter : FormPainter
{
internal MessageBoxFormPainter(Control owner, ISkinProvider provider) : base(owner, provider) { }
/// <summary>
/// 标题文字样式
/// </summary>
/// <param name="cache"></param>
protected override void DrawText(GraphicsCache cache)
{
string text = Text;
if (text == null || text.Length == 0 || TextBounds.IsEmpty)
return;
AppearanceObject appearance = new AppearanceObject(GetDefaultAppearance());
appearance.Font = Owner.Font;
appearance.TextOptions.Trimming = Trimming.EllipsisCharacter; Rectangle r = RectangleHelper.GetCenterBounds(TextBounds, new Size(TextBounds.Width, appearance.CalcDefaultTextSize(cache.Graphics).Height));
DrawTextShadow(cache, appearance, r);
//cache.DrawString(text, appearance.Font, appearance.GetForeBrush(cache),r, appearance.GetStringFormat());
cache.DrawString(text, appearance.Font, Color.Blue, r, appearance.GetStringFormat()); // 字体颜色、样式
}
/// <summary>
/// 标题阴影
/// </summary>
/// <param name="cache"></param>
/// <param name="appearance"></param>
/// <param name="bounds"></param>
protected override void DrawTextShadow(GraphicsCache cache, AppearanceObject appearance, Rectangle bounds)
{
base.DrawTextShadow(cache, appearance, bounds);
}
/// <summary>
/// 标题文本框高度
/// </summary>
/// <param name="cache"></param>
/// <param name="appearance"></param>
/// <returns></returns>
protected override int CalcTextHeight(GraphicsCache cache, AppearanceObject appearance)
{
return (int)(cache.Graphics.MeasureString(Text, Owner.Font).Height);
}
/// <summary>
/// 标题栏高度
/// </summary>
/// <returns></returns>
protected override int GetCaptionHeight()
{
return 30;
}
/// <summary>
/// 画标题
/// </summary>
/// <param name="cache"></param>
/// <param name="doubleBuffer"></param>
protected override void DrawCaption(GraphicsCache cache, bool doubleBuffer)
{
base.DrawCaption(cache, doubleBuffer);
}
/// <summary>
/// 画背景
/// </summary>
/// <param name="cache"></param>
protected override void DrawBackground(GraphicsCache cache)
{
base.DrawBackground(cache);
Rectangle r = RectangleHelper.GetCenterBounds(this.CaptionBounds, new Size(CaptionBounds.Width, CaptionBounds.Height));
Brush linGrBrush = new LinearGradientBrush(r,
Color.FromArgb(255, 255, 0, 0),
Color.FromArgb(255, 0, 0, 255), 45);
cache.FillRectangle(linGrBrush, r);
}
/// <summary>
/// 画边框
/// </summary>
/// <param name="cache"></param>
/// <param name="doubleBuffer"></param>
protected override void DrawBorders(GraphicsCache cache, bool doubleBuffer)
{
base.DrawBorders(cache, doubleBuffer);
//Rectangle r = RectangleHelper.GetCenterBounds(this.CaptionBounds, new Size(CaptionBounds.Width, CaptionBounds.Height));
//Pen myPen = new Pen(Color.Black, 1);
//cache.DrawRectangle(myPen, r);
}
/// <summary>
/// 画展示内容周边(左、右、下部分)
/// </summary>
/// <param name="cache"></param>
/// <param name="info"></param>
/// <param name="kind">表示周边为左、右、下的哪一个</param>
protected override void DrawFrameCore(GraphicsCache cache, SkinElementInfo info, FrameKind kind)
{
base.DrawFrameCore(cache, info, kind);
Brush linGrBrush = new LinearGradientBrush(info.Bounds,
Color.FromArgb(255, 255, 0, 0),
Color.FromArgb(255, 0, 0, 255), 45);
//Color.FromArgb(255, 119, 144, 237),
//Color.FromArgb(255, 180, 154, 202), 45);
cache.FillRectangle(linGrBrush, info.Bounds);
}
/// <summary>
/// 画标题文字前图标
/// </summary>
/// <param name="cache"></param>
public override void DrawIcon(GraphicsCache cache)
{
base.DrawIcon(cache);
//cache.DrawIcon(SystemIcons.Warning,IconBounds);
}
/// <summary>
/// 画标题栏按钮(最大化、最小化、关闭)
/// </summary>
/// <param name="cache"></param>
/// <param name="useClip"></param>
public override void DrawButtons(GraphicsCache cache, bool useClip)
{
//base.DrawButtons(cache, useClip);
this.Buttons.Clear();
}
}
最后新建一个类NewXtraMessageBox,写一个用于弹出窗体的方法,返回值为DialogResult。
private static DialogResult ShowInternal(Control owner, string message, string caption, Icon messageIcon, params DialogResult[] dialogResults)
{
MessageBoxForm form = new MessageBoxForm();
XtraMessageBoxArgs args = new XtraMessageBoxArgs(owner, message, caption, dialogResults, messageIcon, 0);
args.Showing += Args_Showing;
return form.ShowMessageBoxDialog(args);
}
XtraMessageBoxArgs便是提示框展示的内容部分,注册Args_Showing事件,在事件重绘窗体。这里也能重绘窗体,但能重绘的部分只包括在正常设计窗体时的属性部分(字体大小、边框样式、透明度等),提示框中间部分样式只能在此处修改。
/// <summary>
/// 此处修改form和button
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void Args_Showing(object sender, XtraMessageShowingArgs e)
{
//改变form相关样式
e.Form.Font = new Font("Arial", 14F);
e.Form.LookAndFeel.UseDefaultLookAndFeel = false;
e.Form.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
//e.Form.FormBorderStyle = FormBorderStyle.None;
MessageButtonCollection buttons = e.Buttons;
SimpleButton btn = null;
foreach (var dialog in (DialogResult[])Enum.GetValues(typeof(DialogResult)))
{
btn = buttons[dialog];
if (btn != null)
{
btn.Size = new Size(Convert.ToInt32(btn.Width * 1.2), Convert.ToInt32(btn.Height * 1.2)); //按钮大小
btn.Font = e.Form.Font; //按钮字体
btn.ShowFocusRectangle = DefaultBoolean.False;
}
if (dialog == DialogResult.OK) //通过DialogResult确定按钮并改变具体按钮样式
{
btn.Text = "‘是’按钮";
}
}
}
}
最后在此类中写Show方法,输入标题、内容、按钮类型、图标等信息调用ShowInternal方法,可自定义图标。
public static void Show(string message)
{
ShowMessageBox(message, null, MessageBoxButtons.OK, null);
}
public static void Show(Control owner, string message)
{
ShowInternal(owner, message, null, null, DialogResult.OK);
}
public static void Show(string message, string caption)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, null);
}
public static void Show(string message, string caption, MessageBoxButtons messageBox)
{
ShowMessageBox(message, caption, messageBox, null);
}
public static void Show(string message, string caption, MessageBoxIcon messageBoxIcon)
{
if (messageBoxIcon == MessageBoxIcon.Warning)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Warning);
}
else if (messageBoxIcon == MessageBoxIcon.Question)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Question);
}
else if (messageBoxIcon == MessageBoxIcon.Error)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Error);
}
else if (messageBoxIcon == MessageBoxIcon.Information)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Information);
}
else if (messageBoxIcon == MessageBoxIcon.Asterisk)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Asterisk);
}
else if (messageBoxIcon == MessageBoxIcon.Exclamation)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Exclamation);
}
else if (messageBoxIcon == MessageBoxIcon.Hand)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Hand);
}
else
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, null);
}
}
public static void Show(string message, string caption, Icon icon)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, icon);
}
public static void Show(string message, string caption, MessageBoxButtons messageBox, MessageBoxIcon messageBoxIcon)
{
if (messageBoxIcon == MessageBoxIcon.Warning)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Warning);
}
else if (messageBoxIcon == MessageBoxIcon.Question)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Question);
}
else if (messageBoxIcon == MessageBoxIcon.Error)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Error);
}
else if (messageBoxIcon == MessageBoxIcon.Information)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Information);
}
else if (messageBoxIcon == MessageBoxIcon.Asterisk)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Asterisk);
}
else if (messageBoxIcon == MessageBoxIcon.Exclamation)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Exclamation);
}
else if (messageBoxIcon == MessageBoxIcon.Hand)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Hand);
}
else
{
ShowMessageBox(message, caption, messageBox, null);
}
}
public static void Show(string message, string caption, MessageBoxButtons messageBox, Icon icon)
{
ShowMessageBox(message, caption, messageBox, icon);
}
private static void ShowMessageBox(string message, string caption, MessageBoxButtons messageBox, Icon icon)
{
if (messageBox == MessageBoxButtons.OK)
{
ShowInternal(null, message, caption, icon, DialogResult.OK);
}
else if (messageBox == MessageBoxButtons.OKCancel)
{
ShowInternal(null, message, caption, icon, new DialogResult[] { DialogResult.OK, DialogResult.Cancel });
}
else if (messageBox == MessageBoxButtons.YesNo)
{
ShowInternal(null, message, caption, icon, new DialogResult[] { DialogResult.Yes, DialogResult.No });
}
else if (messageBox == MessageBoxButtons.YesNoCancel)
{
ShowInternal(null, message, caption, icon, new DialogResult[] { DialogResult.Yes, DialogResult.No, DialogResult.Cancel });
}
else if (messageBox == MessageBoxButtons.RetryCancel)
{
ShowInternal(null, message, caption, icon, new DialogResult[] { DialogResult.Retry, DialogResult.Cancel });
}
else if (messageBox == MessageBoxButtons.AbortRetryIgnore)
{
ShowInternal(null, message, caption, icon, new DialogResult[] { DialogResult.Abort, DialogResult.Retry, DialogResult.Ignore });
}
}
效果如下:
通过重绘可以还可将背景改为图片、改变按钮位置等等、可进一步拓展。
完整项目可以从我的csdn下载:https://download.csdn.net/download/weixin_52748738/18149812
附完整代码:
using DevExpress.Skins;
using DevExpress.Skins.XtraForm;
using DevExpress.Utils;
using DevExpress.Utils.Drawing;
using DevExpress.XtraEditors;
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace TestMessageBox
{
public static class NewMessageBox
{
#region show部分
public static void Show(string message)
{
ShowMessageBox(message, null, MessageBoxButtons.OK, null);
}
public static void Show(Control owner, string message)
{
ShowInternal(owner, message, null, null, DialogResult.OK);
}
public static void Show(string message, string caption)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, null);
}
public static void Show(string message, string caption, MessageBoxButtons messageBox)
{
ShowMessageBox(message, caption, messageBox, null);
}
public static void Show(string message, string caption, MessageBoxIcon messageBoxIcon)
{
if (messageBoxIcon == MessageBoxIcon.Warning)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Warning);
}
else if (messageBoxIcon == MessageBoxIcon.Question)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Question);
}
else if (messageBoxIcon == MessageBoxIcon.Error)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Error);
}
else if (messageBoxIcon == MessageBoxIcon.Information)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Information);
}
else if (messageBoxIcon == MessageBoxIcon.Asterisk)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Asterisk);
}
else if (messageBoxIcon == MessageBoxIcon.Exclamation)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Exclamation);
}
else if (messageBoxIcon == MessageBoxIcon.Hand)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, SystemIcons.Hand);
}
else
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, null);
}
}
public static void Show(string message, string caption, Icon icon)
{
ShowMessageBox(message, caption, MessageBoxButtons.OK, icon);
}
public static void Show(string message, string caption, MessageBoxButtons messageBox, MessageBoxIcon messageBoxIcon)
{
if (messageBoxIcon == MessageBoxIcon.Warning)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Warning);
}
else if (messageBoxIcon == MessageBoxIcon.Question)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Question);
}
else if (messageBoxIcon == MessageBoxIcon.Error)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Error);
}
else if (messageBoxIcon == MessageBoxIcon.Information)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Information);
}
else if (messageBoxIcon == MessageBoxIcon.Asterisk)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Asterisk);
}
else if (messageBoxIcon == MessageBoxIcon.Exclamation)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Exclamation);
}
else if (messageBoxIcon == MessageBoxIcon.Hand)
{
ShowMessageBox(message, caption, messageBox, SystemIcons.Hand);
}
else
{
ShowMessageBox(message, caption, messageBox, null);
}
}
public static void Show(string message, string caption, MessageBoxButtons messageBox, Icon icon)
{
ShowMessageBox(message, caption, messageBox, icon);
}
private static void ShowMessageBox(string message, string caption, MessageBoxButtons messageBox, Icon icon)
{
if (messageBox == MessageBoxButtons.OK)
{
ShowInternal(null, message, caption, icon, DialogResult.OK);
}
else if (messageBox == MessageBoxButtons.OKCancel)
{
ShowInternal(null, message, caption, icon, new DialogResult[] { DialogResult.OK, DialogResult.Cancel });
}
else if (messageBox == MessageBoxButtons.YesNo)
{
ShowInternal(null, message, caption, icon, new DialogResult[] { DialogResult.Yes, DialogResult.No });
}
else if (messageBox == MessageBoxButtons.YesNoCancel)
{
ShowInternal(null, message, caption, icon, new DialogResult[] { DialogResult.Yes, DialogResult.No, DialogResult.Cancel });
}
else if (messageBox == MessageBoxButtons.RetryCancel)
{
ShowInternal(null, message, caption, icon, new DialogResult[] { DialogResult.Retry, DialogResult.Cancel });
}
else if (messageBox == MessageBoxButtons.AbortRetryIgnore)
{
ShowInternal(null, message, caption, icon, new DialogResult[] { DialogResult.Abort, DialogResult.Retry, DialogResult.Ignore });
}
}
#endregion
private static DialogResult ShowInternal(Control owner, string message, string caption, Icon messageIcon, params DialogResult[] dialogResults)
{
MessageBoxForm form = new MessageBoxForm();
XtraMessageBoxArgs args = new XtraMessageBoxArgs(owner, message, caption, dialogResults, messageIcon, 0);
args.Showing += Args_Showing;
return form.ShowMessageBoxDialog(args);
}
/// <summary>
/// 此处修改form和button
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void Args_Showing(object sender, XtraMessageShowingArgs e)
{
e.Form.Font = new Font("Arial", 14F);
e.Form.LookAndFeel.UseDefaultLookAndFeel = false;
e.Form.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin; //e.Form.FormBorderStyle = FormBorderStyle.None;
MessageButtonCollection buttons = e.Buttons;
SimpleButton btn = null;
foreach (var dialog in (DialogResult[])Enum.GetValues(typeof(DialogResult)))
{
btn = buttons[dialog];
if (btn != null)
{
btn.Size = new Size(Convert.ToInt32(btn.Width * 1.2), Convert.ToInt32(btn.Height * 1.2)); //按钮大小
btn.Font = e.Form.Font; //按钮字体
btn.ShowFocusRectangle = DefaultBoolean.False;
}
if (dialog == DialogResult.OK)
{
btn.Text = "‘是’按钮";
}
}
}
}
internal class MessageBoxForm : XtraMessageBoxForm
{
protected override FormPainter CreateFormBorderPainter()
{
return new MessageBoxFormPainter(this, LookAndFeel);
}
}
internal class MessageBoxFormPainter : FormPainter
{
internal MessageBoxFormPainter(Control owner, ISkinProvider provider) : base(owner, provider) { }
/// <summary>
/// 标题文字样式
/// </summary>
/// <param name="cache"></param>
protected override void DrawText(GraphicsCache cache)
{
string text = Text;
if (text == null || text.Length == 0 || TextBounds.IsEmpty)
return;
AppearanceObject appearance = new AppearanceObject(GetDefaultAppearance());
appearance.Font = Owner.Font;
appearance.TextOptions.Trimming = Trimming.EllipsisCharacter; Rectangle r = RectangleHelper.GetCenterBounds(TextBounds, new Size(TextBounds.Width, appearance.CalcDefaultTextSize(cache.Graphics).Height));
DrawTextShadow(cache, appearance, r);
//cache.DrawString(text, appearance.Font, appearance.GetForeBrush(cache),r, appearance.GetStringFormat());
cache.DrawString(text, appearance.Font, Color.Blue, r, appearance.GetStringFormat()); // 字体颜色、样式
}
/// <summary>
/// 标题阴影
/// </summary>
/// <param name="cache"></param>
/// <param name="appearance"></param>
/// <param name="bounds"></param>
protected override void DrawTextShadow(GraphicsCache cache, AppearanceObject appearance, Rectangle bounds)
{
base.DrawTextShadow(cache, appearance, bounds);
}
/// <summary>
/// 标题文本框高度
/// </summary>
/// <param name="cache"></param>
/// <param name="appearance"></param>
/// <returns></returns>
protected override int CalcTextHeight(GraphicsCache cache, AppearanceObject appearance)
{
return (int)(cache.Graphics.MeasureString(Text, Owner.Font).Height);
}
/// <summary>
/// 标题栏高度
/// </summary>
/// <returns></returns>
protected override int GetCaptionHeight()
{
return 30;
}
/// <summary>
/// 画标题
/// </summary>
/// <param name="cache"></param>
/// <param name="doubleBuffer"></param>
protected override void DrawCaption(GraphicsCache cache, bool doubleBuffer)
{
base.DrawCaption(cache, doubleBuffer);
}
/// <summary>
/// 画背景
/// </summary>
/// <param name="cache"></param>
protected override void DrawBackground(GraphicsCache cache)
{
base.DrawBackground(cache);
Rectangle r = RectangleHelper.GetCenterBounds(this.CaptionBounds, new Size(CaptionBounds.Width, CaptionBounds.Height));
Brush linGrBrush = new LinearGradientBrush(r,
Color.FromArgb(255, 255, 0, 0),
Color.FromArgb(255, 0, 0, 255), 45);
cache.FillRectangle(linGrBrush, r);
}
/// <summary>
/// 画边框
/// </summary>
/// <param name="cache"></param>
/// <param name="doubleBuffer"></param>
protected override void DrawBorders(GraphicsCache cache, bool doubleBuffer)
{
base.DrawBorders(cache, doubleBuffer);
//Rectangle r = RectangleHelper.GetCenterBounds(this.CaptionBounds, new Size(CaptionBounds.Width, CaptionBounds.Height));
//Pen myPen = new Pen(Color.Black, 1);
//cache.DrawRectangle(myPen, r);
}
/// <summary>
/// 画展示内容周边(左、右、下部分)
/// </summary>
/// <param name="cache"></param>
/// <param name="info"></param>
/// <param name="kind">表示周边为左、右、下的哪一个</param>
protected override void DrawFrameCore(GraphicsCache cache, SkinElementInfo info, FrameKind kind)
{
base.DrawFrameCore(cache, info, kind);
Brush linGrBrush = new LinearGradientBrush(info.Bounds,
Color.FromArgb(255, 255, 0, 0),
Color.FromArgb(255, 0, 0, 255), 45);
//Color.FromArgb(255, 119, 144, 237),
//Color.FromArgb(255, 180, 154, 202), 45);
cache.FillRectangle(linGrBrush, info.Bounds);
}
/// <summary>
/// 画标题文字前图标
/// </summary>
/// <param name="cache"></param>
public override void DrawIcon(GraphicsCache cache)
{
base.DrawIcon(cache);
//cache.DrawIcon(SystemIcons.Warning,IconBounds);
}
/// <summary>
/// 画标题栏按钮(最大化、最小化、关闭)
/// </summary>
/// <param name="cache"></param>
/// <param name="useClip"></param>
public override void DrawButtons(GraphicsCache cache, bool useClip)
{
//base.DrawButtons(cache, useClip);
this.Buttons.Clear();
}
}
}
重绘DevExpress的XtraMessageBox消息提示框控件的更多相关文章
- VS2010/MFC编程入门之二十四(常用控件:列表框控件ListBox)
前面两节讲了比较常用的按钮控件,并通过按钮控件实例说明了具体用法.本文要讲的是列表框控件(ListBox)及其使用实例. 列表框控件简介 列表框给出了一个选项清单,允许用户从中进行单项或多项选择,被选 ...
- VS2010-MFC(常用控件:列表框控件ListBox)
转自:http://www.jizhuomi.com/software/186.html 列表框控件简介 列表框给出了一个选项清单,允许用户从中进行单项或多项选择,被选中的项会高亮显示.列表框可分为单 ...
- 自定义iOS 中推送消息 提示框
看到标题你可能会觉得奇怪 推送消息提示框不是系统自己弹出来的吗? 为什么还要自己自定义呢? 因为项目需求是这样的:最近需要做 远程推送通知 和一个客服系统 包括店铺客服和官方客服两个模块 如果有新的消 ...
- Android第三方开源对话消息提示框:SweetAlertDialog(sweet-alert-dialog)
Android第三方开源对话消息提示框:SweetAlertDialog(sweet-alert-dialog) Android第三方开源对话消息提示框:SweetAlertDialog(sweet- ...
- 精美舒适的对话消息提示框--第三方开源--SweetAlertDialog
SweetAlertDialog(sweet-alert-dialog)是一个套制作精美.动画效果出色生动的Android对话.消息提示框 SweetAlertDialog(sweet-alert-d ...
- Android:Toast简单消息提示框
Toast是简单的消息提示框,一定时间后自动消失,没有焦点. 1.简单文本提示的方法: Toast.makeText(this, "默认的toast", Toast.LENGTH_ ...
- Android应用开发学习之Toast消息提示框
作者:刘昊昱 博客:http://blog.csdn.net/liuhaoyutz 本文我们来看Toast消息提示框的用法.使用Toast消息提示框一般有三个步骤: 1. 创建一个Toast对象.可 ...
- JS~Boxy和JS模版实现一个标准的消息提示框
面向对象的封装 面向对象一个入最重要的特性就是“封装”,将一些没有必要公开的方法和属性以特定的方式进行组装,使它对外只公开一个接口,外界在调用它时,不需要关注它实现的细节,而只要关注它的方法签名即可, ...
- MFC上下浮动与渐入渐出消息提示框实现
类似QQ与360软件,消息提示有两种.上下浮动.渐入渐出. 1.上下浮动提示框实现 机制,定时器响应上下浮动消息. 主要API:MoveWindow. 源码如下UpDownTipDlg.h.UpDow ...
随机推荐
- <span>居中
在父元素中加style="text-align:center"; 比如下面这样 <head> </head> <body> <di ...
- 如何用Eggjs从零开始开发一个项目(1)
前言 "纸上得来终觉浅,绝知此事要躬行."虽然node一直在断断续续地学,但总是东一榔头西一榔头的,没有一点系统,所以打算写一个项目来串联一下之前的学习成果. 为什么选择Eggjs ...
- Cassandra数据操作管理工具tableplus
一.概述 Cassandra是一个NoSQL数据库,具有类SQL CQL入口,基本语法与SQL保持一致.其实笔者认为 Cassandra的自带的cqlsh已经满足本的需求:如: 但是用习惯了数据库操作 ...
- JAVA网络编程基本功之Servlet与Servlet容器
Servlet与Servlet容器关系 Servlet 比较这两个的区别, 就得先搞清楚Servlet 的含义, Servlet (/ˈsərvlit/ ) 翻译成中文就是小型应用程序或者小服务程序, ...
- ModuleNotFoundError: No module named 'django'
1 .就在前天 我还能用python3 manage.py runserver 0.0.0.0:8000 启动Django 今天就突然报错了(心情极为复杂,你这也能信?) 2.打印python找 ...
- 从代理模式 到 SpringAOP
前言 Spring AOP 就是通过代理模式来实现切面编程的.代理模式用来为其他对象提供一种代理,以控制对这个对象的访问. 代理对象在客户端和目标对象之间起到中介的作用.通过控制对这个对象的访问,可以 ...
- ProBuilder快速原型开发技术 ---模型精细化操作
前面我们讲解了很多ProBuilder功能,但是对于制作一款复杂的模型来说,还远远不够.需要更多的对于模型细节的处理,这就是本篇文章要讲解的"模型精细化操作"技术. 关于PB对于模 ...
- slickgrid ( nsunleo-slickgrid ) 4 解决点击不切换单元格的问题
slickgrid ( nsunleo-slickgrid ) 4 解决点击不切换单元格的问题 上一次解决了列选择和区域选择冲突的问题,昨天太忙了,并且要陪小宝早点睡觉,就啥也没有赶上.今天上班面试. ...
- git配置,以及简单的命令
在 window 平台需要安装对应的客户端 git 配置全局用户名git config --global user.name "xxx"配置全局邮箱git config --glo ...
- python中类的魔法方法
__xx__这种方法,在Python中均称为魔法方法 1.__init__(self) 该方法的作用是初始化对象 在创建对象时被默认调用,不需要手动调节 self参数不需要开发者传递,解释器会自动将创 ...