暂时还没有全部完成,绘制的工作已经全部OK,事件的处理还在进行中,先把效果发出来下.
一.设计时效果:
二.运行时效果:
三.简单谈谈设计思路:
由于这段时间工作比较忙,谢谢c#代码的时间很好,所以直到昨天才把本来很少的代码完成.现在谈谈主要的实现思路.
这个控件同样是一个复合控件,由一个Captiontop(继承自panel的控件),与一个jcstoolbox组成.captiontop主要实现菜单,停靠,关闭等按钮的操作与事件响应.jcstoolbox来实现各个category组的具体绘制工作.toolleft,要在左侧来绘制图片与竖体布局的文字.在它的onmousehover事件中对鼠标作出处理.使用一个timer来判断是否鼠标离开了复合控件,并且停靠按钮没有被设置为"别针".部分代码如下,如果对全部源代码感兴趣,可以mail给我:
四.部分源代码:
using
System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace JcsExpLibary.JcsToolBox
{
public partial class JcsToolBoxControl : UserControl
{
private bool _isexpend = false ;
private int _maxWidth = 196 ;
private Timer timer;
private ContextMenuStrip cmenu;
private bool _isstop = false ;
private const int _top = 15 ; // 工具栏的绘制初始位置
private const int _toolboxwidth = 28 ;
private Color _captionForeColor = Color.Black;
private ImageList _imagelist;
private string _caption = " 工具栏 " ;
private int _imageindex = 0 ;
private Image _image;
private bool _isMouseMove = false ;
private Rectangle _buttonRect;
private Rectangle _textRect;
public delegate
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace JcsExpLibary.JcsToolBox
{
public partial class JcsToolBoxControl : UserControl
{
private bool _isexpend = false ;
private int _maxWidth = 196 ;
private Timer timer;
private ContextMenuStrip cmenu;
private bool _isstop = false ;
private const int _top = 15 ; // 工具栏的绘制初始位置
private const int _toolboxwidth = 28 ;
private Color _captionForeColor = Color.Black;
private ImageList _imagelist;
private string _caption = " 工具栏 " ;
private int _imageindex = 0 ;
private Image _image;
private bool _isMouseMove = false ;
private Rectangle _buttonRect;
private Rectangle _textRect;
public delegate