零.引言

  PropertyGrid中我们经常看到一些下拉式的编辑方式(Color属性)和弹出式编辑框(字体),这些都是为一些复杂的属性提供的编辑方式,本文主要说明如何实现这样的编辑方式。

一.为属性提供编辑类

  弹出式和下拉式是如何实现的呢,这需要为属性提供一个专门的编辑类。.Net为我们提供了一个System.Drawing.Design.UITypeEditor类,它是所有编辑类的基类,从他继承出了诸如ColorEditor、FontEditor的类,因此我们可以在属性框中编辑颜色和字体。定义了这样的类,我们也可以为自己的属性实现弹出式和下拉式编辑方式。

  先看一下MSDN中对UITypeEditor的介绍:提供可用于设计值编辑器的基类,这些编辑器可提供用户界面 (UI),用来表示和编辑所支持的数据类型的对象值。

  UITypeEditor 类提供一种基类,可以从该基类派生和进行扩展,以便为设计时环境实现自定义类型编辑器。通常,您的自定义类型编辑器与 PropertyGrid 控件进行交互。在文本框值编辑器不足以有效地选择某些类型的值的情况下,自定义类型编辑器非常有用。

  继承者说明:

  若要实现自定义设计时 UI 类型编辑器,必须执行下列步骤:

  • 定义一个从 UITypeEditor 派生的类。
  • 重写 EditValue 方法以处理用户界面、用户输入操作以及值的分配。
  • 重写 GetEditStyle 方法,以便将编辑器将使用的编辑器样式的类型通知给“属性”窗口。

  通过执行下列步骤,可以为在“属性”窗口中绘制值的表示形式添加附加支持:

  • 重写 GetPaintValueSupported 方法以指示编辑器支持显示值的表示形式。
  • 重写 PaintValue 方法以实现该值的表示形式的显示。
  • 如果编辑器应具有初始化行为,则重写 UITypeEditor 构造函数方法。

