| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:DockPaneCaptionBase.cs
- * 2.功能描述:类文件
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2014/09/01 1.00 新建
- *******************************************************************************/
- using System.Drawing;
- using System.Security.Permissions;
- using System.Windows.Forms;
- namespace Dongke.IBOSS.PRD.Basics.DockPanel
- {
- /// <summary>
- /// 类文件
- /// </summary>
- public abstract class DockPaneCaptionBase : Control
- {
- protected internal DockPaneCaptionBase(DockPane pane)
- {
- m_dockPane = pane;
- SetStyle(ControlStyles.OptimizedDoubleBuffer |
- ControlStyles.ResizeRedraw |
- ControlStyles.UserPaint |
- ControlStyles.AllPaintingInWmPaint, true);
- SetStyle(ControlStyles.Selectable, false);
- }
- private DockPane m_dockPane;
- protected DockPane DockPane
- {
- get
- {
- return m_dockPane;
- }
- }
- protected DockPane.AppearanceStyle Appearance
- {
- get
- {
- return DockPane.Appearance;
- }
- }
- protected bool HasTabPageContextMenu
- {
- get
- {
- return DockPane.HasTabPageContextMenu;
- }
- }
- protected void ShowTabPageContextMenu(Point position)
- {
- DockPane.ShowTabPageContextMenu(this, position);
- }
- protected override void OnMouseUp(MouseEventArgs e)
- {
- base.OnMouseUp(e);
- if (e.Button == MouseButtons.Right)
- ShowTabPageContextMenu(new Point(e.X, e.Y));
- }
- protected override void OnMouseDown(MouseEventArgs e)
- {
- base.OnMouseDown(e);
- if (e.Button == MouseButtons.Left &&
- DockPane.DockPanel.AllowEndUserDocking &&
- DockPane.AllowDockDragAndDrop &&
- !DockHelper.IsDockStateAutoHide(DockPane.DockState) &&
- DockPane.ActiveContent != null)
- DockPane.DockPanel.BeginDrag(DockPane);
- }
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
- protected override void WndProc(ref Message m)
- {
- if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
- {
- if (DockHelper.IsDockStateAutoHide(DockPane.DockState))
- {
- DockPane.DockPanel.ActiveAutoHideContent = null;
- return;
- }
- if (DockPane.IsFloat)
- DockPane.RestoreToPanel();
- else
- DockPane.Float();
- }
- base.WndProc(ref m);
- }
- internal void RefreshChanges()
- {
- if (IsDisposed)
- return;
- OnRefreshChanges();
- }
- protected virtual void OnRightToLeftLayoutChanged()
- {
- }
- protected virtual void OnRefreshChanges()
- {
- }
- protected internal abstract int MeasureHeight();
- }
- }
|