二.下拉式编辑方式

  接下来我们来实现下拉式编辑方式,接下来举一个具体的例子来说明。

  首先假如我们有一个控件类MyControl:

  

 public class MyControl : System.Windows.Forms.UserControl
{
private double _angle; [BrowsableAttribute(true)]
public double Angle
{
get
{ return _angle; }
set
{ _angle = value; }
} public MyControl()
{
this._angle = ;
} protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
e.Graphics.DrawString("The Angle is " + _angle, this.Font, Brushes.Red,,);
}
}

  其中有个属性Angle,我们要为其提供下拉式和弹出式编辑方式,当然了,一般都是较为复杂的属性才需要,这里只是为了举例说明。

  我们为其设计一个编辑类AngleEditor,在第二节中,继承说明中的第一条和第二条,EditValue和GetEditStyle两个函数,这是必须要重写的:

  

 [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
public class AngleEditor : System.Drawing.Design.UITypeEditor
{
public AngleEditor()
{
}
//下拉式还是弹出式
public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.DropDown;
} // 为属性显示UI编辑框
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
{
//值类型不为double,直接返回value
if (value.GetType() != typeof(double))
return value; //值为double,显示下拉式或弹出编辑框
IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (edSvc != null)
{
// 显示编辑框并初始化编辑框的值
AngleControl angleControl = new AngleControl((double)value);
edSvc.DropDownControl(angleControl);
// 返回编辑框中编辑的值.
if (value.GetType() == typeof(double))
return angleControl.angle;
}
return value;
} //下面两个函数是为了在PropertyGrid中显示一个辅助的效果
//可以不用重写
public override void PaintValue(System.Drawing.Design.PaintValueEventArgs e)
{
int normalX = (e.Bounds.Width / );
int normalY = (e.Bounds.Height / ); e.Graphics.FillRectangle(new SolidBrush(Color.DarkBlue), e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
e.Graphics.FillEllipse(new SolidBrush(Color.White), e.Bounds.X + , e.Bounds.Y + , e.Bounds.Width - , e.Bounds.Height - );
e.Graphics.FillEllipse(new SolidBrush(Color.SlateGray), normalX + e.Bounds.X - , normalY + e.Bounds.Y - , , ); double radians = ((double)e.Value * Math.PI) / (double);
e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Red), ), normalX + e.Bounds.X, normalY + e.Bounds.Y,
e.Bounds.X + (normalX + (int)((double)normalX * Math.Cos(radians))),
e.Bounds.Y + (normalY + (int)((double)normalY * Math.Sin(radians))));
} public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context)
{
return true;
}
} // 这里是我们要显示出来的编辑器,把它作为一个内置类
//从UserControl继承,要在上面EditValue函数中使用的
internal class AngleControl : System.Windows.Forms.UserControl
{
public double angle; //编辑的角度
private float x; //鼠标位置
private float y; public AngleControl(double initial_angle)
{
this.angle = initial_angle;
}
//显现时,显示属性的当前值
protected override void OnLoad(EventArgs e)
{
int originX = (this.Width / );
int originY = (this.Height / );
this.x = (float)( * Math.Cos(this.angle * Math.PI / ) + originX);
this.y = (float)( * Math.Sin(this.angle * Math.PI / ) + originY);
base.OnLoad(e);
} //绘制控件,用来显示编辑角度
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
int originX = (this.Width / );
int originY = (this.Height / ); e.Graphics.DrawEllipse(Pens.Black, originX - , originY - , , );
e.Graphics.DrawLine(Pens.Black, originX, originY, x, y); e.Graphics.DrawString("Angle:" + this.angle, this.Font, Brushes.Red, , );
}
//鼠标移动时设置角度
protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
int originX = (this.Width / );
int originY = (this.Height / );
double len = Math.Sqrt(Math.Pow(e.X - originX, ) + Math.Pow(e.Y - originY, ));
double h = e.Y - originY;
this.angle = Math.Asin(h / len);
if ((e.X >= originX && e.Y >= originY))
{
this.x = (float)( * Math.Cos(this.angle) + originX);
this.y = (float)( * Math.Sin(this.angle) + originY);
this.angle = this.angle * / Math.PI;
}
else if (e.X < originX && e.Y > originY)
{
this.x = (float)(originX - * Math.Cos(this.angle));
this.y = (float)( * Math.Sin(this.angle) + originY);
this.angle = - this.angle * / Math.PI;
}
else if (e.X < originX && e.Y < originY)
{
this.x = (float)(originX - * Math.Cos(this.angle));
this.y = (float)(originY + * Math.Sin(this.angle));
this.angle = - this.angle * / Math.PI;
}
else if (e.X >= originX && e.Y <= originY)
{
this.x = (float)(originX + * Math.Cos(this.angle));
this.y = (float)(originY + * Math.Sin(this.angle));
this.angle = + this.angle * / Math.PI;
}
this.Invalidate();
} } }

  这里有两个类,一个是AngleEditor,他就是我们要用于到属性特性中的编辑类,一个是AngleControl,他是辅助AngleEditor来编辑属性的,也就是说,他就是一个form,当我们编辑属性时,他会显现出来,供我们编辑属性值,可以是textBox,图形,表格,各种方式,只需要最后他返回编辑好的属性值给AngleEditor类。在AngleEditor类中的EditValue函数中,我们会调用AngleControl类,并接受它返回的值。

  设计好编辑类后,把它应用到MyControl类中的Angle属性中,在Angle属性中增加特性[EditorAttribute(typeof(AngleEditor), typeof(System.Drawing.Design.UITypeEditor))],相当于告诉PropertyGrid我们要用AngleEditor来编辑这个属性。

  

         [BrowsableAttribute(true)]
[EditorAttribute(typeof(AngleEditor), typeof(System.Drawing.Design.UITypeEditor))]
public double Angle
{
get
{ return _angle; }
set
{ _angle = value; }
}

  好了,现在就可以使用下拉框来编辑我们的Angle属性了,效果如下:

  

  上面那个圆圈就是我们用来编辑角度的。

三.弹出式编辑方式

  实现了下拉式,我们来实现弹出式,弹出式和下拉式非常的相像,现在要弹出一个编辑框,因此我们的AngleControl类不能从UserControl继承,而从From继承,让他成为一个对话框,在AngleEditor的EditValue函数中,弹出他并接受返回值,如下:

  

 [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
public class AngleEditor : System.Drawing.Design.UITypeEditor
{
public AngleEditor()
{
}
//下拉式还是弹出式
public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;//弹出式
} // 为属性显示UI编辑框
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
{
//值类型不为double,直接返回value
if (value.GetType() != typeof(double))
return value; //值为double,显示下拉式或弹出编辑框
IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (edSvc != null)
{
// 显示编辑框并初始化编辑框的值
AngleControl2 angleControl = new AngleControl2((double)value);
edSvc.ShowDialog(angleControl);
// 返回编辑框中编辑的值.
if (value.GetType() == typeof(double))
return angleControl.angle;
}
return value;
} //下面两个函数是为了在PropertyGrid中显示一个辅助的效果
//可以不用重写
public override void PaintValue(System.Drawing.Design.PaintValueEventArgs e)
{
int normalX = (e.Bounds.Width / );
int normalY = (e.Bounds.Height / ); e.Graphics.FillRectangle(new SolidBrush(Color.DarkBlue), e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
e.Graphics.FillEllipse(new SolidBrush(Color.White), e.Bounds.X + , e.Bounds.Y + , e.Bounds.Width - , e.Bounds.Height - );
e.Graphics.FillEllipse(new SolidBrush(Color.SlateGray), normalX + e.Bounds.X - , normalY + e.Bounds.Y - , , ); double radians = ((double)e.Value * Math.PI) / (double);
e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Red), ), normalX + e.Bounds.X, normalY + e.Bounds.Y,
e.Bounds.X + (normalX + (int)((double)normalX * Math.Cos(radians))),
e.Bounds.Y + (normalY + (int)((double)normalY * Math.Sin(radians))));
} public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context)
{
return true;
}
} // 这里是我们要显示出来的编辑器,把它作为一个内置类
//从UserControl继承,要在上面EditValue函数中使用的
internal class AngleControl2 : System.Windows.Forms.Form
{
public double angle; //编辑的角度
private float x; //鼠标位置
private float y; public AngleControl(double initial_angle)
{
this.angle = initial_angle;
}
//显现时,显示属性的当前值
protected override void OnLoad(EventArgs e)
{
int originX = (this.Width / );
int originY = (this.Height / );
this.x = (float)( * Math.Cos(this.angle * Math.PI / ) + originX);
this.y = (float)( * Math.Sin(this.angle * Math.PI / ) + originY);
base.OnLoad(e);
} //绘制控件,用来显示编辑角度
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
int originX = (this.Width / );
int originY = (this.Height / ); e.Graphics.DrawEllipse(Pens.Black, originX - , originY - , , );
e.Graphics.DrawLine(Pens.Black, originX, originY, x, y); e.Graphics.DrawString("Angle:" + this.angle, this.Font, Brushes.Red, , );
}
//鼠标移动时设置角度
protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
int originX = (this.Width / );
int originY = (this.Height / );
double len = Math.Sqrt(Math.Pow(e.X - originX, ) + Math.Pow(e.Y - originY, ));
double h = e.Y - originY;
this.angle = Math.Asin(h / len);
if ((e.X >= originX && e.Y >= originY))
{
this.x = (float)( * Math.Cos(this.angle) + originX);
this.y = (float)( * Math.Sin(this.angle) + originY);
this.angle = this.angle * / Math.PI;
}
else if (e.X < originX && e.Y > originY)
{
this.x = (float)(originX - * Math.Cos(this.angle));
this.y = (float)( * Math.Sin(this.angle) + originY);
this.angle = - this.angle * / Math.PI;
}
else if (e.X < originX && e.Y < originY)
{
this.x = (float)(originX - * Math.Cos(this.angle));
this.y = (float)(originY + * Math.Sin(this.angle));
this.angle = - this.angle * / Math.PI;
}
else if (e.X >= originX && e.Y <= originY)
{
this.x = (float)(originX + * Math.Cos(this.angle));
this.y = (float)(originY + * Math.Sin(this.angle));
this.angle = + this.angle * / Math.PI;
}
this.Invalidate();
} } }

  可以看到,只修改了三个地方:

  1. AngleEditor类中GetEditStyle函数返回Modal,表明是以弹出式编辑。
  2. AngleEditor类中EditValue函数中调用编辑控件的方式:

    AngleControl2 angleControl = new AngleControl2((double)value);

    edSvc.ShowDialog(angleControl);

  3.AngleControl2从Form继承,让他显示为对话框,这里为了区别上面的AngleControl类,将其改成了AngleControl2。

  现在看看效果:

  

  实现了弹出式的编辑方式。

四.完整代码

  下面是完整的代码:

  

 using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design; namespace TestUITypeEditor
{
//编辑器类
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
public class AngleEditor : System.Drawing.Design.UITypeEditor
{
public AngleEditor()
{
} //下拉式还是弹出式
public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.DropDown;
//return UITypeEditorEditStyle.Modal;
} //编辑属性值
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
{
if (value.GetType() != typeof(double))
return value; //显示编辑框
IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (edSvc != null)
{
AngleControl angleControl = new AngleControl((double)value);
edSvc.DropDownControl(angleControl);
//AngleControl2 angleControl = new AngleControl2((double)value);
//edSvc.ShowDialog(angleControl); // 获取返回值
if (value.GetType() == typeof(double))
return angleControl.angle;
}
return value;
} //绘制辅助属性显示
public override void PaintValue(System.Drawing.Design.PaintValueEventArgs e)
{
int normalX = (e.Bounds.Width / );
int normalY = (e.Bounds.Height / ); e.Graphics.FillRectangle(new SolidBrush(Color.DarkBlue), e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
e.Graphics.FillEllipse(new SolidBrush(Color.White), e.Bounds.X + , e.Bounds.Y + , e.Bounds.Width - , e.Bounds.Height - );
e.Graphics.FillEllipse(new SolidBrush(Color.SlateGray), normalX + e.Bounds.X - , normalY + e.Bounds.Y - , , ); double radians = ((double)e.Value * Math.PI) / (double);
e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Red), ), normalX + e.Bounds.X, normalY + e.Bounds.Y,
e.Bounds.X + (normalX + (int)((double)normalX * Math.Cos(radians))),
e.Bounds.Y + (normalY + (int)((double)normalY * Math.Sin(radians))));
} //使用辅助属性显示
public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context)
{
return true;
}
} // 下拉式编辑方式
internal class AngleControl : System.Windows.Forms.UserControl
{
public double angle;
private float x;
private float y; public AngleControl(double initial_angle)
{
this.angle = initial_angle;
} protected override void OnLoad(EventArgs e)
{
int originX = (this.Width / );
int originY = (this.Height / ); this.x = (float)( * Math.Cos(this.angle * Math.PI / ) + originX);
this.y = (float)( * Math.Sin(this.angle * Math.PI / ) + originY); base.OnLoad(e);
} protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
int originX = (this.Width / );
int originY = (this.Height / ); e.Graphics.DrawEllipse(Pens.Black, originX - , originY - , , );
e.Graphics.DrawLine(Pens.Black, originX, originY, x, y); e.Graphics.DrawString("Angle:" + this.angle, this.Font, Brushes.Red, , );
} protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
int originX = (this.Width / );
int originY = (this.Height / );
double len = Math.Sqrt(Math.Pow(e.X - originX, ) + Math.Pow(e.Y - originY, ));
double h = e.Y - originY;
this.angle = Math.Asin(h / len);
if ((e.X >= originX && e.Y >= originY))
{
this.x = (float)( * Math.Cos(this.angle) + originX);
this.y = (float)( * Math.Sin(this.angle) + originY); this.angle = this.angle * / Math.PI;
}
else if (e.X < originX && e.Y > originY)
{
this.x = (float)(originX - * Math.Cos(this.angle));
this.y = (float)( * Math.Sin(this.angle) + originY); this.angle = - this.angle * / Math.PI;
}
else if (e.X < originX && e.Y < originY)
{
this.x = (float)(originX - * Math.Cos(this.angle));
this.y = (float)(originY + * Math.Sin(this.angle)); this.angle = - this.angle * / Math.PI;
}
else if (e.X >= originX && e.Y <= originY)
{
this.x = (float)(originX + * Math.Cos(this.angle));
this.y = (float)(originY + * Math.Sin(this.angle)); this.angle = + this.angle * / Math.PI;
} this.Invalidate();
}
}
} //弹出式编辑框
internal class AngleControl2 : System.Windows.Forms.Form
{
public double angle;
private float x;
private float y; public AngleControl2(double initial_angle)
{
this.angle = initial_angle;
} protected override void OnLoad(EventArgs e)
{
int originX = (this.Width / );
int originY = (this.Height / ); this.x = (float)( * Math.Cos(this.angle * Math.PI / ) + originX);
this.y = (float)( * Math.Sin(this.angle * Math.PI / ) + originY); base.OnLoad(e);
} protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
int originX = (this.Width / );
int originY = (this.Height / ); e.Graphics.DrawEllipse(Pens.Black, originX - , originY - , , );
e.Graphics.DrawLine(Pens.Black, originX, originY, x, y); e.Graphics.DrawString("Angle:" + this.angle, this.Font, Brushes.Red, , );
} protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
int originX = (this.Width / );
int originY = (this.Height / );
double len = Math.Sqrt(Math.Pow(e.X - originX, ) + Math.Pow(e.Y - originY, ));
double h = e.Y - originY;
this.angle = Math.Asin(h / len);
if ((e.X >= originX && e.Y >= originY))
{
this.x = (float)( * Math.Cos(this.angle) + originX);
this.y = (float)( * Math.Sin(this.angle) + originY); this.angle = this.angle * / Math.PI;
}
else if (e.X < originX && e.Y > originY)
{
this.x = (float)(originX - * Math.Cos(this.angle));
this.y = (float)( * Math.Sin(this.angle) + originY); this.angle = - this.angle * / Math.PI;
}
else if (e.X < originX && e.Y < originY)
{
this.x = (float)(originX - * Math.Cos(this.angle));
this.y = (float)(originY + * Math.Sin(this.angle)); this.angle = - this.angle * / Math.PI;
}
else if (e.X >= originX && e.Y <= originY)
{
this.x = (float)(originX + * Math.Cos(this.angle));
this.y = (float)(originY + * Math.Sin(this.angle)); this.angle = + this.angle * / Math.PI;
} this.Invalidate();
}
}
} //控件
public class MyControl : System.Windows.Forms.UserControl
{
private double _angle; [BrowsableAttribute(true)]
[EditorAttribute(typeof(AngleEditor), typeof(System.Drawing.Design.UITypeEditor))]
public double Angle
{
get
{ return _angle; }
set
{ _angle = value; }
} public MyControl()
{
this._angle = ;
} protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
e.Graphics.DrawString("The Angle is " + _angle, this.Font, Brushes.Red,,);
}
}
}

  新建Window工程,添加该文件,在工具箱中将MyControl控件拖入Form,在属性框中编辑Angle属性。

  这里我们把AngleControl和AngleControl2都集成在里面了,当然实际只需选中一种,要实现弹出式,只需按照(三)中的方法,修改AngleEditor中两个地方即可。

PropertyGrid—为复杂属性提供下拉式编辑框和弹出式编辑框的更多相关文章

  1. 上拉、下拉UITableView,交互式 模态弹出(自定义弹出动画)

    部分代码 InteractiveTransition 类继承NSObject: - (instancetype)initWithPresentingController:(UITableViewCon ...

  2. angularjs 绑定多个属性到下拉框

    绑定下拉框 angularjs  代码: //活动下拉切换 $scope.activityChange = function () { var cards = new Array(); var url ...

  3. 让小区运营再智能一点,EasyRadius正式向WayOs用户提供到期弹出式提示充值页面

    其实一直没向用户提供到期弹出式页面,主要是给VIP群的用户一点优越感,随着这次EasyRadius的更新,海哥就免费向普通easyRadius用户提供这两个模板下载. 有些人会问,什么样的模板.有什么 ...

  4. firefox浏览器中 bootstrap 静态弹出框中select下拉框不能弹出(解决方案)

    问题出现场景1: 在firefox浏览器中在bootstrap弹出的modal静态框中再次弹出一个静态框时 select下拉框不能弹出选项 解决方案:去掉最外层静态框的 tabindex=" ...

  5. Jquery获取下拉选择节点名称值赋给textbox文本框 获取 父节点的栏目名称编号

    <label for="parentNode" style="float:left" >父级栏目:</label> <select ...

  6. web开发实战--弹出式富文本编辑器的实现思路和踩过的坑

    前言: 和弟弟合作, 一起整了个智慧屋的小web站点, 里面包含了很多经典的智力和推理题. 其实该站点从技术层面来分析的话, 也算一个信息发布站点. 因此在该网站的后台运营中, 富文本的编辑器显得尤为 ...

  7. ZH奶酪:Ionic中(弹出式窗口)的$ionicModal使用方法

    Ionic中[弹出式窗口]有两种(如下图所示),$ionicModal和$ionicPopup; $ionicModal是完整的页面: $ionicPopup是(Dialog)对话框样式的,直接用Ja ...

  8. Operating System-Thread(5)弹出式线程&&使单线程代码多线程化会产生那些问题

    本文主要内容 弹出式线程(Pop-up threads) 使单线程代码多线程化会产生那些问题 一.弹出式线程(Pop-up threads) 以在一个http到达之后一个Service的处理为例子来介 ...

  9. JS框架_(JQuery.js)Tooltip弹出式按钮插件

    百度云盘 传送门 密码:7eh5 弹出式按钮效果 <!DOCTYPE html> <html > <head> <meta charset="UTF ...

随机推荐

  1. Android Studio代码自己主动提示无效(not available in Power Save mode)

    针对一位博友提的问题,我这边写出来,预计还是非常多人会碰到这个问题,可是不知道怎样解决的. 就是在设置了代码自己主动提示功能后,发现不生效的,怎样设置代码自己主动提示请戳这:Android Studi ...

  2. MapReduce程序依赖的jar包

    难得想写个mapreduce程序.发现已经不记得须要加入那些jar包了,网上找了一会也没发现准确的答案.幸好对hadoop体系结构略知一二.迅速试出了写mapreduce程序须要的五个jar包. 不多 ...

  3. PreferenceFragment 使用 小结

    Perference也就是我们常说的偏好设置,首选项设置,能够自己主动保存一些数据,比如我们在上一次使用的时候的一些内容,则在下一次启动后依旧生效,而不须要再进行配置.当用户改变设置时,系统就会更新S ...

  4. 如何彻底解决jsp页面中文乱码及数据库乱码

    最近自己闲做一个小项目,搭建环境框架SSH+MySQL数据库,遇到一个问题:jsp页面中文显示乱码,数据库插入数据和更新数据时中文也显示乱码,后来在网上找了许多解决方法,还是折腾了两天才把问题解决,下 ...

  5. 【计算几何初步-凸包-Jarvis步进法。】【HDU1392】Surround the Trees

    [科普]什么是BestCoder?如何参加? Surround the Trees Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65 ...

  6. 实现两个select list box间item的移动和过滤

    <head> <title> </title> <!--Standard jQuery --> <script type="text/j ...

  7. Libreoffice汉化

    汉化过程:在终端下输入即可 sudo apt-get install libreoffice-l10n-zh-cn 注意啦:在汉化libreffice之前,一定要先给ubuntu装上中文字体,否则汉化 ...

  8. MYSQL分页存储过程及事务处理--转自peace

    MYSQL的分页过程,和事务处理的一个测试过程. /* --名称:MYSQL版查询分页存储过程 by peace 2013-8-14 --输入参数:@fields -- 要查询的字段用逗号隔开 --输 ...

  9. MySQL validate_password 插件

    从创建用户说起: 如我们在mysql中可以用grant all on *.* to userd@'localhost' identified by '123'; 来创建一个userd用户,虽然用户是创 ...

  10. 微软云基础架构Hyper-scale Datacenter

    每天醒来,可能很多人的习惯都是打开手机,看看微信,刷刷朋友圈,或者看看新闻,去咖啡店,打开电脑搜索一些关键字,观看视频,电视剧--可是你有没有想过你每一次键盘的敲击,每一次微信的语音的发送,数据会流向 ...