├── .gitattributes ├── .gitignore ├── DirectUI ├── Collection │ ├── DUIControlCollectionGrid.cs │ └── DUIItemCollection.cs ├── Common │ ├── DUIEntitys │ │ ├── DUIAnyBounds.cs │ │ ├── DUIAnyBoundsPolygon.cs │ │ ├── DUIBitmap.cs │ │ ├── DUIBitmapBrush.cs │ │ ├── DUIBorder.cs │ │ ├── DUIBrush.cs │ │ ├── DUIBrushes.cs │ │ ├── DUIColor.cs │ │ ├── DUIDependentOnRenderTarget.cs │ │ ├── DUIDeviceContext.cs │ │ ├── DUIDeviceContext3.cs │ │ ├── DUIFont.cs │ │ ├── DUIGraphics.cs │ │ ├── DUIGraphicsState.cs │ │ ├── DUIGraphics_D2D.cs │ │ ├── DUIGraphics_GDIP.cs │ │ ├── DUIImage.cs │ │ ├── DUILinearGradientBrush.cs │ │ ├── DUIMatrix.cs │ │ ├── DUIMatrix4x4.cs │ │ ├── DUIPen.cs │ │ ├── DUIPens.cs │ │ ├── DUIQuadrangle.cs │ │ ├── DUIRectangle.cs │ │ ├── DUIRectangleF.cs │ │ ├── DUIRegion.cs │ │ ├── DUIRenderTarget.cs │ │ ├── DUISolidBrush.cs │ │ ├── DUITextRenderer.cs │ │ ├── DUIThreadSaveActions.cs │ │ ├── DUIThreadSaveBitmapBrush.cs │ │ ├── DUIThreadSaveImage.cs │ │ ├── DUITriangle.cs │ │ ├── DUITriangleF.cs │ │ ├── DUIWICRenderTarget.cs │ │ ├── DUIWindowRenderTarget.cs │ │ └── IDUIGraphics.cs │ ├── DUIEnum │ │ ├── DUIBoundsPolygonSpecified.cs │ │ ├── DUIBoundsSpecified.cs │ │ ├── DUIExtendMode.cs │ │ ├── DUIMode.cs │ │ ├── DUISmoothingMode.cs │ │ └── DUITextRenderingHint.cs │ ├── DUIEventArgs │ │ ├── DUIAnyChangingEventArgs.cs │ │ ├── DUIBoundsChangingEventArgs.cs │ │ ├── DUICenterChangingEventArgs.cs │ │ ├── DUIControlAnyChangingEventArgs.cs │ │ ├── DUIControlBoundsChangingEventArgs.cs │ │ ├── DUIControlCenterChangingEventArgs.cs │ │ ├── DUIControlEventArgs.cs │ │ ├── DUIControlLocationChangingEventArgs.cs │ │ ├── DUIControlRotateAngleChangingEventArgs.cs │ │ ├── DUIControlScaleChangingEventArgs.cs │ │ ├── DUIControlSizeChangingEventArgs.cs │ │ ├── DUIControlSkewChangingEventArgs.cs │ │ ├── DUILayoutEventArgs.cs │ │ ├── DUILocationChangingEventArgs.cs │ │ ├── DUIMouseEditChangingEventArgs.cs │ │ ├── DUIMouseEventArgs.cs │ │ ├── DUIMouseStateEventArgs.cs │ │ ├── DUIPaintEventArgs.cs │ │ ├── DUIParentAnyChangingEventArgs.cs │ │ ├── DUIParentBoundsChangingEventArgs.cs │ │ ├── DUIParentCenterChangingEventArgs.cs │ │ ├── DUIParentChangingEventArgs.cs │ │ ├── DUIParentEventArgs.cs │ │ ├── DUIParentLocationChangingEventArgs.cs │ │ ├── DUIParentRotateAngleChangingEventArgs.cs │ │ ├── DUIParentScaleChangingEventArgs.cs │ │ ├── DUIParentSizeChangingEventArgs.cs │ │ ├── DUIParentSkewChangingEventArgs.cs │ │ ├── DUIPolygonAnyChangingEventArgs.cs │ │ ├── DUIPolygonChangingEventArgs.cs │ │ ├── DUIRotateAngleChangingEventArgs.cs │ │ ├── DUIScaleChangingEventArgs.cs │ │ ├── DUIScrollEventArgs.cs │ │ ├── DUISizeChangingEventArgs.cs │ │ └── DUISkewChangingEventArgs.cs │ ├── DUIInfo.cs │ ├── DxConvert.cs │ ├── GDIP.cs │ ├── ImageDC.cs │ ├── Matrix4x4.cs │ └── Tools.cs ├── Controls │ ├── Button │ │ └── DUIButton.cs │ ├── CheckBox │ │ ├── DUICheckBox.cs │ │ ├── DUICheckBoxBase.cs │ │ ├── DUICheckState.cs │ │ └── DUIHexagonCheckBox.cs │ ├── Label │ │ └── DUILabel.cs │ ├── MenuStrip │ │ └── DUIMenuStrip.cs │ ├── Panel │ │ └── DUIPanel.cs │ ├── PictureBox │ │ └── DUIPictureBox.cs │ ├── ProgressBar │ │ └── DUIProgressBar.cs │ ├── RadioButton │ │ └── DUIRadioButton.cs │ ├── Ruler │ │ └── DUIRuler.cs │ ├── ScrollBar │ │ ├── DUIHScrollBar.cs │ │ ├── DUIScrollBar.cs │ │ └── DUIVScrollBar.cs │ ├── Switch │ │ ├── DUISwitch.cs │ │ └── DUISwitchNative.cs │ ├── TabControl │ │ ├── DUINativeTabControl.cs │ │ ├── DUITabControl.cs │ │ └── DUITabPage.cs │ ├── TextBox │ │ └── DUITextBox.cs │ ├── ToolBar │ │ ├── DUIToolBar.cs │ │ └── DUIToolBarItem.cs │ ├── ToolTip │ │ ├── ToolTipControl.cs │ │ ├── ToolTipEx.cs │ │ └── ToolTipForm.cs │ └── TrackBar │ │ └── DUITrackBar.cs ├── Core │ ├── Container │ │ ├── DUICaptionContainer.cs │ │ ├── DUICaptionContainerAlpha.cs │ │ └── DUIContainer.cs │ ├── Control │ │ ├── DUIControl.cs │ │ └── DUIPolygonControl.cs │ ├── DUIEditablePolygonControl │ │ ├── DUIEditablePolygonCenterControl.cs │ │ └── DUIEditablePolygonControl.cs │ ├── DUIEditableScaleParentControl │ │ ├── DUIEditableCenterScaleParentControl.cs │ │ ├── DUIEditableScaleParentControl.cs │ │ └── DUIEditableSuspendedScaleParentControl.cs │ ├── EditableControl │ │ ├── AlwaysModifierKeys.cs │ │ ├── DUIEditableCenterControl.cs │ │ ├── DUIEditableControl.cs │ │ ├── DUIEditableSuspendedControl.cs │ │ └── EffectMargin.cs │ ├── NativeControl │ │ └── DUINativeControl.cs │ ├── ScaleableControl │ │ └── DUIScaleableControl.cs │ └── ScrollableControl │ │ ├── DUIHScrollProperties.cs │ │ ├── DUIScrollProperties.cs │ │ ├── DUIScrollableControl.cs │ │ └── DUIVScrollProperties.cs ├── Cursors │ ├── DUICursors.cs │ └── rotateCursor.cur ├── DirectUI.csproj ├── Log │ └── DUILog.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── rotate.cur │ ├── tickBlack.png │ └── tickWhile.png ├── Share │ ├── DUIControlShare.cs │ └── LayoutEngine.cs ├── Tools │ ├── ConvertTools.cs │ ├── KeyBordHook.cs │ ├── LoopTool.cs │ ├── MatrixTools.cs │ ├── MouseHook.cs │ ├── PointTools.cs │ ├── PolygonTools.cs │ ├── RotateTools.cs │ ├── ShapeTools.cs │ └── TimeTools.cs └── Win32 │ ├── Callback │ └── Functions.cs │ ├── ClassName.cs │ ├── Com │ ├── DOCHOSTUIFLAG.cs │ ├── DOCHOSTUIINFO.cs │ ├── DWebBrowserEvents2.cs │ ├── ICustomDoc.cs │ ├── IDocHostUIHandler.cs │ ├── IDropTarget.cs │ ├── IOleCommandTarget.cs │ ├── IOleInPlaceActiveObject.cs │ ├── IOleInPlaceFrame.cs │ ├── IOleInPlaceUIWindow.cs │ ├── IWebBrowser2.cs │ ├── OLECMDEXECOPT.cs │ ├── OLECMDF.cs │ ├── OLECMDID.cs │ ├── tagMSG.cs │ ├── tagOLECMD.cs │ ├── tagPOINT.cs │ └── tagRECT.cs │ ├── Const │ ├── AC.cs │ ├── AW.cs │ ├── BI.cs │ ├── BM.cs │ ├── CDDS.cs │ ├── CDM.cs │ ├── CDN.cs │ ├── CDRF.cs │ ├── CS.cs │ ├── CombineRgnStyles.cs │ ├── DCX.cs │ ├── DI.cs │ ├── DIB.cs │ ├── DIGCF.cs │ ├── DROPEFFECT.cs │ ├── EM.cs │ ├── ERROR.cs │ ├── ESB.cs │ ├── GCL.cs │ ├── GCS.cs │ ├── GCW.cs │ ├── GWL.cs │ ├── HC.cs │ ├── HEAP.cs │ ├── HITTEST.cs │ ├── HT.cs │ ├── HWND.cs │ ├── ICC.cs │ ├── ICON.cs │ ├── INVALID.cs │ ├── LPSTR.cs │ ├── MA.cs │ ├── MEM.cs │ ├── NM.cs │ ├── OBJID.cs │ ├── OF.cs │ ├── PAGE.cs │ ├── PF.cs │ ├── PM.cs │ ├── PRF.cs │ ├── PROCESSOR.cs │ ├── RDW.cs │ ├── RGN.cs │ ├── SB.cs │ ├── SBM.cs │ ├── SC.cs │ ├── SIF.cs │ ├── SS.cs │ ├── SW.cs │ ├── SWP.cs │ ├── TBM.cs │ ├── TCHT.cs │ ├── TCM.cs │ ├── TME.cs │ ├── TPM.cs │ ├── TTDT.cs │ ├── TTF.cs │ ├── TTI.cs │ ├── TTM.cs │ ├── TTN.cs │ ├── TTS.cs │ ├── TernaryRasterOperations.cs │ ├── VK.cs │ ├── WA.cs │ ├── WAIT.cs │ ├── WH.cs │ ├── WM.cs │ ├── WS.cs │ ├── WS_EX.cs │ └── WVR.cs │ ├── DwmApi.cs │ ├── Helper.cs │ ├── HttpWebRequestHelper.cs │ ├── NativeMethods.cs │ ├── Result.cs │ ├── ShellHelper.cs │ ├── Struct │ ├── API_MSG.cs │ ├── BITMAPINFO.cs │ ├── BITMAPINFOHEADER.cs │ ├── BLENDFUNCTION.cs │ ├── COMDLG_FILTERSPEC.cs │ ├── COPYDATASTRUCT.cs │ ├── CWPRETSTRUCT.cs │ ├── CWPSTRUCT.cs │ ├── GPRECTF.cs │ ├── INITCOMMONCONTROLSEX.cs │ ├── KEYBOARDHOOKSTRUCT.cs │ ├── LOGBRUSH.cs │ ├── LOGFONT.cs │ ├── MEMORYSTATUSEX.cs │ ├── MEMORY_BASIC_INFORMATION.cs │ ├── MINMAXINFO.cs │ ├── MOUSEHOOKSTRUCT.cs │ ├── MOUSEHOOKSTRUCTEX.cs │ ├── NCCALCSIZE_PARAMS.cs │ ├── NMCUSTOMDRAW.cs │ ├── NMHDR.cs │ ├── NMTTCUSTOMDRAW.cs │ ├── NMTTDISPINFO.cs │ ├── OFNOTIFY.cs │ ├── OSVERSIONINFOEX.cs │ ├── OVERLAPPED.cs │ ├── PAINTSTRUCT.cs │ ├── PCURSORINFO.cs │ ├── POINT.cs │ ├── PROCESS_INFORMATION.cs │ ├── PROPERTYKEY.cs │ ├── RECT.cs │ ├── RGBQUAD.cs │ ├── RGNDATA.cs │ ├── RGNDATAHEADER.cs │ ├── SCROLLBARINFO.cs │ ├── SCROLLINFO.cs │ ├── SHELLEXECUTEINFO.cs │ ├── SIZE.cs │ ├── SP_DEVINFO_DATA.cs │ ├── STYLESTRUCT.cs │ ├── SYSTEM_INFO.cs │ ├── TCHITTESTINFO.cs │ ├── TOOLINFO.cs │ ├── TRACKMOUSEEVENT.cs │ ├── TT_HITTESTINFO.cs │ ├── UPDATELAYEREDWINDOWINFO.cs │ ├── WINDOWINFO.cs │ ├── WINDOWPLACEMENT.cs │ └── WINDOWPOS.cs │ ├── SystemInformationHelper.cs │ ├── WinAPI.cs │ └── WindowsType.cs ├── DirectUISample.sln ├── DirectUISample ├── App.config ├── DirectUISample.csproj ├── FmCompositeSample_Cubes.Designer.cs ├── FmCompositeSample_Cubes.cs ├── FmCompositeSample_Cubes.resx ├── FmDUIControlDemo.Designer.cs ├── FmDUIControlDemo.cs ├── FmDUIControlDemo.resx ├── FmDUIEditableControlDemo.Designer.cs ├── FmDUIEditableControlDemo.cs ├── FmDUIEditableControlDemo.resx ├── FmDUIScaleableControlDemo.Designer.cs ├── FmDUIScaleableControlDemo.cs ├── FmDUIScaleableControlDemo.resx ├── FmDUIScrollableControlDemo.Designer.cs ├── FmDUIScrollableControlDemo.cs ├── FmDUIScrollableControlDemo.resx ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings └── Resources │ ├── 1.jpg │ └── 2.jpg ├── README.md └── SampleGif ├── Cubes.gif ├── DUIControl.gif ├── DUIEditableControl.gif ├── DUIScaleableControl.gif └── DUIScrollableControl.gif /DirectUI/Common/DUIEntitys/DUIBorder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | /// 用来描述控件的边框 10 | /// 11 | public class DUIBorder 12 | { 13 | private Color borderColor = Color.Black; 14 | private float borderWidth = 0; 15 | /// 边框颜色 16 | /// 17 | public virtual Color BorderColor 18 | { 19 | get { return borderColor; } 20 | } 21 | /// 边框宽度 22 | /// 23 | public virtual float BorderWidth 24 | { 25 | get { return borderWidth; } 26 | } 27 | public DUIBorder() 28 | { 29 | } 30 | public DUIBorder(Color borderColor, float borderWidth) 31 | { 32 | this.borderColor = borderColor; 33 | this.borderWidth = borderWidth; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUIBrush.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUIBrush : DUIDependentOnRenderTarget 10 | { 11 | protected SharpDX.Direct2D1.Brush dxBrush = null; 12 | protected System.Drawing.Brush brush = null; 13 | protected virtual SharpDX.Direct2D1.Brush DxBrush 14 | { 15 | get 16 | { 17 | if (dxBrush == null || isNewRenderTarget) 18 | { 19 | if (this.RenderTarget != null) 20 | { 21 | if (dxBrush != null) 22 | { 23 | dxBrush.Dispose(); 24 | dxBrush = null; 25 | } 26 | dxBrush = DxConvert.ToBrush(this.RenderTarget, this.brush); 27 | isNewRenderTarget = false; 28 | } 29 | } 30 | return dxBrush; 31 | } 32 | } 33 | public static implicit operator Brush(DUIBrush dUIBrush) 34 | { 35 | return dUIBrush.brush; 36 | } 37 | 38 | public static implicit operator SharpDX.Direct2D1.Brush(DUIBrush dUIBrush) 39 | { 40 | return dUIBrush.DxBrush; 41 | } 42 | 43 | public override void Dispose() 44 | { 45 | if (this.dxBrush != null) 46 | { 47 | this.dxBrush.Dispose(); 48 | } 49 | if (this.brush != null) 50 | { 51 | this.brush.Dispose(); 52 | } 53 | base.Dispose(); 54 | } 55 | 56 | public override void DisposeDx() 57 | { 58 | if (this.dxBrush != null) 59 | { 60 | this.dxBrush.Dispose(); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUIColor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUIColor 10 | { 11 | private System.Drawing.Color color = new Color(); 12 | private SharpDX.Mathematics.Interop.RawColor4 dxColor4 = new SharpDX.Mathematics.Interop.RawColor4(); 13 | 14 | internal SharpDX.Mathematics.Interop.RawColor4 DxColor4 15 | { 16 | get { return dxColor4; } 17 | } 18 | public DUIColor(System.Drawing.Color color) 19 | { 20 | this.color = color; 21 | this.dxColor4 = new SharpDX.Mathematics.Interop.RawColor4((float)color.R / 255f, (float)color.G / 255f, (float)color.B / 255f, (float)color.A / 255f); 22 | } 23 | public static implicit operator SharpDX.Mathematics.Interop.RawColor4(DUIColor dUIColor) 24 | { 25 | return dUIColor.DxColor4; 26 | } 27 | public static implicit operator System.Drawing.Color(DUIColor dUIColor) 28 | { 29 | return dUIColor.color; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUIDependentOnRenderTarget.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using SharpDX.IO; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.Drawing.Imaging; 7 | using System.IO; 8 | using System.Linq; 9 | using System.Text; 10 | 11 | namespace DirectUI.Common 12 | { 13 | /// 依赖RenderTarget的对象,例如DUIImage,DUIBitmap等 14 | /// 15 | public abstract class DUIDependentOnRenderTarget : IDisposable 16 | { 17 | protected bool isNewRenderTarget = false; 18 | private DUIRenderTarget renderTarget = null; 19 | internal protected DUIRenderTarget RenderTarget 20 | { 21 | get { return renderTarget; } 22 | set 23 | { 24 | if (renderTarget != value) 25 | { 26 | renderTarget?.DependentOnRenderTargets.Remove(this); 27 | renderTarget = value; 28 | value.DependentOnRenderTargets.Add(this); 29 | isNewRenderTarget = true; 30 | } 31 | } 32 | } 33 | public virtual void Dispose() 34 | { 35 | renderTarget?.DependentOnRenderTargets.Remove(this); 36 | } 37 | public abstract void DisposeDx(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUIQuadrangle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUIQuadrangle 10 | { 11 | private PointF plt; 12 | private PointF prt; 13 | private PointF plb; 14 | private PointF prb; 15 | private bool convexQuadrilateral = true; 16 | public DUIQuadrangle(PointF plt, PointF prt, PointF plb, PointF prb) 17 | { 18 | this.plt = plt; 19 | this.plt = prt; 20 | this.plt = plb; 21 | this.plt = prb; 22 | float t1 = (plb.X - plt.X) * (prt.Y - plt.Y) - (plb.Y - plt.Y) * (prt.X - plt.X); 23 | float t2 = (plt.X - prt.X) * (prb.Y - prt.Y) - (plt.Y - prt.Y) * (prb.X - prt.X); 24 | float t3 = (prt.X - prb.X) * (plb.Y - prb.Y) - (prt.Y - prb.Y) * (plb.X - prb.X); 25 | float t4 = (prb.X - plb.X) * (plt.Y - plb.Y) - (prb.Y - plb.Y) * (plt.X - plb.X); 26 | if (t1 * t2 * t3 * t4 < 0) 27 | { 28 | convexQuadrilateral = true; 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUIRectangle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUIRectangle 10 | { 11 | private System.Drawing.Rectangle rectangle = new Rectangle(); 12 | private SharpDX.Mathematics.Interop.RawRectangle dxRectangle = new SharpDX.Mathematics.Interop.RawRectangle(); 13 | 14 | internal SharpDX.Mathematics.Interop.RawRectangle DxRectangle 15 | { 16 | get { return dxRectangle; } 17 | } 18 | public DUIRectangle(System.Drawing.Rectangle rectangle) 19 | { 20 | this.rectangle = rectangle; 21 | this.dxRectangle = new SharpDX.Mathematics.Interop.RawRectangle(this.rectangle.Left, this.rectangle.Top, this.rectangle.Right, this.rectangle.Bottom); 22 | } 23 | public static implicit operator SharpDX.Mathematics.Interop.RawRectangle(DUIRectangle dUIRectangle) 24 | { 25 | return dUIRectangle.DxRectangle; 26 | } 27 | public static implicit operator System.Drawing.Rectangle(DUIRectangle dUIRectangle) 28 | { 29 | return dUIRectangle.rectangle; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUIRectangleF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUIRectangleF 10 | { 11 | private System.Drawing.RectangleF rectangle = new RectangleF(); 12 | private SharpDX.Mathematics.Interop.RawRectangleF dxRectangleF = new SharpDX.Mathematics.Interop.RawRectangleF(); 13 | 14 | internal SharpDX.Mathematics.Interop.RawRectangleF DxRectangleF 15 | { 16 | get { return dxRectangleF; } 17 | } 18 | public DUIRectangleF(System.Drawing.RectangleF rectangle) 19 | { 20 | this.rectangle = rectangle; 21 | this.dxRectangleF = new SharpDX.Mathematics.Interop.RawRectangleF(this.rectangle.Left, this.rectangle.Top, this.rectangle.Right, this.rectangle.Bottom); 22 | } 23 | public static implicit operator SharpDX.Mathematics.Interop.RawRectangleF(DUIRectangleF dUIRectangle) 24 | { 25 | return dUIRectangle.DxRectangleF; 26 | } 27 | public static implicit operator System.Drawing.RectangleF(DUIRectangleF dUIRectangle) 28 | { 29 | return dUIRectangle.rectangle; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUIRenderTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public abstract class DUIRenderTarget : IDisposable 10 | { 11 | private DUIDependentOnRenderTargetCollection dependentOnRenderTargets = null; 12 | internal DUIDependentOnRenderTargetCollection DependentOnRenderTargets => this.dependentOnRenderTargets ?? (this.dependentOnRenderTargets = new DUIDependentOnRenderTargetCollection(this)); 13 | public abstract SharpDX.Direct2D1.RenderTarget RenderTarget { get; } 14 | public IntPtr NativePointer => this.RenderTarget.NativePointer; 15 | public virtual float DpiX { get { return 96; } } 16 | public virtual float DpiY { get { return 96; } } 17 | public virtual void BeginDraw() 18 | { 19 | this.RenderTarget.BeginDraw(); 20 | } 21 | public virtual void Resize(Size size) 22 | { 23 | } 24 | public virtual void EndDraw() 25 | { 26 | this.RenderTarget.EndDraw(); 27 | } 28 | public virtual void Dispose() 29 | { 30 | this.DependentOnRenderTargets.Clear(); 31 | } 32 | public static implicit operator SharpDX.Direct2D1.RenderTarget(DUIRenderTarget dUIRenderTarget) 33 | { 34 | return dUIRenderTarget.RenderTarget; 35 | } 36 | public class DUIDependentOnRenderTargetCollection : Collection.DUIItemCollection 37 | { 38 | private object lockObj = new object(); 39 | public DUIDependentOnRenderTargetCollection(DUIRenderTarget owner) : base(owner) 40 | { 41 | } 42 | public override void Add(DUIDependentOnRenderTarget item) 43 | { 44 | lock (lockObj) 45 | { 46 | base.Add(item); 47 | } 48 | } 49 | public override void Remove(DUIDependentOnRenderTarget item) 50 | { 51 | lock (lockObj) 52 | { 53 | base.Remove(item); 54 | } 55 | } 56 | public override void Clear() 57 | { 58 | lock (lockObj) 59 | { 60 | foreach (DUIDependentOnRenderTarget t in this) 61 | { 62 | t.DisposeDx(); 63 | } 64 | base.Clear(); 65 | } 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUISolidBrush.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUISolidBrush : DUIBrush 10 | { 11 | // 摘要: 12 | // 初始化指定颜色的新 System.Drawing.SolidBrush 对象。 13 | // 14 | // 参数: 15 | // color: 16 | // 一个 System.Drawing.Color 结构,它表示此画笔的颜色。 17 | public DUISolidBrush(Color color) 18 | { 19 | this.brush = new SolidBrush(color); 20 | } 21 | public Color Color 22 | { 23 | get { return (this.brush as SolidBrush).Color; } 24 | set 25 | { 26 | (this.brush as SolidBrush).Color = value; 27 | //if (this.dxBrush != null) 28 | //{ 29 | // var c = DxConvert.ToColor4(value); 30 | // SharpDX.Direct2D1.SolidColorBrush b = this.dxBrush as SharpDX.Direct2D1.SolidColorBrush; 31 | // b.Color = c; 32 | // //if (this.dxBrush != null && b.Color != c) 33 | // //{ 34 | // // b.Color = c; 35 | // //} 36 | //} 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUITextRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | /// 提供用于测量和呈现文本的方法。无法继承此类。 10 | /// 11 | public sealed class DUITextRenderer 12 | { 13 | /// 在使用指定字体绘制时,提供指定文本的尺寸(以像素为单位)。 14 | /// 15 | /// 要测量的文本。 16 | /// 要应用于已测量文本的 DUIFont。 17 | /// 18 | public static SizeF MeasureText(string text, DUIFont font) 19 | { 20 | using (SharpDX.DirectWrite.TextLayout tl = DxConvert.ToTextLayout(font, text)) 21 | { 22 | float w = tl.Metrics.WidthIncludingTrailingWhitespace; 23 | float h = tl.Metrics.Height; 24 | return new SizeF(w, h); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUITriangle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUITriangle 10 | { 11 | private Point p1; 12 | private Point p2; 13 | private Point p3; 14 | 15 | public Point P1 16 | { 17 | get { return p1; } 18 | set { p1 = value; } 19 | } 20 | public Point P2 21 | { 22 | get { return p2; } 23 | set { p2 = value; } 24 | } 25 | public Point P3 26 | { 27 | get { return p3; } 28 | set { p3 = value; } 29 | } 30 | public void Offset(int x, int y) 31 | { 32 | p1.X += x; 33 | p1.Y += y; 34 | p2.X += x; 35 | p2.Y += y; 36 | p2.X += x; 37 | p2.Y += y; 38 | } 39 | public DUITriangle(Point p1, Point p2, Point p3) 40 | { 41 | this.p1 = p1; 42 | this.p2 = p2; 43 | this.p3 = p3; 44 | } 45 | public DUITriangle(int x1, int y1, int x2, int y2, int x3, int y3) 46 | { 47 | this.p1 = new Point(x1, y1); 48 | this.p2 = new Point(x2, y2); 49 | this.p3 = new Point(x3, y3); 50 | } 51 | public DUITriangle() 52 | { 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUITriangleF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUITriangleF 10 | { 11 | private PointF p1; 12 | private PointF p2; 13 | private PointF p3; 14 | 15 | public PointF P1 16 | { 17 | get { return p1; } 18 | set { p1 = value; } 19 | } 20 | public PointF P2 21 | { 22 | get { return p2; } 23 | set { p2 = value; } 24 | } 25 | public PointF P3 26 | { 27 | get { return p3; } 28 | set { p3 = value; } 29 | } 30 | public void Offset(float x, float y) 31 | { 32 | p1.X += x; 33 | p1.Y += y; 34 | p2.X += x; 35 | p2.Y += y; 36 | p3.X += x; 37 | p3.Y += y; 38 | } 39 | public DUITriangleF(PointF p1, PointF p2, PointF p3) 40 | { 41 | this.p1 = p1; 42 | this.p2 = p2; 43 | this.p3 = p3; 44 | } 45 | public DUITriangleF(float x1, float y1, float x2, float y2, float x3, float y3) 46 | { 47 | this.p1 = new PointF(x1, y1); 48 | this.p2 = new PointF(x2, y2); 49 | this.p3 = new PointF(x3, y3); 50 | } 51 | public DUITriangleF() 52 | { 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEntitys/DUIWICRenderTarget.cs: -------------------------------------------------------------------------------- 1 | using SharpDX.Direct2D1; 2 | using SharpDX.DXGI; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace DirectUI.Common 11 | { 12 | public class DUIWICRenderTarget : DUIRenderTarget 13 | { 14 | internal static object lockObj = new object(); 15 | private static readonly SharpDX.Direct2D1.Factory d2dFactory = new SharpDX.Direct2D1.Factory(); 16 | private SharpDX.Direct2D1.WicRenderTarget wicRenderTarget = null; 17 | public override SharpDX.Direct2D1.RenderTarget RenderTarget => this.wicRenderTarget; 18 | public DUIWICRenderTarget(DUIBitmap image) 19 | { 20 | System.Threading.Monitor.Enter(lockObj); 21 | RenderTargetProperties renderTargetProperties = new RenderTargetProperties 22 | { 23 | Type = RenderTargetType.Default, 24 | DpiX = 96.0f, 25 | DpiY = 96.0f, 26 | PixelFormat = new PixelFormat(Format.Unknown, SharpDX.Direct2D1.AlphaMode.Unknown), 27 | Usage = RenderTargetUsage.None, 28 | MinLevel = FeatureLevel.Level_DEFAULT 29 | }; 30 | this.wicRenderTarget = new SharpDX.Direct2D1.WicRenderTarget(d2dFactory, image, renderTargetProperties); 31 | } 32 | public override void Dispose() 33 | { 34 | base.Dispose(); 35 | this.wicRenderTarget?.Dispose(); 36 | this.wicRenderTarget = null; 37 | System.Threading.Monitor.Exit(lockObj); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEnum/DUIBoundsPolygonSpecified.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************** 2 | * 使本项目源码或本项目生成的DLL前请仔细阅读以下协议内容,如果你同意以下协议才能使用本项目所有的功能, 3 | * * 否则如果你违反了以下协议,有可能陷入法律纠纷和赔偿,作者保留追究法律责任的权利。 4 | * * 1、你可以在开发的软件产品中使用和修改本项目的源码和DLL,但是请保留所有相关的版权信息。 5 | * * 2、不能将本项目源码与作者的其他项目整合作为一个单独的软件售卖给他人使用。 6 | * * 3、不能传播本项目的源码和DLL,包括上传到网上、拷贝给他人等方式。 7 | * * 4、以上协议暂时定制,由于还不完善,作者保留以后修改协议的权利。 8 | * 9 | * Copyright (C): 煎饼的归宿 10 | * CLR版本: 4.0.30319.42000 11 | * 注册组织名: Microsoft 12 | * 命名空间名称: DirectUI.Common.DUIEnum 13 | * 文件名: DUIBoundsPolygonSpecified 14 | * 当前系统时间: 2018/5/2 星期三 下午 2:42:22 15 | * 当前登录用户名: Administrator 16 | * 创建年份: 2018 17 | * 版权所有: 煎饼的归宿QQ:375324644 18 | ******************************************************************/ 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace DirectUI.Common 25 | { 26 | public enum DUIBoundsPolygonSpecified 27 | { 28 | // 摘要: 29 | // 未定义任何边界。 30 | None = 0, 31 | // 32 | // 摘要: 33 | // 该控件的左边缘已定义。 34 | CenterX = 1, 35 | // 36 | // 摘要: 37 | // 该控件的上边缘已定义。 38 | CenterY = 2, 39 | // 40 | // 摘要: 41 | // 该控件的 X 和 Y 坐标都已定义。 42 | Center = 3, 43 | // 44 | // 摘要: 45 | // 该控件的宽度已定义。 46 | RotateAngle = 4, 47 | // 48 | // 摘要: 49 | // 该控件的高度已定义。 50 | SkewX = 8, 51 | // 52 | // 摘要: 53 | // 该控件的 System.Windows.Forms.Control.Width 和 System.Windows.Forms.Control.Height 54 | // 属性值都已定义。 55 | SkewY = 16, 56 | Skew = 24, 57 | ScaleX = 32, 58 | ScaleY = 64, 59 | Scale = 96, 60 | Polygon = 128, 61 | // 62 | // 摘要: 63 | // System.Windows.Forms.Control.Location 和 System.Windows.Forms.Control.Size 64 | // 属性值都已定义。 65 | All = 255, 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEnum/DUIBoundsSpecified.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Common 7 | { 8 | /// 指定在定义控件的大小和位置时要使用的控件边界 9 | /// 10 | [Flags] 11 | public enum DUIBoundsSpecified 12 | { 13 | // 摘要: 14 | // 未定义任何边界。 15 | None = 0, 16 | // 17 | // 摘要: 18 | // 该控件的左边缘已定义。 19 | X = 1, 20 | // 21 | // 摘要: 22 | // 该控件的上边缘已定义。 23 | Y = 2, 24 | // 25 | // 摘要: 26 | // 该控件的 X 和 Y 坐标都已定义。 27 | Location = 3, 28 | // 29 | // 摘要: 30 | // 该控件的宽度已定义。 31 | Width = 4, 32 | // 33 | // 摘要: 34 | // 该控件的高度已定义。 35 | Height = 8, 36 | // 37 | // 摘要: 38 | // 该控件的 System.Windows.Forms.Control.Width 和 System.Windows.Forms.Control.Height 39 | // 属性值都已定义。 40 | Size = 12, 41 | Bounds = 15, 42 | CenterX = 16, 43 | CenterY = 32, 44 | Center = 48, 45 | Rotate = 64, 46 | SkewX = 128, 47 | SkewY = 256, 48 | Skew = 384, 49 | ScaleX = 512, 50 | ScaleY = 1024, 51 | Scale = 1536, 52 | // 53 | // 摘要: 54 | // System.Windows.Forms.Control.Location 和 System.Windows.Forms.Control.Size 55 | // 属性值都已定义。 56 | All = 2047, 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEnum/DUIExtendMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Common 7 | { 8 | public enum DUIExtendMode 9 | { 10 | /// 包围 11 | /// 12 | Clamp = 0, 13 | /// 缠绕 14 | /// 15 | Wrap = 1, 16 | /// 镜像 17 | /// 18 | Mirror = 2, 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEnum/DUIMode.cs: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 使本项目源码前请仔细阅读以下协议内容,如果你同意以下协议才能使用本项目所有的功能, 3 | * * 否则如果你违反了以下协议,有可能陷入法律纠纷和赔偿,作者保留追究法律责任的权利。 4 | * * Copyright (C) 5 | * * 作者: 煎饼的归宿 QQ:375324644 6 | * * 请保留以上版权信息,否则作者将保留追究法律责任。 7 | * * 最后修改:BF-20150503UIWA 8 | * * 创建时间:2018/2/24 11:53:04 9 | ********************************************************************/ 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | 15 | namespace DirectUI.Common 16 | { 17 | public enum DUIMode 18 | { 19 | /// 以GDI+模式绘制 20 | /// 21 | GDIP, 22 | /// 以Direct2D模式绘制 23 | /// 24 | Direct2D, 25 | /// 默认绘制方式(Direct2D) 26 | /// 27 | Default 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEnum/DUISmoothingMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public enum DUISmoothingMode 10 | { 11 | /// 指定不抗锯齿 12 | /// 13 | Default = 0, 14 | /// 指定抗锯齿的呈现 15 | /// 16 | AntiAlias = 1, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEnum/DUITextRenderingHint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public enum DUITextRenderingHint 10 | { 11 | /// 指定不抗锯齿 12 | /// 13 | Default = 0, 14 | /// 指定抗锯齿的呈现 15 | /// 16 | AntiAlias = 1, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIBoundsChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUIBoundsChangingEventArgs 10 | { 11 | private RectangleF oldBounds = RectangleF.Empty; 12 | private RectangleF newBounds = RectangleF.Empty; 13 | /// 旧的尺寸 14 | /// 15 | public RectangleF OldBounds { get { return oldBounds; } } 16 | /// 新的尺寸 17 | /// 18 | public RectangleF NewBounds { get { return newBounds; } } 19 | public DUIBoundsChangingEventArgs(RectangleF newBounds, RectangleF oldBounds) 20 | { 21 | this.newBounds = newBounds; 22 | this.oldBounds = oldBounds; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUICenterChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUICenterChangingEventArgs 11 | { 12 | private PointF oldCenter = PointF.Empty; 13 | private PointF newCenter = PointF.Empty; 14 | /// 旧的中心点 15 | /// 16 | public PointF OldCenter { get { return oldCenter; } } 17 | /// 新的中心点 18 | /// 19 | public PointF NewCenter { get { return newCenter; } } 20 | public DUICenterChangingEventArgs(PointF newCenter, PointF oldCenter) 21 | { 22 | this.newCenter = newCenter; 23 | this.oldCenter = oldCenter; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIControlBoundsChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIControlBoundsChangingEventArgs 11 | { 12 | private RectangleF oldBounds = RectangleF.Empty; 13 | private RectangleF newBounds = RectangleF.Empty; 14 | /// 旧的区域 15 | /// 16 | public RectangleF OldBounds { get { return oldBounds; } } 17 | /// 新的区域 18 | /// 19 | public RectangleF NewBounds { get { return newBounds; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIControlBoundsChangingEventArgs(DUIControl control, RectangleF newBounds, RectangleF oldBounds) 25 | { 26 | this.control = control; 27 | this.newBounds = newBounds; 28 | this.oldBounds = oldBounds; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIControlCenterChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIControlCenterChangingEventArgs 11 | { 12 | private PointF oldCenter = PointF.Empty; 13 | private PointF newCenter = PointF.Empty; 14 | /// 旧的中心点 15 | /// 16 | public PointF OldCenter { get { return oldCenter; } } 17 | /// 新的中心点 18 | /// 19 | public PointF NewCenter { get { return newCenter; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIControlCenterChangingEventArgs(DUIControl control, PointF newCenter, PointF oldCenter) 25 | { 26 | this.control = control; 27 | this.newCenter = newCenter; 28 | this.oldCenter = oldCenter; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIControlEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUIControlEventArgs 10 | { 11 | private DUIControl control = null; 12 | /// DUIControl 13 | /// 14 | public DUIControl Control { get { return control; } } 15 | public DUIControlEventArgs(DUIControl control) 16 | { 17 | this.control = control; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIControlLocationChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIControlLocationChangingEventArgs 11 | { 12 | private PointF oldLocation = PointF.Empty; 13 | private PointF newLocation = PointF.Empty; 14 | /// 旧的坐标 15 | /// 16 | public PointF OldLocation { get { return oldLocation; } } 17 | /// 新的坐标 18 | /// 19 | public PointF NewLocation { get { return newLocation; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIControlLocationChangingEventArgs(DUIControl control, PointF newLocation, PointF oldLocation) 25 | { 26 | this.control = control; 27 | this.newLocation = newLocation; 28 | this.oldLocation = oldLocation; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIControlRotateAngleChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIControlRotateAngleChangingEventArgs 11 | { 12 | private float oldRotateAngle = 0; 13 | private float newRotateAngle = 0; 14 | /// 旧的坐标 15 | /// 16 | public float OldRotateAngle { get { return oldRotateAngle; } } 17 | /// 新的坐标 18 | /// 19 | public float NewRotateAngle { get { return newRotateAngle; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIControlRotateAngleChangingEventArgs(DUIControl control, float newRotateAngle, float oldRotateAngle) 25 | { 26 | this.control = control; 27 | this.newRotateAngle = newRotateAngle; 28 | this.oldRotateAngle = oldRotateAngle; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIControlScaleChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIControlScaleChangingEventArgs 11 | { 12 | private PointF oldScale = PointF.Empty; 13 | private PointF newScale = PointF.Empty; 14 | /// 旧的缩放值 15 | /// 16 | public PointF OldScale { get { return oldScale; } } 17 | /// 新的缩放值 18 | /// 19 | public PointF NewScale { get { return newScale; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIControlScaleChangingEventArgs(DUIControl control, PointF newScale, PointF oldScale) 25 | { 26 | this.control = control; 27 | this.newScale = newScale; 28 | this.oldScale = oldScale; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIControlSizeChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIControlSizeChangingEventArgs 11 | { 12 | private SizeF oldSize = SizeF.Empty; 13 | private SizeF newSize = SizeF.Empty; 14 | /// 旧的尺寸 15 | /// 16 | public SizeF OldSize { get { return oldSize; } } 17 | /// 新的尺寸 18 | /// 19 | public SizeF NewSize { get { return newSize; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIControlSizeChangingEventArgs(DUIControl control, SizeF newSize, SizeF oldSize) 25 | { 26 | this.control = control; 27 | this.newSize = newSize; 28 | this.oldSize = oldSize; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIControlSkewChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIControlSkewChangingEventArgs 11 | { 12 | private PointF oldSkew = PointF.Empty; 13 | private PointF newSkew = PointF.Empty; 14 | /// 旧的倾斜值 15 | /// 16 | public PointF OldSkew { get { return oldSkew; } } 17 | /// 新的倾斜值 18 | /// 19 | public PointF NewSkew { get { return newSkew; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIControlSkewChangingEventArgs(DUIControl control, PointF newSkew, PointF oldSkew) 25 | { 26 | this.control = control; 27 | this.newSkew = newSkew; 28 | this.oldSkew = oldSkew; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUILayoutEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | // 摘要: 10 | // 为 System.Windows.Forms.Control.Layout 事件提供数据。无法继承此类。 11 | public sealed class DUILayoutEventArgs 12 | { 13 | private DUIControl affectedControl = null; 14 | private string affectedProperty = string.Empty; 15 | // 16 | // 摘要: 17 | // 获取受此更改影响的控件。 18 | // 19 | // 返回结果: 20 | // 受此更改影响的子 System.Windows.Forms.Control。 21 | public DUIControl AffectedControl { get { return affectedControl; } } 22 | // 23 | // 摘要: 24 | // 获取受此更改影响的属性。 25 | // 26 | // 返回结果: 27 | // 受此更改影响的属性。 28 | public string AffectedProperty { get { return affectedProperty; } } 29 | public DUILayoutEventArgs(DUIControl affectedControl, string affectedProperty) 30 | { 31 | this.affectedControl = affectedControl; 32 | this.affectedProperty = affectedProperty; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUILocationChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUILocationChangingEventArgs 10 | { 11 | private PointF oldLocation = PointF.Empty; 12 | private PointF newLocation = PointF.Empty; 13 | /// 旧的坐标 14 | /// 15 | public PointF OldLocation { get { return oldLocation; } } 16 | /// 新的坐标 17 | /// 18 | public PointF NewLocation { get { return newLocation; } } 19 | public DUILocationChangingEventArgs(PointF newLocation, PointF oldLocation) 20 | { 21 | this.newLocation = newLocation; 22 | this.oldLocation = oldLocation; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIMouseStateEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows.Forms; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIMouseStateEventArgs 11 | { 12 | private DUIControl affectedControl = null; 13 | private MouseButtons button; 14 | 15 | public DUIControl AffectedControl 16 | { 17 | get { return affectedControl; } 18 | set { affectedControl = value; } 19 | } 20 | 21 | public MouseButtons Button 22 | { 23 | get { return button; } 24 | set { button = value; } 25 | } 26 | public DUIMouseStateEventArgs(DUIControl affectedControl, MouseButtons button) 27 | { 28 | this.affectedControl = affectedControl; 29 | this.button = button; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIPaintEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIPaintEventArgs 11 | { 12 | private DUIGraphics graphics = null; 13 | private RectangleF clipRect = RectangleF.Empty; 14 | 15 | // 摘要: 16 | // 获取要在其中进行绘画的矩形。 17 | // 18 | // 返回结果: 19 | // 要在其中进行绘制的 System.Drawing.Rectangle。 20 | public RectangleF ClipRectangle { get { return clipRect; } } 21 | // 22 | // 摘要: 23 | // 获取用于进行绘制的图形。 24 | // 25 | // 返回结果: 26 | // 用于绘画的 D2DGraphics 对象。 D2DGraphics 对象提供将对象绘制到显示设备上的方法。 27 | public DUIGraphics Graphics { get { return graphics; } } 28 | // 摘要: 29 | // 用指定的图形和剪辑矩形框来初始化 System.Windows.Forms.PaintEventArgs 类的新实例。 30 | // 31 | // 参数: 32 | // graphics: 33 | // 用于绘制该项的 D2DGraphics。 34 | // 35 | // clipRect: 36 | // 表示绘画所在的矩形的 System.Drawing.Rectangle。 37 | public DUIPaintEventArgs(DUIGraphics graphics, RectangleF clipRect) 38 | { 39 | this.graphics = graphics; 40 | this.clipRect = clipRect; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIParentBoundsChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIParentBoundsChangingEventArgs 11 | { 12 | private RectangleF oldBounds = RectangleF.Empty; 13 | private RectangleF newBounds = RectangleF.Empty; 14 | /// 旧的区域 15 | /// 16 | public RectangleF OldBounds { get { return oldBounds; } } 17 | /// 新的区域 18 | /// 19 | public RectangleF NewBounds { get { return newBounds; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIParentBoundsChangingEventArgs(DUIControl control, RectangleF newBounds, RectangleF oldBounds) 25 | { 26 | this.control = control; 27 | this.newBounds = newBounds; 28 | this.oldBounds = oldBounds; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIParentCenterChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIParentCenterChangingEventArgs 11 | { 12 | private PointF oldCenter = PointF.Empty; 13 | private PointF newCenter = PointF.Empty; 14 | /// 旧的中心点 15 | /// 16 | public PointF OldCenter { get { return oldCenter; } } 17 | /// 新的中心点 18 | /// 19 | public PointF NewCenter { get { return newCenter; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIParentCenterChangingEventArgs(DUIControl control, PointF newCenter, PointF oldCenter) 25 | { 26 | this.control = control; 27 | this.newCenter = newCenter; 28 | this.oldCenter = oldCenter; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIParentChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIParentChangingEventArgs 11 | { 12 | private DUIControl oldParent = null; 13 | private DUIControl newParent = null; 14 | /// 旧的坐标 15 | /// 16 | public DUIControl OldParent { get { return oldParent; } } 17 | /// 新的坐标 18 | /// 19 | public DUIControl NewParent { get { return newParent; } } 20 | public DUIParentChangingEventArgs(DUIControl newParent, DUIControl oldParent) 21 | { 22 | this.newParent = newParent; 23 | this.oldParent = oldParent; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIParentEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUIParentEventArgs 10 | { 11 | private DUIControl control = null; 12 | /// DUIControl 13 | /// 14 | public DUIControl Control { get { return control; } } 15 | public DUIParentEventArgs(DUIControl control) 16 | { 17 | this.control = control; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIParentLocationChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIParentLocationChangingEventArgs 11 | { 12 | private PointF oldLocation = PointF.Empty; 13 | private PointF newLocation = PointF.Empty; 14 | /// 旧的坐标 15 | /// 16 | public PointF OldLocation { get { return oldLocation; } } 17 | /// 新的坐标 18 | /// 19 | public PointF NewLocation { get { return newLocation; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIParentLocationChangingEventArgs(DUIControl control, PointF newLocation, PointF oldLocation) 25 | { 26 | this.control = control; 27 | this.newLocation = newLocation; 28 | this.oldLocation = oldLocation; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIParentRotateAngleChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIParentRotateAngleChangingEventArgs 11 | { 12 | private float oldRotateAngle = 0; 13 | private float newRotateAngle = 0; 14 | /// 旧的坐标 15 | /// 16 | public float OldRotateAngle { get { return oldRotateAngle; } } 17 | /// 新的坐标 18 | /// 19 | public float NewRotateAngle { get { return newRotateAngle; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIParentRotateAngleChangingEventArgs(DUIControl control, float newRotateAngle, float oldRotateAngle) 25 | { 26 | this.control = control; 27 | this.newRotateAngle = newRotateAngle; 28 | this.oldRotateAngle = oldRotateAngle; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIParentScaleChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIParentScaleChangingEventArgs 11 | { 12 | private PointF oldScale = PointF.Empty; 13 | private PointF newScale = PointF.Empty; 14 | /// 旧的缩放值 15 | /// 16 | public PointF OldScale { get { return oldScale; } } 17 | /// 新的缩放值 18 | /// 19 | public PointF NewScale { get { return newScale; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIParentScaleChangingEventArgs(DUIControl control, PointF newScale, PointF oldScale) 25 | { 26 | this.control = control; 27 | this.newScale = newScale; 28 | this.oldScale = oldScale; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIParentSizeChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIParentSizeChangingEventArgs 11 | { 12 | private SizeF oldSize = SizeF.Empty; 13 | private SizeF newSize = SizeF.Empty; 14 | /// 旧的尺寸 15 | /// 16 | public SizeF OldSize { get { return oldSize; } } 17 | /// 新的尺寸 18 | /// 19 | public SizeF NewSize { get { return newSize; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIParentSizeChangingEventArgs(DUIControl control, SizeF newSize, SizeF oldSize) 25 | { 26 | this.control = control; 27 | this.newSize = newSize; 28 | this.oldSize = oldSize; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIParentSkewChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIParentSkewChangingEventArgs 11 | { 12 | private PointF oldSkew = PointF.Empty; 13 | private PointF newSkew = PointF.Empty; 14 | /// 旧的倾斜值 15 | /// 16 | public PointF OldSkew { get { return oldSkew; } } 17 | /// 新的倾斜值 18 | /// 19 | public PointF NewSkew { get { return newSkew; } } 20 | private DUIControl control = null; 21 | /// DUIControl 22 | /// 23 | public DUIControl Control { get { return control; } } 24 | public DUIParentSkewChangingEventArgs(DUIControl control, PointF newSkew, PointF oldSkew) 25 | { 26 | this.control = control; 27 | this.newSkew = newSkew; 28 | this.oldSkew = oldSkew; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIPolygonChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIPolygonChangingEventArgs 11 | { 12 | private PointF[] oldPolygon = null; 13 | private PointF[] newPolygon = null; 14 | /// 旧的角度 15 | /// 16 | public PointF[] OldPolygon { get { return oldPolygon; } } 17 | /// 新的角度 18 | /// 19 | public PointF[] NewPolygon { get { return newPolygon; } } 20 | public DUIPolygonChangingEventArgs(PointF[] newPolygon, PointF[] oldPolygon) 21 | { 22 | this.newPolygon = newPolygon; 23 | this.oldPolygon = oldPolygon; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIRotateAngleChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIRotateAngleChangingEventArgs 11 | { 12 | private float oldRotateAngle = 0; 13 | private float newRotateAngle = 0; 14 | /// 旧的角度 15 | /// 16 | public float OldRotateAngle { get { return oldRotateAngle; } } 17 | /// 新的角度 18 | /// 19 | public float NewRotateAngle { get { return newRotateAngle; } } 20 | public DUIRotateAngleChangingEventArgs(float newRotateAngle, float oldRotateAngle) 21 | { 22 | this.newRotateAngle = newRotateAngle; 23 | this.oldRotateAngle = oldRotateAngle; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUIScaleChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUIScaleChangingEventArgs 11 | { 12 | private PointF oldScale = PointF.Empty; 13 | private PointF newScale = PointF.Empty; 14 | /// 旧的缩放值 15 | /// 16 | public PointF OldScale { get { return oldScale; } } 17 | /// 新的缩放值 18 | /// 19 | public PointF NewScale { get { return newScale; } } 20 | public DUIScaleChangingEventArgs(PointF newScale, PointF oldScale) 21 | { 22 | this.newScale = newScale; 23 | this.oldScale = oldScale; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUISizeChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class DUISizeChangingEventArgs 10 | { 11 | private SizeF oldSize = SizeF.Empty; 12 | private SizeF newSize = SizeF.Empty; 13 | /// 旧的尺寸 14 | /// 15 | public SizeF OldSize { get { return oldSize; } } 16 | /// 新的尺寸 17 | /// 18 | public SizeF NewSize { get { return newSize; } } 19 | public DUISizeChangingEventArgs(SizeF newSize, SizeF oldSize) 20 | { 21 | this.newSize = newSize; 22 | this.oldSize = oldSize; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIEventArgs/DUISkewChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Common 9 | { 10 | public class DUISkewChangingEventArgs 11 | { 12 | private PointF oldSkew = PointF.Empty; 13 | private PointF newSkew = PointF.Empty; 14 | /// 旧的倾斜值 15 | /// 16 | public PointF OldSkew { get { return oldSkew; } } 17 | /// 新的倾斜值 18 | /// 19 | public PointF NewSkew { get { return newSkew; } } 20 | public DUISkewChangingEventArgs(PointF newSkew, PointF oldSkew) 21 | { 22 | this.newSkew = newSkew; 23 | this.oldSkew = oldSkew; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUI/Common/DUIInfo.cs: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 使本项目源码前请仔细阅读以下协议内容,如果你同意以下协议才能使用本项目所有的功能, 3 | * * 否则如果你违反了以下协议,有可能陷入法律纠纷和赔偿,作者保留追究法律责任的权利。 4 | * * Copyright (C) 5 | * * 作者: 煎饼的归宿 QQ:375324644 6 | * * 请保留以上版权信息,否则作者将保留追究法律责任。 7 | * * 最后修改:BF-20150503UIWA 8 | * * 创建时间:2018/2/24 11:52:24 9 | ********************************************************************/ 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | 15 | namespace DirectUI.Common 16 | { 17 | public static class DUIInfo 18 | { 19 | public static DUIMode Mode { get; set; } 20 | static DUIInfo() 21 | { 22 | Mode = DUIMode.Direct2D; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DirectUI/Common/GDIP.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Drawing.Drawing2D; 5 | using System.Drawing.Imaging; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace DirectUI.Common 10 | { 11 | internal class GDIP 12 | { 13 | public static void SkewTransform(Graphics g, float skewX, float skewY) 14 | { 15 | float shearX = (float)(1 / Math.Tan(Math.PI / 180 * (90 - skewY / Math.PI * 180))); 16 | float shearY = (float)(1 / Math.Tan(Math.PI / 180 * (90 - skewX / Math.PI * 180))); 17 | g.Transform.Shear(shearX, shearY); 18 | } 19 | public static void DrawImage(Graphics g, Image image, PointF[] polygon, float opacity) 20 | { 21 | ColorMatrix clrMatrix = new ColorMatrix(new float[][] { new float[] { 1, 0, 0, 0, 0 }, new float[] { 0, 1, 0, 0, 0 }, new float[] { 0, 0, 1, 0, 0 }, new float[] { 0, 0, 0, (float)opacity, 0 }, new float[] { 0, 0, 0, 0, 1 } }); 22 | ImageAttributes imgAttributes = new ImageAttributes(); 23 | imgAttributes.SetColorMatrix(clrMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);//设置图像的颜色属性 24 | using (TextureBrush tb = new TextureBrush(image, new Rectangle(0, 0, image.Width, image.Height), imgAttributes)) 25 | { 26 | tb.WrapMode = WrapMode.Clamp; 27 | g.FillPolygon(tb, polygon); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DirectUI/Common/Matrix4x4.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Common 8 | { 9 | public class Matrix4x4 : IDisposable 10 | { 11 | private float[] ms = new float[16] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; 12 | /// 一个浮点值数组,它表示该 Matrix4x4 的元素 13 | /// 14 | public float[] Elements { get { return ms; } } 15 | public Matrix4x4() 16 | { 17 | } 18 | public Matrix4x4( 19 | float m11, float m12, float m13, float m14, 20 | float m21, float m22, float m23, float m24, 21 | float m31, float m32, float m33, float m34, 22 | float m41, float m42, float m43, float m44 23 | ) 24 | { 25 | } 26 | public void Dispose() 27 | { 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /DirectUI/Controls/CheckBox/DUICheckState.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Common; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Controls 9 | { 10 | /// CheckBox的选择状态 11 | /// 12 | public abstract class DUICheckState 13 | { 14 | public virtual float X { get; set; } 15 | public virtual float Y { get; set; } 16 | public virtual float Width { get; set; } 17 | public virtual float Height { get; set; } 18 | public virtual PointF Location { get { return new PointF(X, Y); } } 19 | public virtual SizeF Size { get { return new SizeF(Width, Height); } } 20 | public virtual RectangleF Bounds { get { return new RectangleF(Location, Size); } } 21 | 22 | /// 选中的状态名 23 | /// 24 | public abstract string CheckStateName { get; } 25 | public abstract void DrawCheckState(DUIPaintEventArgs e); 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DirectUI/Controls/Label/DUILabel.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Common; 2 | using DirectUI.Core; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace DirectUI.Controls 11 | { 12 | public class DUILabel : DUIControl 13 | { 14 | private string text = "DUILabel"; 15 | public virtual string Text 16 | { 17 | get { return text; } 18 | set 19 | { 20 | text = value; 21 | SizeF size = DUITextRenderer.MeasureText(this.Text, this.Font); 22 | //this.Height = size.Height; 23 | //this.Width = size.Width; 24 | this.Invalidate(); 25 | } 26 | } 27 | 28 | public DUILabel() 29 | { 30 | this.BorderWidth = 0; 31 | this.BackColor = Color.Transparent; 32 | } 33 | public override void OnPaintBackground(DUIPaintEventArgs e) 34 | { 35 | base.OnPaintBackground(e); 36 | using (DUISolidBrush sb = new DUISolidBrush(this.ForeColor)) 37 | { 38 | e.Graphics.DrawString(Text, this.Font, sb, new Point(0, 0)); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /DirectUI/Controls/Panel/DUIPanel.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Controls 9 | { 10 | public class DUIPanel : DUIControl 11 | { 12 | private Pen boundPen = new Pen(Brushes.Black, 1) { DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Controls/PictureBox/DUIPictureBox.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Common; 2 | using DirectUI.Core; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace DirectUI.Controls 10 | { 11 | public class DUIPictureBox : DUIControl 12 | { 13 | private DUIImage image = null; 14 | 15 | public virtual DUIImage Image 16 | { 17 | get { return image; } 18 | set 19 | { 20 | image = value; 21 | this.Invalidate(); 22 | } 23 | } 24 | public DUIPictureBox() 25 | { 26 | //this.BackColor = Color.Transparent; 27 | } 28 | public override void OnPaint(DUIPaintEventArgs e) 29 | { 30 | //e.Graphics.SmoothingMode = DUISmoothingMode.AntiAlias; 31 | if (this.Image != null) 32 | { 33 | float cw = e.ClipRectangle.Width; 34 | float ch = e.ClipRectangle.Height; 35 | float iw = this.Image.Width; 36 | float ih = this.Image.Height; 37 | if (this.Image.Width > this.Image.Height) 38 | { 39 | iw = cw; 40 | ih = (float)this.Image.Height * iw / (float)this.Image.Width; 41 | } 42 | else 43 | { 44 | ih = ch; 45 | iw = (float)this.Image.Width * ih / (float)this.Image.Height; 46 | } 47 | e.Graphics.DrawImage(this.Image, new RectangleF(0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height), new RectangleF(0, 0, this.Image.Width, this.Image.Height), GraphicsUnit.Pixel); 48 | } 49 | base.OnPaint(e); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /DirectUI/Controls/TabControl/DUINativeTabControl.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI.Controls 9 | { 10 | public class DUINativeTabControl : DUINativeControl 11 | { 12 | #region 变量 13 | private DUITabControl dUITabControl = new DUITabControl() { Dock = System.Windows.Forms.DockStyle.Fill }; 14 | #endregion 15 | #region 属性 16 | #endregion 17 | public DUINativeTabControl() 18 | { 19 | this.BackColor = Color.FromArgb(26, 30, 31); 20 | dUITabControl.BorderColor = Color.White; 21 | dUITabControl.BorderWidth = 4; 22 | dUITabControl.Radius = 15; 23 | DUITabPage t = new DUITabPage(); 24 | t.Text = "1"; 25 | t.DUIControls.Add(new DUIControl() { BackColor = Color.Red }); 26 | DUITabPage t1 = new DUITabPage(); 27 | t1.Text = "2"; 28 | t1.DUIControls.Add(new DUIControl() { BackColor = Color.Gray }); 29 | DUITabPage t2 = new DUITabPage(); 30 | t2.Text = "3"; 31 | t2.DUIControls.Add(new DUIControl() { BackColor = Color.Green }); 32 | dUITabControl.TabPages.Add(t); 33 | dUITabControl.TabPages.Add(t1); 34 | dUITabControl.TabPages.Add(t2); 35 | this.DUIControls.Add(dUITabControl); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /DirectUI/Controls/TabControl/DUITabPage.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Common; 2 | using DirectUI.Core; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace DirectUI.Controls 10 | { 11 | public class DUITabPage : DUIScrollableControl 12 | { 13 | public float TitleX { get; set; } 14 | public float TitleY { get; set; } 15 | public PointF TitleLocation { get { return new PointF(TitleX, TitleY); } } 16 | internal DUITabControl TabControl { get; set; } 17 | public bool Selected { get { return this.TabControl == null ? false : this.TabControl.SelectedPage == this; } } 18 | public override bool Visible { get => base.Visible && this.Selected; set => base.Visible = value; } 19 | public DUITabPage() 20 | { 21 | this.Dock = System.Windows.Forms.DockStyle.Fill; 22 | } 23 | public override void OnPaintBackground(DUIPaintEventArgs e) 24 | { 25 | this.TabControl.DrawTabPage(this, e); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DirectUI/Controls/ToolBar/DUIToolBarItem.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Common; 2 | using DirectUI.Core; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace DirectUI.Controls 10 | { 11 | public class DUIToolBarItem : DUIControl 12 | { 13 | #region 事件 14 | public event EventHandler Click; 15 | protected virtual void OnClick(EventArgs e) 16 | { 17 | if (Click != null) 18 | { 19 | Click(this, e); 20 | } 21 | } 22 | #endregion 23 | #region 变量 24 | #endregion 25 | #region 属性 26 | /// 显示的图片 27 | /// 28 | public DUIImage Image { get; set; } 29 | #endregion 30 | public DUIToolBarItem() 31 | { 32 | this.BackColor = Color.Transparent; 33 | this.BorderWidth = 0; 34 | } 35 | #region 重写 36 | public override void OnMouseEnter(EventArgs e) 37 | { 38 | //this.BackColor = Color.FromArgb(61, 61, 61); 39 | this.Invalidate(); 40 | base.OnMouseEnter(e); 41 | } 42 | public override void OnMouseLeave(EventArgs e) 43 | { 44 | this.BackColor = Color.Transparent; 45 | this.Invalidate(); 46 | base.OnMouseLeave(e); 47 | } 48 | public override void OnPaintBackground(DUIPaintEventArgs e) 49 | { 50 | base.OnPaintBackground(e); 51 | using (DUISolidBrush brush = new DUISolidBrush(BackColor)) 52 | { 53 | e.Graphics.FillRectangle(brush, e.ClipRectangle); 54 | } 55 | if (this.Image != null) 56 | { 57 | e.Graphics.DrawImage(this.Image, e.ClipRectangle, new Rectangle(0, 0, this.Image.Width, this.Image.Height), GraphicsUnit.Pixel); 58 | } 59 | } 60 | public override void OnMouseClick(DUIMouseEventArgs e) 61 | { 62 | base.OnMouseClick(e); 63 | OnClick(EventArgs.Empty); 64 | } 65 | #endregion 66 | #region 函数 67 | public void PerformClick() 68 | { 69 | OnClick(EventArgs.Empty); 70 | base.OnMouseClick(new DUIMouseEventArgs(System.Windows.Forms.MouseButtons.Left, 1, 0, 0, 0)); 71 | } 72 | #endregion 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /DirectUI/Controls/ToolTip/ToolTipControl.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | /******************************************************************** 3 | * * 使本项目源码前请仔细阅读以下协议内容,如果你同意以下协议才能使用本项目所有的功能, 4 | * * 否则如果你违反了以下协议,有可能陷入法律纠纷和赔偿,作者保留追究法律责任的权利。 5 | * * Copyright (C) 6 | * * 作者: 煎饼的归宿 QQ:375324644 7 | * * 请保留以上版权信息,否则作者将保留追究法律责任。 8 | * * 最后修改:BF-20150503UIWA 9 | * * 创建时间:2017/12/8 22:34:04 10 | ********************************************************************/ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Text; 15 | using System.Windows.Forms; 16 | 17 | namespace DirectUI 18 | { 19 | public class ToolTipControl : DUINativeControl 20 | { 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DirectUI/Core/DUIEditableScaleParentControl/DUIEditableSuspendedScaleParentControl.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Common; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Drawing; 6 | using System.Drawing.Drawing2D; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Windows.Forms; 10 | 11 | namespace DirectUI.Core 12 | { 13 | /// 编辑控件的悬浮控件。父控件是可缩放的控件,这个编辑控件的操作点大小会跟随父控件的缩放而变化 14 | /// 15 | public class DUIEditableSuspendedScaleParentControl : DUIEditableSuspendedControl 16 | { 17 | private DUIScaleableControl scaleableControl = null; 18 | /// 父控件 19 | /// 20 | public DUIScaleableControl ScaleableControl 21 | { 22 | get 23 | { 24 | if (scaleableControl == null) 25 | { 26 | if (this.DUIParent != null && this.DUIParent is DUIScaleableControl dUIScaleableControlParent) 27 | { 28 | return dUIScaleableControlParent; 29 | } 30 | } 31 | return scaleableControl; 32 | } 33 | set { scaleableControl = value; } 34 | } 35 | public float ScaleableControlScaling 36 | { 37 | get { return ScaleableControl == null ? 1 : ScaleableControl.Scaling; } 38 | } 39 | 40 | public override float BorderWidth => 0; 41 | public override float X => this.bindingControl == null ? 0 : this.bindingControl.MatrixBounds.Right; 42 | public override float Y => this.bindingControl == null ? 0 : (this.bindingControl.MatrixBounds.Top + (this.bindingControl.MatrixBounds.Height - this.Height) / 2); 43 | public override float Width 44 | { 45 | get 46 | { 47 | return base.Width / ScaleableControlScaling; 48 | } 49 | set 50 | { 51 | base.Width = value * ScaleableControlScaling; 52 | } 53 | } 54 | public override float Height 55 | { 56 | get 57 | { 58 | return base.Height / ScaleableControlScaling; 59 | } 60 | set 61 | { 62 | base.Height = value * ScaleableControlScaling; 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /DirectUI/Core/EditableControl/AlwaysModifierKeys.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Core 7 | { 8 | /// 总是按下的ModifierKeys 9 | /// 10 | public enum AlwaysModifierKeys 11 | { 12 | /// 无 13 | /// 14 | None, 15 | /// Control键 16 | /// 17 | Alt, 18 | /// Alt键 19 | /// 20 | Ctrl, 21 | /// Shift键 22 | /// 23 | Shift 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DirectUI/Core/EditableControl/EffectMargin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Core 7 | { 8 | /// 作用边缘 9 | /// 10 | public enum EffectMargin 11 | { 12 | /// 左上 13 | /// 14 | LeftTop = 1, 15 | /// 上 16 | /// 17 | Top = 2, 18 | /// 右上 19 | /// 20 | RightTop = 4, 21 | /// 右 22 | /// 23 | Right = 8, 24 | /// 右下 25 | /// 26 | RightBottom = 16, 27 | /// 下 28 | /// 29 | Bottom = 32, 30 | /// 左下 31 | /// 32 | LeftBottom = 64, 33 | /// 左 34 | /// 35 | Left = 128, 36 | /// 左上角旋转点 37 | /// 38 | LeftTopRotate = 256, 39 | /// 右上角旋转点 40 | /// 41 | RightTopRotate = 512, 42 | /// 右下角旋转点 43 | /// 44 | RightBottomRotate = 1024, 45 | /// 左下角旋转点 46 | /// 47 | LeftBottomRotate = 2048, 48 | /// 上方的倾斜区域1 49 | /// 50 | TopSkew1 = 4096, 51 | /// 上方的倾斜区域2 52 | /// 53 | TopSkew2 = 8192, 54 | /// 左方的倾斜区域1 55 | /// 56 | LeftSkew1 = 16384, 57 | /// 左方的倾斜区域2 58 | /// 59 | LeftSkew2 = 32768, 60 | /// 下方的倾斜区域1 61 | /// 62 | BottomSkew1 = 65536, 63 | /// 下方的倾斜区域2 64 | /// 65 | BottomSkew2 = 131072, 66 | /// 右方的倾斜区域1 67 | /// 68 | RightSkew1 = 262144, 69 | /// 右方的倾斜区域2 70 | /// 71 | RightSkew2 = 524288, 72 | /// 其他 73 | /// 74 | Other = 1048576, 75 | /// 点 76 | /// 77 | Point = 2097152, 78 | /// 未知 79 | /// 80 | Unknow = 4194304 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /DirectUI/Core/ScrollableControl/DUIHScrollProperties.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Core 8 | { 9 | public class DUIHScrollProperties : DUIScrollProperties 10 | { 11 | public DUIHScrollProperties(DUIScrollableControl container) 12 | : base(container) 13 | { 14 | } 15 | internal override float PageSize 16 | { 17 | get 18 | { 19 | return this.parent.ClientRectangle.Width; 20 | } 21 | } 22 | internal override float HorizontalDisplayPosition 23 | { 24 | get 25 | { 26 | return -this.value; 27 | } 28 | } 29 | internal override float VerticalDisplayPosition 30 | { 31 | get 32 | { 33 | return this.parent.DisplayRectangle.Y; 34 | } 35 | } 36 | public override RectangleF ClientRectangle 37 | { 38 | get 39 | { 40 | return new RectangleF(0, this.parent.Height - this.parent.Border.BorderWidth * 2 - this.Thickness, this.parent.ClientSize.Width, this.Thickness); 41 | } 42 | } 43 | public override RectangleF BodyRectangle 44 | { 45 | get 46 | { 47 | float hBodyX = this.Value * this.parent.ClientRectangle.Width / this.parent.DisplayRectangle.Width; 48 | float hBodyY = this.ClientRectangle.Y; 49 | float hBodyWidth = this.ClientRectangle.Width * this.parent.ClientRectangle.Width / this.parent.DisplayRectangle.Width; 50 | float hBodyHeight = this.Thickness; 51 | return new RectangleF(hBodyX, hBodyY, hBodyWidth, hBodyHeight); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /DirectUI/Core/ScrollableControl/DUIVScrollProperties.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI.Core 8 | { 9 | public class DUIVScrollProperties : DUIScrollProperties 10 | { 11 | public DUIVScrollProperties(DUIScrollableControl container) 12 | : base(container) 13 | { 14 | } 15 | 16 | internal override float PageSize 17 | { 18 | get 19 | { 20 | return this.parent.ClientRectangle.Height; 21 | } 22 | } 23 | 24 | internal override float HorizontalDisplayPosition 25 | { 26 | get 27 | { 28 | return this.parent.DisplayRectangle.X; 29 | } 30 | } 31 | 32 | internal override float VerticalDisplayPosition 33 | { 34 | get 35 | { 36 | return -this.value; 37 | } 38 | } 39 | public override RectangleF ClientRectangle 40 | { 41 | get 42 | { 43 | return new RectangleF(this.parent.Width - this.parent.Border.BorderWidth * 2 - this.Thickness, 0, this.Thickness, this.parent.Height - this.parent.Border.BorderWidth * 2); 44 | } 45 | } 46 | 47 | public override RectangleF BodyRectangle 48 | { 49 | get 50 | { 51 | float vBodyX = this.ClientRectangle.X; 52 | float vBodyY = this.Value * this.parent.ClientRectangle.Height / this.parent.DisplayRectangle.Height; 53 | float vBodyWidth = this.Thickness; 54 | float vBodyHeight = this.ClientRectangle.Height * this.parent.ClientRectangle.Height / this.parent.DisplayRectangle.Height; 55 | return new RectangleF(vBodyX, vBodyY, vBodyWidth, vBodyHeight); 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /DirectUI/Cursors/DUICursors.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace DirectUI 11 | { 12 | public sealed class DUICursors 13 | { 14 | private static Cursor rotateCursor = null; 15 | static DUICursors() 16 | { 17 | using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DirectUI.Cursors.rotateCursor.cur")) 18 | using (Bitmap cursor = (Bitmap)Image.FromStream(stream)) 19 | { 20 | rotateCursor = new Cursor(cursor.GetHicon()); 21 | } 22 | } 23 | public static Cursor Rotate 24 | { 25 | get 26 | { 27 | return rotateCursor; 28 | } 29 | } 30 | public static Cursor Skew 31 | { 32 | get 33 | { 34 | return Cursors.Help; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /DirectUI/Cursors/rotateCursor.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/DirectUI/Cursors/rotateCursor.cur -------------------------------------------------------------------------------- /DirectUI/Log/DUILog.cs: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 使本项目源码前请仔细阅读以下协议内容,如果你同意以下协议才能使用本项目所有的功能, 3 | * * 否则如果你违反了以下协议,有可能陷入法律纠纷和赔偿,作者保留追究法律责任的权利。 4 | * * Copyright (C) 5 | * * 作者: 煎饼的归宿 QQ:375324644 6 | * * 请保留以上版权信息,否则作者将保留追究法律责任。 7 | * * 最后修改:BF-20150503UIWA 8 | * * 创建时间:2017/12/18 14:20:01 9 | ********************************************************************/ 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | 15 | namespace DirectUI.Log 16 | { 17 | public class DUILog 18 | { 19 | public static event Action LogRecord; 20 | private static void OnLogRecord(Exception ex) 21 | { 22 | if (LogRecord != null) 23 | { 24 | LogRecord(ex); 25 | } 26 | } 27 | public static void WriteLog(Exception ex) 28 | { 29 | OnLogRecord(ex); 30 | } 31 | public static void GettingLog(Exception ex) 32 | { 33 | //System.Diagnostics.Debug.WriteLine(ex); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /DirectUI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("DirectUI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("DirectUI")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("a8ee155e-9a46-4f3e-9df5-e9721465cd83")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DirectUI/Resources/rotate.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/DirectUI/Resources/rotate.cur -------------------------------------------------------------------------------- /DirectUI/Resources/tickBlack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/DirectUI/Resources/tickBlack.png -------------------------------------------------------------------------------- /DirectUI/Resources/tickWhile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/DirectUI/Resources/tickWhile.png -------------------------------------------------------------------------------- /DirectUI/Share/DUIControlShare.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Collection; 2 | using DirectUI.Common; 3 | using DirectUI.Core; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace DirectUI.Share 10 | { 11 | /// DUI窗体下的控件共享的信息 12 | /// 13 | internal class DUIControlShare 14 | { 15 | //private AlwaysGetMouseEventCollection alwaysGetMouseEvents = null; 16 | //private AlwaysGetKeyEventCollection alwaysGetKeyEvents = null; 17 | /// 获得焦点的DUIControl 18 | /// 19 | internal DUIControl FocusedDUIControl { get; set; } 20 | /// 置顶的控件 21 | /// 22 | internal DUIControl TopMostDUIControl { get; set; } 23 | private List mouseDownDUIControls = new List(); 24 | 25 | internal List MouseDownDUIControls 26 | { 27 | get { return mouseDownDUIControls; } 28 | } 29 | /// 鼠标移动过的DUIControl 30 | /// 31 | public DUIControl MouseMoveDUIControl { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /DirectUI/Tools/ConvertTools.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace DirectUI 8 | { 9 | internal class ConvertTools 10 | { 11 | /// 中国式四舍五入 12 | /// 13 | /// 原数 14 | /// 结果 15 | public static int ChineseRounding(double d) 16 | { 17 | //return Math.Round(d, 2, MidpointRounding.AwayFromZero); 这个可以转小数点 18 | return Convert.ToInt32(Math.Round(d, MidpointRounding.AwayFromZero)); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DirectUI/Tools/TimeTools.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace DirectUI 9 | { 10 | internal class TimeTools 11 | { 12 | private static Stopwatch stopwatch = new Stopwatch(); 13 | /// 获取函数的执行时间,单位毫秒 14 | /// 15 | /// 执行的函数 16 | /// 执行时间 17 | public static long GetExecuteTime(Action action) 18 | { 19 | stopwatch.Restart(); 20 | action.Invoke(); 21 | stopwatch.Stop(); 22 | return stopwatch.ElapsedMilliseconds; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DirectUI/Win32/Callback/Functions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DirectUI.Win32.Callback 6 | { 7 | internal delegate int HookProc(int nCode, Int32 wParam, IntPtr lParam); 8 | } 9 | -------------------------------------------------------------------------------- /DirectUI/Win32/ClassName.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32 4 | { 5 | internal static class ClassName 6 | { 7 | internal const string STATIC = "STATIC"; 8 | internal const string TOOLTIPS_CLASS = "tooltips_class32"; 9 | internal const string UPDOWNBUTTON = "msctls_updown32"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/DOCHOSTUIFLAG.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DirectUI.Win32.Com 6 | { 7 | internal enum DOCHOSTUIFLAG 8 | { 9 | DOCHOSTUIFLAG_DIALOG = 0x00000001, 10 | DOCHOSTUIFLAG_DISABLE_HELP_MENU = 0x00000002, 11 | DOCHOSTUIFLAG_NO3DBORDER = 0x00000004, 12 | DOCHOSTUIFLAG_SCROLL_NO = 0x00000008, 13 | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE = 0x00000010, 14 | DOCHOSTUIFLAG_OPENNEWWIN = 0x00000020, 15 | DOCHOSTUIFLAG_DISABLE_OFFSCREEN = 0x00000040, 16 | DOCHOSTUIFLAG_FLAT_SCROLLBAR = 0x00000080, 17 | DOCHOSTUIFLAG_DIV_BLOCKDEFAULT = 0x00000100, 18 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY = 0x00000200, 19 | DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY = 0x00000400, 20 | DOCHOSTUIFLAG_CODEPAGELINKEDFONTS = 0x00000800, 21 | DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 = 0x00001000, 22 | DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 = 0x00002000, 23 | DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE = 0x00004000, 24 | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION = 0x00010000, 25 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION = 0x00020000, 26 | DOCHOSTUIFLAG_THEME = 0x00040000, 27 | DOCHOSTUIFLAG_NOTHEME = 0x00080000, 28 | DOCHOSTUIFLAG_NOPICS = 0x00100000, 29 | DOCHOSTUIFLAG_NO3DOUTERBORDER = 0x00200000, 30 | DOCHOSTUIFLAG_DELEGATESIDOFDISPATCH = 0x00400000 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/DOCHOSTUIINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Com 5 | { 6 | [ComVisible(true), StructLayout(LayoutKind.Sequential)] 7 | internal struct DOCHOSTUIINFO 8 | { 9 | [MarshalAs(UnmanagedType.U4)] 10 | internal uint cbSize; 11 | [MarshalAs(UnmanagedType.U4)] 12 | internal uint dwFlags; 13 | [MarshalAs(UnmanagedType.U4)] 14 | internal uint dwDoubleClick; 15 | [MarshalAs(UnmanagedType.LPWStr)] 16 | internal string pchHostCss; 17 | [MarshalAs(UnmanagedType.LPWStr)] 18 | internal string pchHostNS; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/ICustomDoc.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.CompilerServices; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace DirectUI.Win32.Com 8 | { 9 | [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), 10 | Guid("3050F3F0-98B5-11CF-BB82-00AA00BDCE0B")] 11 | internal interface ICustomDoc 12 | { 13 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 14 | void SetUIHandler([In, MarshalAs(UnmanagedType.Interface)] IDocHostUIHandler pUIHandler); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/IDropTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace DirectUI.Win32.Com 7 | { 8 | [ComVisible(true), ComImport(), 9 | Guid("00000122-0000-0000-C000-000000000046"), 10 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 11 | internal interface IDropTarget 12 | { 13 | [return: MarshalAs(UnmanagedType.I4)] 14 | [PreserveSig] 15 | int DragEnter( 16 | [In, MarshalAs(UnmanagedType.Interface)] System.Runtime.InteropServices.ComTypes.IDataObject pDataObj, 17 | [In, MarshalAs(UnmanagedType.U4)] uint grfKeyState, 18 | [In, MarshalAs(UnmanagedType.Struct)] tagPOINT pt, 19 | [In, Out, MarshalAs(UnmanagedType.U4)] ref uint pdwEffect); 20 | 21 | [return: MarshalAs(UnmanagedType.I4)] 22 | [PreserveSig] 23 | int DragOver( 24 | [In, MarshalAs(UnmanagedType.U4)] uint grfKeyState, 25 | [In, MarshalAs(UnmanagedType.Struct)] tagPOINT pt, 26 | [In, Out, MarshalAs(UnmanagedType.U4)] ref uint pdwEffect); 27 | 28 | [return: MarshalAs(UnmanagedType.I4)] 29 | [PreserveSig] 30 | int DragLeave(); 31 | 32 | [return: MarshalAs(UnmanagedType.I4)] 33 | [PreserveSig] 34 | int Drop( 35 | [In, MarshalAs(UnmanagedType.Interface)] System.Runtime.InteropServices.ComTypes.IDataObject pDataObj, 36 | [In, MarshalAs(UnmanagedType.U4)] uint grfKeyState, 37 | [In, MarshalAs(UnmanagedType.Struct)] tagPOINT pt, 38 | [In, Out, MarshalAs(UnmanagedType.U4)] ref uint pdwEffect); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/IOleCommandTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Com 5 | { 6 | [ComImport(), ComVisible(true), 7 | Guid("B722BCCB-4E68-101B-A2BC-00AA00404770"), 8 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 9 | internal interface IOleCommandTarget 10 | { 11 | 12 | [return: MarshalAs(UnmanagedType.I4)] 13 | [PreserveSig] 14 | int QueryStatus( 15 | [In] IntPtr pguidCmdGroup, 16 | [In, MarshalAs(UnmanagedType.U4)] uint cCmds, 17 | [In, Out, MarshalAs(UnmanagedType.Struct)] ref tagOLECMD prgCmds, 18 | //This parameter must be IntPtr, as it can be null 19 | [In, Out] IntPtr pCmdText); 20 | 21 | [return: MarshalAs(UnmanagedType.I4)] 22 | [PreserveSig] 23 | int Exec( 24 | //[In] ref Guid pguidCmdGroup, 25 | //have to be IntPtr, since null values are unacceptable 26 | //and null is used as default group! 27 | [In] IntPtr pguidCmdGroup, 28 | [In, MarshalAs(UnmanagedType.U4)] uint nCmdID, 29 | [In, MarshalAs(UnmanagedType.U4)] uint nCmdexecopt, 30 | [In] IntPtr pvaIn, 31 | [In, Out] IntPtr pvaOut); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/IOleInPlaceActiveObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Com 5 | { 6 | [ComVisible(true), ComImport(), Guid("00000117-0000-0000-C000-000000000046"), 7 | InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] 8 | internal interface IOleInPlaceActiveObject 9 | { 10 | //IOleWindow 11 | [return: MarshalAs(UnmanagedType.I4)] 12 | [PreserveSig] 13 | int GetWindow([In, Out] ref IntPtr phwnd); 14 | 15 | [return: MarshalAs(UnmanagedType.I4)] 16 | [PreserveSig] 17 | int ContextSensitiveHelp([In, MarshalAs(UnmanagedType.Bool)] bool 18 | fEnterMode); 19 | 20 | //IOleInPlaceActiveObject 21 | [return: MarshalAs(UnmanagedType.I4)] 22 | [PreserveSig] 23 | int TranslateAccelerator( 24 | [In, MarshalAs(UnmanagedType.Struct)] ref tagMSG lpmsg); 25 | 26 | [return: MarshalAs(UnmanagedType.I4)] 27 | [PreserveSig] 28 | int OnFrameWindowActivate( 29 | [In, MarshalAs(UnmanagedType.Bool)] bool fActivate); 30 | 31 | [return: MarshalAs(UnmanagedType.I4)] 32 | [PreserveSig] 33 | int OnDocWindowActivate( 34 | [In, MarshalAs(UnmanagedType.Bool)] bool fActivate); 35 | 36 | [return: MarshalAs(UnmanagedType.I4)] 37 | [PreserveSig] 38 | int ResizeBorder( 39 | [In, MarshalAs(UnmanagedType.Struct)] ref tagRECT prcBorder, 40 | [In, MarshalAs(UnmanagedType.Interface)] ref IOleInPlaceUIWindow pUIWindow, 41 | [In, MarshalAs(UnmanagedType.Bool)] bool fFrameWindow); 42 | 43 | [return: MarshalAs(UnmanagedType.I4)] 44 | [PreserveSig] 45 | int EnableModeless( 46 | [In, MarshalAs(UnmanagedType.Bool)] bool fEnable); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/IOleInPlaceUIWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Com 5 | { 6 | [ComVisible(true), ComImport(), Guid("00000115-0000-0000-C000-000000000046"), 7 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 8 | internal interface IOleInPlaceUIWindow 9 | { 10 | //IOleWindow 11 | [return: MarshalAs(UnmanagedType.I4)] 12 | [PreserveSig] 13 | int GetWindow([In, Out] ref IntPtr phwnd); 14 | 15 | [return: MarshalAs(UnmanagedType.I4)] 16 | [PreserveSig] 17 | int ContextSensitiveHelp([In, MarshalAs(UnmanagedType.Bool)] bool fEnterMode); 18 | 19 | //IOleInPlaceUIWindow 20 | [return: MarshalAs(UnmanagedType.I4)] 21 | [PreserveSig] 22 | int GetBorder([In, Out, MarshalAs(UnmanagedType.Struct)] ref tagRECT lprectBorder); 23 | 24 | [return: MarshalAs(UnmanagedType.I4)] 25 | [PreserveSig] 26 | int RequestBorderSpace([In, MarshalAs(UnmanagedType.Struct)] ref tagRECT pborderwidths); 27 | 28 | [return: MarshalAs(UnmanagedType.I4)] 29 | [PreserveSig] 30 | int SetBorderSpace([In, MarshalAs(UnmanagedType.Struct)] ref tagRECT pborderwidths); 31 | 32 | [return: MarshalAs(UnmanagedType.I4)] 33 | [PreserveSig] 34 | int SetActiveObject( 35 | [In, MarshalAs(UnmanagedType.Interface)] 36 | ref IOleInPlaceActiveObject pActiveObject, 37 | [In, MarshalAs(UnmanagedType.LPWStr)] 38 | string pszObjName); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/OLECMDEXECOPT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Com 4 | { 5 | internal enum OLECMDEXECOPT 6 | { 7 | OLECMDEXECOPT_DODEFAULT = 0, 8 | OLECMDEXECOPT_PROMPTUSER = 1, 9 | OLECMDEXECOPT_DONTPROMPTUSER = 2, 10 | OLECMDEXECOPT_SHOWHELP = 3 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/OLECMDF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Com 4 | { 5 | internal enum OLECMDF 6 | { 7 | OLECMDF_SUPPORTED = 1, 8 | OLECMDF_ENABLED = 2, 9 | OLECMDF_LATCHED = 4, 10 | OLECMDF_NINCHED = 8, 11 | OLECMDF_INVISIBLE = 0x10, 12 | OLECMDF_DEFHIDEONCTXTMENU = 0x20 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/OLECMDID.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Com 4 | { 5 | internal enum OLECMDID 6 | { 7 | OLECMDID_SAVEAS = 4, 8 | OLECMDID_PRINT = 6, 9 | OLECMDID_PRINTPREVIEW = 7, 10 | OLECMDID_PAGESETUP = 8, 11 | OLECMDID_PROPERTIES = 10 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/tagMSG.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Com 5 | { 6 | [ComVisible(true), StructLayout(LayoutKind.Sequential)] 7 | internal struct tagMSG 8 | { 9 | internal IntPtr hwnd; 10 | [MarshalAs(UnmanagedType.I4)] 11 | internal int message; 12 | internal IntPtr wParam; 13 | internal IntPtr lParam; 14 | [MarshalAs(UnmanagedType.I4)] 15 | internal int time; 16 | // pt was a by-value POINT structure 17 | [MarshalAs(UnmanagedType.I4)] 18 | internal int pt_x; 19 | [MarshalAs(UnmanagedType.I4)] 20 | internal int pt_y; 21 | //internal tagPOINT pt; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/tagOLECMD.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Com 5 | { 6 | [ComVisible(true), StructLayout(LayoutKind.Sequential)] 7 | internal struct tagOLECMD 8 | { 9 | [MarshalAs(UnmanagedType.U4)] 10 | internal uint cmdID; 11 | [MarshalAs(UnmanagedType.U4)] 12 | internal uint cmdf; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/tagPOINT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Com 5 | { 6 | [ComVisible(true), StructLayout(LayoutKind.Sequential)] 7 | internal struct tagPOINT 8 | { 9 | [MarshalAs(UnmanagedType.I4)] 10 | internal int X; 11 | [MarshalAs(UnmanagedType.I4)] 12 | internal int Y; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Win32/Com/tagRECT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Com 5 | { 6 | [ComVisible(true), StructLayout(LayoutKind.Sequential)] 7 | internal struct tagRECT 8 | { 9 | [MarshalAs(UnmanagedType.I4)] 10 | internal int Left; 11 | [MarshalAs(UnmanagedType.I4)] 12 | internal int Top; 13 | [MarshalAs(UnmanagedType.I4)] 14 | internal int Right; 15 | [MarshalAs(UnmanagedType.I4)] 16 | internal int Bottom; 17 | 18 | internal tagRECT(int left_, int top_, int right_, int bottom_) 19 | { 20 | Left = left_; 21 | Top = top_; 22 | Right = right_; 23 | Bottom = bottom_; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/AC.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class AC 6 | { 7 | /// 8 | /// currentlly defined blend function. 9 | /// 10 | internal const byte AC_SRC_OVER = 0x00; 11 | 12 | /// 13 | /// alpha format flags. 14 | /// 15 | internal const byte AC_SRC_ALPHA = 0x01; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/AW.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class AW 6 | { 7 | /// 8 | /// 从左到右显示 9 | /// 10 | internal const Int32 AW_HOR_POSITIVE = 0x00000001; 11 | /// 12 | /// 从右到左显示 13 | /// 14 | internal const Int32 AW_HOR_NEGATIVE = 0x00000002; 15 | /// 16 | /// 从上到下显示 17 | /// 18 | internal const Int32 AW_VER_POSITIVE = 0x00000004; 19 | /// 20 | /// 从下到上显示 21 | /// 22 | internal const Int32 AW_VER_NEGATIVE = 0x00000008; 23 | /// 24 | /// 若使用了AW_HIDE标志,则使窗口向内重叠,即收缩窗口;否则使窗口向外扩展,即展开窗口 25 | /// 26 | internal const Int32 AW_CENTER = 0x00000010; 27 | /// 28 | /// 隐藏窗口,缺省则显示窗口 29 | /// 30 | internal const Int32 AW_HIDE = 0x00010000; 31 | /// 32 | /// 激活窗口。在使用了AW_HIDE标志后不能使用这个标志 33 | /// 34 | internal const Int32 AW_ACTIVATE = 0x00020000; 35 | /// 36 | /// 使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略 37 | /// 38 | internal const Int32 AW_SLIDE = 0x00040000; 39 | /// 40 | /// 透明度从高到低 41 | /// 42 | internal const Int32 AW_BLEND = 0x00080000; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/BI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class BI 9 | { 10 | internal const uint BI_RGB = 0; 11 | internal const uint BI_RLE8 = 1; 12 | internal const uint BI_RLE4 = 2; 13 | internal const uint BI_BITFIELDS = 3; 14 | internal const uint BI_JPEG = 4; 15 | internal const uint BI_PNG = 5; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/BM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class BM 9 | { 10 | internal const byte BM_CLICK = 0xF5; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/CDDS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | /// 6 | /// drawstage flags 7 | /// values under 0x00010000 are reserved for global custom draw values. 8 | /// above that are for specific controls 9 | /// 10 | internal static class CDDS 11 | { 12 | internal const int CDDS_PREPAINT = 0x00000001; 13 | internal const int CDDS_POSTPAINT = 0x00000002; 14 | internal const int CDDS_PREERASE = 0x00000003; 15 | internal const int CDDS_POSTERASE = 0x00000004; 16 | // the 0x000010000 bit means it's individual item specific 17 | internal const int CDDS_ITEM = 0x00010000; 18 | internal const int CDDS_ITEMPREPAINT = (CDDS_ITEM | CDDS_PREPAINT); 19 | internal const int CDDS_ITEMPOSTPAINT = (CDDS_ITEM | CDDS_POSTPAINT); 20 | internal const int CDDS_ITEMPREERASE = (CDDS_ITEM | CDDS_PREERASE); 21 | internal const int CDDS_ITEMPOSTERASE = (CDDS_ITEM | CDDS_POSTERASE); 22 | 23 | #if (_WIN32_IE0400) //>= 0x0400 24 | internal const int CDDS_SUBITEM = 0x00020000; 25 | #endif 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/CDM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal enum CDM : uint 9 | { 10 | CDM_FIRST = ((uint)WM.WM_USER + 100), 11 | CDM_GETSPEC = (CDM_FIRST + 0x0000), 12 | CDM_GETFILEPATH = (CDM_FIRST + 0x0001), 13 | CDM_GETFOLDERPATH = (CDM_FIRST + 0x0002), 14 | CDM_GETFOLDERIDLIST = (CDM_FIRST + 0x0003), 15 | CDM_SETCONTROLTEXT = (CDM_FIRST + 0x0004), 16 | CDM_HIDECONTROL = (CDM_FIRST + 0x0005), 17 | CDM_SETDEFEXT = (CDM_FIRST + 0x0006) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/CDN.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal enum CDN : uint 9 | { 10 | CDN_FIRST = 0xFFFFFDA7, 11 | CDN_INITDONE = (CDN_FIRST - 0x0000), 12 | CDN_SELCHANGE = (CDN_FIRST - 0x0001), 13 | CDN_FOLDERCHANGE = (CDN_FIRST - 0x0002), 14 | CDN_SHAREVIOLATION = (CDN_FIRST - 0x0003), 15 | CDN_HELP = (CDN_FIRST - 0x0004), 16 | CDN_FILEOK = (CDN_FIRST - 0x0005), 17 | CDN_TYPECHANGE = (CDN_FIRST - 0x0006), 18 | CDN_INCLUDEITEM = (CDN_FIRST - 0x0007) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/CDRF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | /// 6 | /// custom draw return flags 7 | /// values under 0x00010000 are reserved for global custom draw values. 8 | /// above that are for specific controls 9 | /// 10 | internal static class CDRF 11 | { 12 | internal const int CDRF_DODEFAULT = 0x0; 13 | internal const int CDRF_NEWFONT = 0x2; 14 | internal const int CDRF_SKIPDEFAULT = 0x4; 15 | internal const int CDRF_NOTIFYPOSTPAINT = 0x10; 16 | internal const int CDRF_NOTIFYITEMDRAW = 0x20; 17 | 18 | #if (_WIN32_IE0400) //>= 0x0400 19 | internal const int CDRF_NOTIFYSUBITEMDRAW = 0x20; // flags are the same, we can distinguish by context 20 | #endif 21 | internal const int CDRF_NOTIFYPOSTERASE = 0x40; 22 | internal const int CDRF_NOTIFYITEMERASE = 0x80; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/CS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DirectUI.Win32.Const 6 | { 7 | internal static class CS 8 | { 9 | internal const int CS_VREDRAW = 0x0001; 10 | internal const int CS_HREDRAW = 0x0002; 11 | internal const int CS_DBLCLKS = 0x0008; 12 | internal const int CS_OWNDC = 0x0020; 13 | internal const int CS_CLASSDC = 0x0040; 14 | internal const int CS_PARENTDC = 0x0080; 15 | internal const int CS_NOCLOSE = 0x0200; 16 | internal const int CS_SAVEBITS = 0x0800; 17 | internal const int CS_BYTEALIGNCLIENT = 0x1000; 18 | internal const int CS_BYTEALIGNWINDOW = 0x2000; 19 | internal const int CS_GLOBALCLASS = 0x4000; 20 | 21 | internal const int CS_IME = 0x00010000; 22 | //#if(_WIN32_WINNT >= 0x0501) 23 | internal const int CS_DROPSHADOW = 0x00020000; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/CombineRgnStyles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class CombineRgnStyles 6 | { 7 | private CombineRgnStyles() { } 8 | 9 | internal const int RGN_AND = 1; 10 | internal const int RGN_OR = 2; 11 | internal const int RGN_XOR = 3; 12 | internal const int RGN_DIFF = 4; 13 | internal const int RGN_COPY = 5; 14 | internal const int RGN_MIN = RGN_AND; 15 | internal const int RGN_MAX = RGN_COPY; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/DCX.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class DCX 6 | { 7 | internal const int 8 | DCX_WINDOW = 0x00000001, 9 | DCX_CACHE = 0x00000002, 10 | DCX_NORESETATTRS = 0x00000004, 11 | DCX_CLIPCHILDREN = 0x00000008, 12 | DCX_CLIPSIBLINGS = 0x00000010, 13 | DCX_PARENTCLIP = 0x00000020, 14 | DCX_EXCLUDERGN = 0x00000040, 15 | DCX_INTERSECTRGN = 0x00000080, 16 | DCX_EXCLUDEUPDATE = 0x00000100, 17 | DCX_INTERSECTUPDATE = 0x00000200, 18 | DCX_LOCKWINDOWUPDATE = 0x00000400, 19 | DCX_VALIDATE = 0x00200000; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/DI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class DI 6 | { 7 | /// 8 | /// Draws the icon or cursor using the mask. 9 | /// 10 | internal const int DI_MASK = 0x0001; 11 | 12 | /// 13 | /// Draws the icon or cursor using the image. 14 | /// 15 | internal const int DI_IMAGE = 0x0002; 16 | 17 | /// 18 | /// Combination of DI_IMAGE and DI_MASK. 19 | /// 20 | internal const int DI_NORMAL = 0x0003; 21 | 22 | /// 23 | /// Draws the icon or cursor using the system default image rather than the user-specified image. 24 | /// For more information, see About Cursors. Windows NT4.0 and later: This flag is ignored. 25 | /// 26 | internal const int DI_COMPAT = 0x0004; 27 | 28 | /// 29 | /// Draws the icon or cursor using the width and height specified by the system metric values for cursors or icons, 30 | /// if the cxWidth and cyWidth parameters are set to zero. If this flag is not specified and cxWidth and cyWidth are set to zero, 31 | /// the function uses the actual resource size. 32 | /// 33 | internal const int DI_DEFAULTSIZE = 0x0008; 34 | 35 | /// 36 | /// Windows XP: Draws the icon as an unmirrored icon. By default, the icon is drawn as a mirrored icon if hdc is mirrored. 37 | /// 38 | internal const int DI_NOMIRROR = 0x0010; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/DIB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class DIB 9 | { 10 | internal const uint DIB_RGB_COLORS = 0; /* color table in RGBs */ 11 | internal const uint DIB_PAL_COLORS = 1; /* color table in palette indices */ 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/DIGCF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class DIGCF 9 | { 10 | internal const uint DIGCF_PRESENT = 2; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/DROPEFFECT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class DROPEFFECT 6 | { 7 | internal const uint DROPEFFECT_COPY = 1; 8 | internal const uint DROPEFFECT_MOVE = 2; 9 | internal const uint DROPEFFECT_LINK = 4; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/EM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class EM 6 | { 7 | internal const int EM_GETSEL = 0x00B0; 8 | internal const int EM_LINEINDEX = 0x00BB; 9 | internal const int EM_LINEFROMCHAR = 0x00C9; 10 | internal const int EM_POSFROMCHAR = 0x00D6; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/ERROR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class ERROR 9 | { 10 | 11 | internal const int ERROR_SUCCESS = 0; 12 | internal const int ERROR_ALREADY_EXISTS = 183; 13 | internal const int ERROR_CANCELLED = 1223; 14 | internal const int ERROR_IO_PENDING = 0x3e5; 15 | internal const int ERROR_NO_MORE_ITEMS = 259; 16 | internal const int ERROR_TIMEOUT = 1460; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/ESB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class ESB 6 | { 7 | private ESB() { } 8 | 9 | internal const int ESB_ENABLE_BOTH = 0x0000; 10 | internal const int ESB_DISABLE_BOTH = 0x0003; 11 | 12 | internal const int ESB_DISABLE_LEFT = 0x0001; 13 | internal const int ESB_DISABLE_RIGHT = 0x0002; 14 | 15 | internal const int ESB_DISABLE_UP = 0x0001; 16 | internal const int ESB_DISABLE_DOWN = 0x0002; 17 | 18 | internal const int ESB_DISABLE_LTUP = ESB_DISABLE_LEFT; 19 | internal const int ESB_DISABLE_RTDN = ESB_DISABLE_RIGHT; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/GCL.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class GCL 6 | { 7 | internal const int GCL_CBCLSEXTRA = -20; 8 | internal const int GCL_CBWNDEXTRA = -18; 9 | internal const int GCL_HBRBACKGROUND = -10; 10 | internal const int GCL_HCURSOR = -12; 11 | internal const int GCL_HICON = -14; 12 | internal const int GCL_HMODULE = -16; 13 | internal const int GCL_MENUNAME = -8; 14 | internal const int GCL_STYLE = -26; 15 | internal const int GCL_WNDPROC = -24; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/GCS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class GCS 9 | { 10 | internal const int GCS_COMPSTR = 0x0008; 11 | internal const int GCS_RESULTSTR = 0x0800; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/GCW.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class GCW 6 | { 7 | internal const int GCW_ATOM = -32; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/GWL.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class GWL 6 | { 7 | internal const int GWL_WNDPROC = -4; 8 | internal const int GWL_HINSTANCE = -6; 9 | internal const int GWL_HWNDPARENT = -8; 10 | internal const int GWL_STYLE = -16; 11 | internal const int GWL_EXSTYLE = -20; 12 | internal const int GWL_USERDATA = -21; 13 | internal const int GWL_ID = -12; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/HC.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DirectUI.Win32.Const 6 | { 7 | internal sealed class HC 8 | { 9 | internal const int HC_ACTION = 0; 10 | internal const int HC_GETNEXT = 1; 11 | internal const int HC_SKIP = 2; 12 | internal const int HC_NOREMOVE = 3; 13 | internal const int HC_NOREM = HC_NOREMOVE; 14 | internal const int HC_SYSMODALON = 4; 15 | internal const int HC_SYSMODALOFF = 5; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/HEAP.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class HEAP 9 | { 10 | internal const int HEAP_COMPATIBILITY_INFORMATION = 0; 11 | internal const uint HEAP_NO_SERIALIZE = 0x00000001; 12 | internal const uint HEAP_GROWABLE = 0x00000002; 13 | internal const uint HEAP_GENERATE_EXCEPTIONS = 0x00000004; 14 | internal const uint HEAP_ZERO_MEMORY = 0x00000008; 15 | internal const uint HEAP_REALLOC_IN_PLACE_ONLY = 0x00000010; 16 | internal const uint HEAP_TAIL_CHECKING_ENABLED = 0x00000020; 17 | internal const uint HEAP_FREE_CHECKING_ENABLED = 0x00000040; 18 | internal const uint HEAP_DISABLE_COALESCE_ON_FREE = 0x00000080; 19 | internal const uint HEAP_CREATE_ALIGN_16 = 0x00010000; 20 | internal const uint HEAP_CREATE_ENABLE_TRACING = 0x00020000; 21 | internal const uint HEAP_MAXIMUM_TAG = 0x0FFF; 22 | internal const uint HEAP_PSEUDO_TAG_FLAG = 0x8000; 23 | internal const uint HEAP_TAG_SHIFT = 18; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/HT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DirectUI.Win32.Const 6 | { 7 | internal sealed class HT 8 | { 9 | internal const int HT_CAPTION = 0x2; 10 | internal const int HT_MINBUTTON = 0x8; 11 | internal const int HT_MAXBUTTON = 0x9; 12 | internal const int HT_LEFT = 10; 13 | internal const int HT_RIGHT = 11; 14 | internal const int HT_TOP = 12; 15 | internal const int HT_TOPLEFT = 13; 16 | internal const int HT_TOPRIGHT = 14; 17 | internal const int HT_BOTTOM = 15; 18 | internal const int HT_BOTTOMLEFT = 16; 19 | internal const int HT_BOTTOMRIGHT = 17; 20 | internal const int HT_CLOSE = 0x20; 21 | internal const int HT_HELP = 0x21; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/HWND.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | /// 6 | /// Use for setwindowpos. 7 | /// 8 | internal static class HWND 9 | { 10 | internal static readonly IntPtr HWND_TOPMOST = new IntPtr(-1); 11 | internal static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2); 12 | internal static readonly IntPtr HWND_TOP = new IntPtr(0); 13 | internal static readonly IntPtr HWND_BOTTOM = new IntPtr(1); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/ICC.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | /// 6 | /// INITCOMMONCONTROLSEX 结构的 dwICC 字段使用的常量。 7 | /// 8 | internal static class ICC 9 | { 10 | /// 11 | /// listview, header 12 | /// 13 | internal const int ICC_LISTVIEW_CLASSES = 0x00000001; 14 | 15 | /// 16 | /// treeview, tooltips 17 | /// 18 | internal const int ICC_TREEVIEW_CLASSES = 0x00000002; 19 | 20 | /// 21 | /// 注册工具栏、状态栏、Trackbar和Tooltip类。 22 | /// 23 | internal const int ICC_BAR_CLASSES = 0x00000004; 24 | 25 | /// 26 | /// tab, tooltips 27 | /// 28 | internal const int ICC_TAB_CLASSES = 0x00000008; 29 | 30 | /// 31 | /// updown 32 | /// 33 | internal const int ICC_UPDOWN_CLASS = 0x00000010; 34 | 35 | /// 36 | /// progress 37 | /// 38 | internal const int ICC_PROGRESS_CLASS = 0x00000020; 39 | 40 | /// 41 | /// hotkey 42 | /// 43 | internal const int ICC_HOTKEY_CLASS = 0x00000040; 44 | 45 | /// 46 | /// animate 47 | /// 48 | internal const int ICC_ANIMATE_CLASS = 0x00000080; 49 | 50 | internal const int ICC_WIN95_CLASSES = 0x000000FF; 51 | 52 | /// 53 | /// month picker, date picker, time picker, updown 54 | /// 55 | internal const int ICC_DATE_CLASSES = 0x00000100; 56 | 57 | /// 58 | /// comboex 59 | /// 60 | internal const int ICC_USEREX_CLASSES = 0x00000200; 61 | 62 | /// 63 | ///注册Rebar类。 64 | /// 65 | internal const int ICC_COOL_CLASSES = 0x00000400; 66 | 67 | #if (_WIN32_IE0400) //>= 0x0400) 68 | internal const int ICC_INTERNET_CLASSES = 0x00000800; 69 | 70 | /// 71 | /// page scroller 72 | /// 73 | internal const int ICC_PAGESCROLLER_CLASS = 0x00001000; 74 | 75 | /// 76 | /// native font control 77 | /// 78 | internal const int ICC_NATIVEFNTCTL_CLASS = 0x00002000; 79 | #endif 80 | 81 | #if (_WIN32_WINNT501) //>= 0x501 82 | internal const int ICC_STANDARD_CLASSES = 0x00004000; 83 | internal const int ICC_LINK_CLASS = 0x00008000; 84 | #endif 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/ICON.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class ICON 6 | { 7 | internal const int ICON_SMALL = 0; 8 | internal const int ICON_BIG = 1; 9 | internal const int ICON_SMALL2 = 2; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/INVALID.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class INVALID 6 | { 7 | internal static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/LPSTR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DirectUI.Win32.Const 6 | { 7 | internal class LPSTR 8 | { 9 | internal static readonly IntPtr LPSTR_TEXTCALLBACK = new IntPtr(-1); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/MA.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DirectUI.Win32.Const 6 | { 7 | internal sealed class MA 8 | { 9 | internal const int MA_ACTIVATE = 1; 10 | internal const int MA_ACTIVATEANDEAT = 2; 11 | internal const int MA_NOACTIVATE = 3; 12 | internal const int MA_NOACTIVATEANDEAT = 4; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/MEM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class MEM 9 | { 10 | internal const uint MEM_COMMIT = 0x1000; 11 | internal const uint MEM_RESERVE = 0x2000; 12 | internal const uint MEM_DECOMMIT = 0x4000; 13 | internal const uint MEM_RELEASE = 0x8000; 14 | internal const uint MEM_RESET = 0x80000; 15 | internal const uint MEM_TOP_DOWN = 0x100000; 16 | internal const uint MEM_PHYSICAL = 0x400000; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/NM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | /// 6 | /// Generic WM_NOTIFY notification codes 7 | /// 8 | internal static class NM 9 | { 10 | internal const int NM_FIRST = 0; 11 | internal const int NM_OUTOFMEMORY = (NM_FIRST - 1); 12 | internal const int NM_CLICK = (NM_FIRST - 2); // uses NMCLICK struct 13 | internal const int NM_DBLCLK = (NM_FIRST - 3); 14 | internal const int NM_RETURN = (NM_FIRST - 4); 15 | internal const int NM_RCLICK = (NM_FIRST - 5); // uses NMCLICK struct 16 | internal const int NM_RDBLCLK = (NM_FIRST - 6); 17 | internal const int NM_SETFOCUS = (NM_FIRST - 7); 18 | internal const int NM_KILLFOCUS = (NM_FIRST - 8); 19 | 20 | #if (_WIN32_IE0300) //>= 0x0300 21 | internal const int NM_CUSTOMDRAW = (NM_FIRST-12); 22 | internal const int NM_HOVER = (NM_FIRST-13); 23 | #endif 24 | 25 | #if (_WIN32_IE0400) //>= 0x0400 26 | internal const int NM_NCHITTEST = (NM_FIRST-14); // uses NMMOUSE struct 27 | internal const int NM_KEYDOWN = (NM_FIRST-15); // uses NMKEY struct 28 | internal const int NM_RELEASEDCAPTURE = (NM_FIRST-16); 29 | internal const int NM_SETCURSOR = (NM_FIRST-17); // uses NMMOUSE struct 30 | internal const int NM_CHAR = (NM_FIRST-18); // uses NMCHAR struct 31 | #endif 32 | 33 | #if (_WIN32_IE0401) //>= 0x0401 34 | internal const int NM_TOOLTIPSCREATED = (NM_FIRST-19); // notify of when the tooltips window is create 35 | #endif 36 | 37 | #if (_WIN32_IE0500) //>= 0x0500 38 | internal const int NM_LDOWN = (NM_FIRST-20); 39 | internal const int NM_RDOWN = (NM_FIRST-21); 40 | internal const int NM_THEMECHANGED = (NM_FIRST-22); 41 | #endif 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/OBJID.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class OBJID 6 | { 7 | internal const uint OBJID_WINDOW = 0x00000000; 8 | internal const uint OBJID_SYSMENU = 0xFFFFFFFF; 9 | internal const uint OBJID_TITLEBAR = 0xFFFFFFFE; 10 | internal const uint OBJID_MENU = 0xFFFFFFFD; 11 | internal const uint OBJID_CLIENT = 0xFFFFFFFC; 12 | internal const uint OBJID_VSCROLL = 0xFFFFFFFB; 13 | internal const uint OBJID_HSCROLL = 0xFFFFFFFA; 14 | internal const uint OBJID_SIZEGRIP = 0xFFFFFFF9; 15 | internal const uint OBJID_CARET = 0xFFFFFFF8; 16 | internal const uint OBJID_CURSOR = 0xFFFFFFF7; 17 | internal const uint OBJID_ALERT = 0xFFFFFFF6; 18 | internal const uint OBJID_SOUND = 0xFFFFFFF5; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/OF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class OF 9 | { 10 | internal const Int32 OF_READWRITE = 0x00000001; 11 | internal const Int32 OF_SHARE_DENY_NONE = 0x00000001; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/PAGE.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class PAGE 9 | { 10 | internal const uint PAGE_NOACCESS = 0x01; 11 | internal const uint PAGE_READONLY = 0x02; 12 | internal const uint PAGE_READWRITE = 0x04; 13 | internal const uint PAGE_WRITECOPY = 0x08; 14 | internal const uint PAGE_EXECUTE = 0x10; 15 | internal const uint PAGE_EXECUTE_READ = 0x20; 16 | internal const uint PAGE_EXECUTE_READWRITE = 0x40; 17 | internal const uint PAGE_EXECUTE_WRITECOPY = 0x80; 18 | internal const uint PAGE_GUARD = 0x100; 19 | internal const uint PAGE_NOCACHE = 0x200; 20 | internal const uint PAGE_WRITECOMBINE = 0x400; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/PF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class PF 6 | { 7 | internal const uint PF_NX_ENABLED = 12; 8 | internal const uint PF_XMMI_INSTRUCTIONS_AVAILABLE = 6; 9 | internal const uint PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10; 10 | internal const uint PF_SSE3_INSTRUCTIONS_AVAILABLE = 13; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/PM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class PM 9 | { 10 | internal const int PM_REMOVE = 0x0001; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/PRF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class PRF 6 | { 7 | internal const long PRF_CHECKVISIBLE = 0x00000001L; 8 | internal const long PRF_NONCLIENT = 0x00000002L; 9 | internal const long PRF_CLIENT = 0x00000004L; 10 | internal const long PRF_ERASEBKGND = 0x00000008L; 11 | internal const long PRF_CHILDREN = 0x00000010L; 12 | internal const long PRF_OWNED = 0x00000020L; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/PROCESSOR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace DirectUI.Win32.Const 7 | { 8 | internal static class PROCESSOR 9 | { 10 | 11 | internal const ushort PROCESSOR_ARCHITECTURE_INTEL = 0; 12 | internal const ushort PROCESSOR_ARCHITECTURE_IA64 = 6; 13 | internal const ushort PROCESSOR_ARCHITECTURE_AMD64 = 9; 14 | internal const ushort PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/RDW.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class RDW 6 | { 7 | private RDW() {} 8 | 9 | internal const int RDW_INVALIDATE = 0x0001; 10 | internal const int RDW_INTERNALPAINT = 0x0002; 11 | internal const int RDW_ERASE = 0x0004; 12 | internal const int RDW_VALIDATE = 0x0008; 13 | internal const int RDW_NOINTERNALPAINT = 0x0010; 14 | internal const int RDW_NOERASE = 0x0020; 15 | internal const int RDW_NOCHILDREN = 0x0040; 16 | internal const int RDW_ALLCHILDREN = 0x0080; 17 | internal const int RDW_UPDATENOW = 0x0100; 18 | internal const int RDW_ERASENOW = 0x0200; 19 | internal const int RDW_FRAME = 0x0400; 20 | internal const int RDW_NOFRAME = 0x0800; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/RGN.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class RGN 6 | { 7 | internal const int RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/SB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class SB 6 | { 7 | internal const int SB_HORZ = 0; 8 | internal const int SB_VERT = 1; 9 | internal const int SB_LINEUP = 0; 10 | internal const int SB_LINELEFT = 0; 11 | internal const int SB_LINEDOWN = 1; 12 | internal const int SB_LINERIGHT = 1; 13 | internal const int SB_PAGEUP = 2; 14 | internal const int SB_PAGELEFT = 2; 15 | internal const int SB_PAGEDOWN = 3; 16 | internal const int SB_PAGERIGHT = 3; 17 | internal const int SB_BOTH = 3; 18 | internal const int SB_THUMBPOSITION = 4; 19 | internal const int SB_THUMBTRACK = 5; 20 | internal const int SB_TOP = 6; 21 | internal const int SB_LEFT = 6; 22 | internal const int SB_BOTTOM = 7; 23 | internal const int SB_RIGHT = 7; 24 | internal const int SB_ENDSCROLL = 8; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/SBM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class SBM 6 | { 7 | private SBM() { } 8 | 9 | internal const int SBM_SETPOS = 0x00E0; 10 | internal const int SBM_GETPOS = 0x00E1; 11 | internal const int SBM_SETRANGE = 0x00E2; 12 | internal const int SBM_SETRANGEREDRAW = 0x00E6; 13 | internal const int SBM_GETRANGE = 0x00E3; 14 | internal const int SBM_ENABLE_ARROWS = 0x00E4; 15 | internal const int SBM_SETSCROLLINFO = 0x00E9; 16 | internal const int SBM_GETSCROLLINFO = 0x00EA; 17 | internal const int SBM_GETSCROLLBARINFO = 0x00EB; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/SC.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class SC 6 | { 7 | internal const int SC_SIZE = 0xF000; 8 | internal const int SC_MOVE = 0xF010; 9 | internal const int SC_MINIMIZE = 0xF020; 10 | internal const int SC_MAXIMIZE = 0xF030; 11 | internal const int SC_NEXTWINDOW = 0xF040; 12 | internal const int SC_PREVWINDOW = 0xF050; 13 | internal const int SC_CLOSE = 0xF060; 14 | internal const int SC_VSCROLL = 0xF070; 15 | internal const int SC_HSCROLL = 0xF080; 16 | internal const int SC_MOUSEMENU = 0xF090; 17 | internal const int SC_KEYMENU = 0xF100; 18 | internal const int SC_ARRANGE = 0xF110; 19 | internal const int SC_RESTORE = 0xF120; 20 | internal const int SC_TASKLIST = 0xF130; 21 | internal const int SC_SCREENSAVE = 0xF140; 22 | internal const int SC_HOTKEY = 0xF150; 23 | internal const int SC_DoubleRESTORE = 61730;//双击还原 24 | 25 | internal const int SC_DEFAULT = 0xF160; 26 | internal const int SC_MONITORPOWER = 0xF170; 27 | internal const int SC_CONTEXTHELP = 0xF180; 28 | internal const int SC_SEPARATOR = 0xF00F; 29 | 30 | internal const int SCF_ISSECURE = 0x00000001; 31 | 32 | internal const int SC_ICON = SC_MINIMIZE; 33 | internal const int SC_ZOOM = SC_MAXIMIZE; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/SIF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class SIF 6 | { 7 | internal const int SIF_RANGE = 0x1; 8 | internal const int SIF_PAGE = 0x2; 9 | internal const int SIF_POS = 0x4; 10 | internal const int SIF_DISABLENOSCROLL = 0x8; 11 | internal const int SIF_TRACKPOS = 0x10; 12 | internal const int SIF_ALL = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/SS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | /// 6 | /// Static Style. 7 | /// 8 | internal class SS 9 | { 10 | private SS() { } 11 | 12 | internal const int SS_OWNERDRAW = 0x0000000D; 13 | internal const int SS_ETCHEDHORZ = 0x00000010; 14 | internal const int SS_ETCHEDVERT = 0x00000011; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/SW.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class SW 6 | { 7 | internal const int SW_HIDE = 0; 8 | internal const int SW_SHOWNORMAL = 1; 9 | internal const int SW_NORMAL = 1; 10 | internal const int SW_SHOWMINIMIZED = 2; 11 | internal const int SW_SHOWMAXIMIZED = 3; 12 | internal const int SW_MAXIMIZE = 3; 13 | internal const int SW_SHOWNOACTIVATE = 4; 14 | internal const int SW_SHOW = 5; 15 | internal const int SW_MINIMIZE = 6; 16 | internal const int SW_SHOWMINNOACTIVE = 7; 17 | internal const int SW_SHOWNA = 8; 18 | internal const int SW_RESTORE = 9; 19 | internal const int SW_SHOWDEFAULT = 10; 20 | internal const int SW_FORCEMINIMIZE = 11; 21 | internal const int SW_MAX = 11; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/SWP.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | /// 6 | /// SetWindowPos Flags. 7 | /// 8 | internal enum SWP 9 | { 10 | SWP_NOSIZE = 0x0001, 11 | SWP_NOMOVE = 0x0002, 12 | SWP_NOZORDER = 0x0004, 13 | SWP_NOREDRAW = 0x0008, 14 | SWP_NOACTIVATE = 0x0010, 15 | SWP_FRAMECHANGED = 0x0020,//The frame changed: send WM_NCCALCSIZE 16 | SWP_SHOWWINDOW = 0x0040, 17 | SWP_HIDEWINDOW = 0x0080, 18 | SWP_NOCOPYBITS = 0x0100, 19 | SWP_NOOWNERZORDER = 0x0200,//Don't do owner Z ordering 20 | SWP_NOSENDCHANGING = 0x0400,//Don't send WM_WINDOWPOSCHANGING 21 | SWP_DEFERERASE = 0x2000, 22 | SWP_ASYNCWINDOWPOS = 0x4000, 23 | 24 | SWP_DRAWFRAME = SWP_FRAMECHANGED, 25 | SWP_NOREPOSITION = SWP_NOOWNERZORDER 26 | 27 | //#if(WINVER0400) //>= 0x0400 28 | // SWP_DEFERERASE = 0x2000, 29 | // SWP_ASYNCWINDOWPOS = 0x4000, 30 | //#endif 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TBM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DirectUI.Win32.Const 6 | { 7 | /// 8 | /// trackbar messages. 9 | /// 10 | internal static class TBM 11 | { 12 | private const int WM_USER = 0x0400; 13 | 14 | internal const int TBM_GETRANGEMIN = (WM_USER + 1); 15 | internal const int TBM_GETRANGEMAX = (WM_USER + 2); 16 | internal const int TBM_GETTIC = (WM_USER + 3); 17 | internal const int TBM_SETTIC = (WM_USER + 4); 18 | internal const int TBM_SETPOS = (WM_USER + 5); 19 | internal const int TBM_SETRANGE = (WM_USER + 6); 20 | internal const int TBM_SETRANGEMIN = (WM_USER + 7); 21 | internal const int TBM_SETRANGEMAX = (WM_USER + 8); 22 | internal const int TBM_CLEARTICS = (WM_USER + 9); 23 | internal const int TBM_SETSEL = (WM_USER + 10); 24 | internal const int TBM_SETSELSTART = (WM_USER + 11); 25 | internal const int TBM_SETSELEND = (WM_USER + 12); 26 | internal const int TBM_GETPTICS = (WM_USER + 14); 27 | internal const int TBM_GETTICPOS = (WM_USER + 15); 28 | internal const int TBM_GETNUMTICS = (WM_USER + 16); 29 | internal const int TBM_GETSELSTART = (WM_USER + 17); 30 | internal const int TBM_GETSELEND = (WM_USER + 18); 31 | internal const int TBM_CLEARSEL = (WM_USER + 19); 32 | internal const int TBM_SETTICFREQ = (WM_USER + 20); 33 | internal const int TBM_SETPAGESIZE = (WM_USER + 21); 34 | internal const int TBM_GETPAGESIZE = (WM_USER + 22); 35 | internal const int TBM_SETLINESIZE = (WM_USER + 23); 36 | internal const int TBM_GETLINESIZE = (WM_USER + 24); 37 | internal const int TBM_GETTHUMBRECT = (WM_USER + 25); 38 | internal const int TBM_GETCHANNELRECT = (WM_USER + 26); 39 | internal const int TBM_SETTHUMBLENGTH = (WM_USER + 27); 40 | internal const int TBM_GETTHUMBLENGTH = (WM_USER + 28); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TCHT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class TCHT 6 | { 7 | internal const int TCHT_NOWHERE = 1; 8 | internal const int TCHT_ONITEMICON = 2; 9 | internal const int TCHT_ONITEMLABEL = 4; 10 | internal const int TCHT_ONITEM = TCHT_ONITEMICON | TCHT_ONITEMLABEL; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TCM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class TCM 6 | { 7 | internal const int TCM_HITTEST = 0x130D; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TME.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DirectUI.Win32.Const 6 | { 7 | internal sealed class TME 8 | { 9 | internal const uint TME_HOVER = 1; 10 | internal const uint TME_LEAVE = 2; 11 | internal const uint TME_NONCLIENT = 0x00000010; 12 | internal const uint TME_QUERY = 0x40000000; 13 | internal const uint TME_CANCEL = 0x80000000; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TPM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal sealed class TPM 6 | { 7 | internal const int TPM_LEFTALIGN = 0x0000; 8 | internal const int TPM_TOPALIGN = 0x0000; 9 | internal const int TPM_RETURNCMD = 0x0100; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TTDT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class TTDT 6 | { 7 | internal const int TTDT_AUTOMATIC = 0; 8 | internal const int TTDT_RESHOW = 1; 9 | internal const int TTDT_AUTOPOP = 2; 10 | internal const int TTDT_INITIAL = 3; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TTF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class TTF 6 | { 7 | internal const int TTF_IDISHWND = 0x0001; 8 | // Use this to center around trackpoint in trackmode 9 | // -OR- to center around tool in normal mode. 10 | // Use TTF_ABSOLUTE to place the tip exactly at the track coords when 11 | // in tracking mode. TTF_ABSOLUTE can be used in conjunction with TTF_CENTERTIP 12 | // to center the tip absolutely about the track point. 13 | internal const int TTF_CENTERTIP = 0x0002; 14 | internal const int TTF_RTLREADING = 0x0004; 15 | internal const int TTF_SUBCLASS = 0x0010; 16 | internal const int TTF_TRACK = 0x0020; 17 | internal const int TTF_ABSOLUTE = 0x0080; 18 | internal const int TTF_TRANSPARENT = 0x0100; 19 | internal const int TTF_PARSELINKS = 0x1000; 20 | internal const int TTF_DI_SETITEM = 0x8000;// valid only on the TTN_NEEDTEXT callback 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TTI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | /// 6 | /// ToolTip Icons possible wParam values for TTM_SETTITLE message. 7 | /// 8 | internal static class TTI 9 | { 10 | internal const int TTI_NONE = 0; 11 | internal const int TTI_INFO = 1; //(32512) 12 | internal const int TTI_WARNING = 2; 13 | internal const int TTI_ERROR = 3; 14 | 15 | //// values larger thant TTI_ERROR are assumed to be an HICON value 16 | internal const int TTI_INFO_LARGE = 4; 17 | internal const int TTI_WARNING_LARGE = 5; 18 | internal const int TTI_ERROR_LARGE = 6; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TTN.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Const 5 | { 6 | internal static class TTN 7 | { 8 | // ownerdraw 9 | internal const int TTN_FIRST = (-520); 10 | 11 | internal const int TTN_GETDISPINFOA = (TTN_FIRST - 0); 12 | internal const int TTN_GETDISPINFOW = (TTN_FIRST - 10); 13 | internal const int TTN_SHOW = (TTN_FIRST - 1); 14 | internal const int TTN_POP = (TTN_FIRST - 2); 15 | internal const int TTN_LINKCLICK = (TTN_FIRST - 3); 16 | 17 | internal const int TTN_NEEDTEXTA = TTN_GETDISPINFOA; 18 | internal const int TTN_NEEDTEXTW = TTN_GETDISPINFOW; 19 | 20 | internal const int TTN_LAST = (-549); 21 | 22 | internal readonly static int TTN_GETDISPINFO; 23 | internal readonly static int TTN_NEEDTEXT; 24 | 25 | static TTN() 26 | { 27 | bool unicode = Marshal.SystemDefaultCharSize != 1; 28 | if (unicode) 29 | { 30 | TTN_GETDISPINFO = TTN_GETDISPINFOW; 31 | TTN_NEEDTEXT = TTN_NEEDTEXTW; 32 | } 33 | else 34 | { 35 | TTN_GETDISPINFO = TTN_GETDISPINFOA; 36 | TTN_NEEDTEXT = TTN_NEEDTEXTA; 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TTS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace DirectUI.Win32.Const 6 | { 7 | /// 8 | /// styles 9 | /// 10 | internal static class TTS 11 | { 12 | internal const int TTS_ALWAYSTIP = 0x01; 13 | internal const int TTS_NOPREFIX = 0x02; 14 | internal const int TTS_NOANIMATE = 0x10; 15 | internal const int TTS_NOFADE = 0x20; 16 | internal const int TTS_BALLOON = 0x40; 17 | internal const int TTS_CLOSE = 0x80; 18 | internal const int TTS_USEVISUALSTYLE = 0x100; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/TernaryRasterOperations.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal class TernaryRasterOperations 6 | { 7 | private TernaryRasterOperations() { } 8 | 9 | internal const int SRCCOPY = 0x00CC0020; /* dest = source*/ 10 | internal const int SRCPAINT = 0x00EE0086; /* dest = source OR dest*/ 11 | internal const int SRCAND = 0x008800C6; /* dest = source AND dest*/ 12 | internal const int SRCINVERT = 0x00660046; /* dest = source XOR dest*/ 13 | internal const int SRCERASE = 0x00440328; /* dest = source AND (NOT dest )*/ 14 | internal const int NOTSRCCOPY = 0x00330008; /* dest = (NOT source)*/ 15 | internal const int NOTSRCERASE = 0x001100A6; /* dest = (NOT src) AND (NOT dest) */ 16 | internal const int MERGECOPY = 0x00C000CA; /* dest = (source AND pattern)*/ 17 | internal const int MERGEPAINT = 0x00BB0226; /* dest = (NOT source) OR dest*/ 18 | internal const int PATCOPY = 0x00F00021; /* dest = pattern*/ 19 | internal const int PATPAINT = 0x00FB0A09; /* dest = DPSnoo*/ 20 | internal const int PATINVERT = 0x005A0049; /* dest = pattern XOR dest*/ 21 | internal const int DSTINVERT = 0x00550009; /* dest = (NOT dest)*/ 22 | internal const int BLACKNESS = 0x00000042; /* dest = BLACK*/ 23 | internal const int WHITENESS = 0x00FF0062; /* dest = WHITE*/ 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/VK.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class VK 6 | { 7 | internal const int VK_LBUTTON = 0x1; 8 | internal const int VK_RBUTTON = 0x2; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/WA.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class WA 6 | { 7 | internal const int WA_INACTIVE = 0; 8 | internal const int WA_ACTIVE = 1; 9 | internal const int WA_CLICKACTIVE = 2; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/WAIT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class WAIT 6 | { 7 | internal const uint INFINITE = 0xffffffff; 8 | internal const uint STATUS_WAIT_0 = 0; 9 | internal const uint STATUS_ABANDONED_WAIT_0 = 0x80; 10 | internal const uint WAIT_FAILED = 0xffffffff; 11 | internal const uint WAIT_TIMEOUT = 258; 12 | internal const uint WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0 + 0; 13 | internal const uint WAIT_OBJECT_0 = STATUS_WAIT_0 + 0; 14 | internal const uint WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0 + 0; 15 | internal const uint STATUS_USER_APC = 0x000000C0; 16 | internal const uint WAIT_IO_COMPLETION = STATUS_USER_APC; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/WH.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal sealed class WH 6 | { 7 | internal const int WH_MSGFILTER = (-1); 8 | internal const int WH_JOURNALRECORD = 0; 9 | internal const int WH_JOURNALPLAYBACK = 1; 10 | internal const int WH_KEYBOARD = 2; 11 | internal const int WH_GETMESSAGE = 3; 12 | internal const int WH_CALLWNDPROC = 4; 13 | internal const int WH_CBT = 5; 14 | internal const int WH_SYSMSGFILTER = 6; 15 | internal const int WH_MOUSE = 7; 16 | internal const int WH_HARDWARE = 8; 17 | internal const int WH_DEBUG = 9; 18 | internal const int WH_SHELL = 10; 19 | internal const int WH_FOREGROUNDIDLE = 11; 20 | internal const int WH_CALLWNDPROCRET = 12; 21 | internal const int WH_KEYBOARD_LL = 13; 22 | internal const int WH_MOUSE_LL = 14; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/WM.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/DirectUI/Win32/Const/WM.cs -------------------------------------------------------------------------------- /DirectUI/Win32/Const/WS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class WS 6 | { 7 | internal const int WS_EX_WINDOWEDGE = 0x00000100; 8 | internal const int WS_EX_DLGMODALFRAME = 0x00000001; 9 | internal const int WS_OVERLAPPED = 0x00000000; 10 | internal const int WS_POPUP = unchecked((int)0x80000000); 11 | internal const int WS_CHILD = 0x40000000; 12 | internal const int WS_MINIMIZE = 0x20000000; 13 | internal const int WS_VISIBLE = 0x10000000; 14 | internal const int WS_DISABLED = 0x08000000; 15 | internal const int WS_CLIPSIBLINGS = 0x04000000; 16 | internal const int WS_CLIPCHILDREN = 0x02000000; 17 | internal const int WS_MAXIMIZE = 0x01000000; 18 | internal const int WS_CAPTION = 0x00C00000; 19 | internal const int WS_BORDER = 0x00800000; 20 | internal const int WS_DLGFRAME = 0x00400000; 21 | internal const int WS_VSCROLL = 0x00200000; 22 | internal const int WS_HSCROLL = 0x00100000; 23 | internal const int WS_SYSMENU = 0x00080000; 24 | internal const int WS_THICKFRAME = 0x00040000; 25 | internal const int WS_GROUP = 0x00020000; 26 | internal const int WS_TABSTOP = 0x00010000; 27 | internal const int WS_MINIMIZEBOX = 0x00020000; 28 | internal const int WS_MAXIMIZEBOX = 0x00010000; 29 | internal const int WS_TILED = WS_OVERLAPPED; 30 | internal const int WS_ICONIC = WS_MINIMIZE; 31 | internal const int WS_SIZEBOX = WS_THICKFRAME; 32 | internal const int WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW; 33 | internal const int WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | 34 | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX); 35 | internal const int WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU); 36 | internal const int WS_CHILDWINDOW = (WS_CHILD); 37 | internal const int WS_EX_LAYERED = 0x00080000; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/WS_EX.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | internal static class WS_EX 6 | { 7 | internal const int WS_EX_DLGMODALFRAME = 0x00000001; 8 | internal const int WS_EX_NOPARENTNOTIFY = 0x00000004; 9 | internal const int WS_EX_TOPMOST = 0x00000008; 10 | internal const int WS_EX_ACCEPTFILES = 0x00000010; 11 | internal const int WS_EX_TRANSPARENT = 0x00000020; 12 | internal const int WS_EX_MDICHILD = 0x00000040; 13 | internal const int WS_EX_TOOLWINDOW = 0x00000080; 14 | internal const int WS_EX_WINDOWEDGE = 0x00000100; 15 | internal const int WS_EX_CLIENTEDGE = 0x00000200; 16 | internal const int WS_EX_CONTEXTHELP = 0x00000400; 17 | internal const int WS_EX_RIGHT = 0x00001000; 18 | internal const int WS_EX_LEFT = 0x00000000; 19 | internal const int WS_EX_RTLREADING = 0x00002000; 20 | internal const int WS_EX_LTRREADING = 0x00000000; 21 | internal const int WS_EX_LEFTSCROLLBAR = 0x00004000; 22 | internal const int WS_EX_RIGHTSCROLLBAR = 0x00000000; 23 | internal const int WS_EX_CONTROLPARENT = 0x00010000; 24 | internal const int WS_EX_STATICEDGE = 0x00020000; 25 | internal const int WS_EX_APPWINDOW = 0x00040000; 26 | internal const int WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE); 27 | internal const int WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST); 28 | internal const int WS_EX_LAYERED = 0x00080000; 29 | internal const int WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritence of mirroring by children 30 | internal const int WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring 31 | internal const int WS_EX_COMPOSITED = 0x02000000; 32 | internal const int WS_EX_NOACTIVATE = 0x08000000; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /DirectUI/Win32/Const/WVR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32.Const 4 | { 5 | /// 6 | /// WM_NCCALCSIZE "window valid rect" return values. 7 | /// 8 | internal class WVR 9 | { 10 | internal const int WVR_ALIGNTOP = 0x0010; 11 | internal const int WVR_ALIGNLEFT = 0x0020; 12 | internal const int WVR_ALIGNBOTTOM = 0x0040; 13 | internal const int WVR_ALIGNRIGHT = 0x0080; 14 | internal const int WVR_HREDRAW = 0x0100; 15 | internal const int WVR_VREDRAW = 0x0200; 16 | internal const int WVR_REDRAW = (WVR_HREDRAW | WVR_VREDRAW); 17 | internal const int WVR_VALIDRECTS = 0x0400; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DirectUI/Win32/Result.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DirectUI.Win32 4 | { 5 | internal static class Result 6 | { 7 | internal static readonly IntPtr TRUE = new IntPtr(1); 8 | internal static readonly IntPtr FALSE = new IntPtr(0); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/API_MSG.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Windows.Forms; 4 | 5 | namespace DirectUI.Win32.Struct 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | internal struct API_MSG 9 | { 10 | internal IntPtr Hwnd; 11 | internal int Msg; 12 | internal IntPtr WParam; 13 | internal IntPtr LParam; 14 | internal int Time; 15 | internal POINT Pt; 16 | 17 | internal Message ToMessage() 18 | { 19 | Message res = new Message(); 20 | res.HWnd = Hwnd; 21 | res.Msg = Msg; 22 | res.WParam = WParam; 23 | res.LParam = LParam; 24 | return res; 25 | } 26 | 27 | internal void FromMessage(ref Message msg) 28 | { 29 | Hwnd = msg.HWnd; 30 | Msg = msg.Msg; 31 | WParam = msg.WParam; 32 | LParam = msg.LParam; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/BITMAPINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct BITMAPINFO 11 | { 12 | internal BITMAPINFOHEADER bmiHeader; 13 | internal RGBQUAD bmiColors; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/BITMAPINFOHEADER.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct BITMAPINFOHEADER 11 | { 12 | internal uint biSize; 13 | internal int biWidth; 14 | internal int biHeight; 15 | internal ushort biPlanes; 16 | internal ushort biBitCount; 17 | internal uint biCompression; 18 | internal uint biSizeImage; 19 | internal int biXPelsPerMeter; 20 | internal int biYPelsPerMeter; 21 | internal uint biClrUsed; 22 | internal uint biClrImportant; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/BLENDFUNCTION.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct BLENDFUNCTION 8 | { 9 | internal byte BlendOp; 10 | internal byte BlendFlags; 11 | internal byte SourceConstantAlpha; 12 | internal byte AlphaFormat; 13 | 14 | internal BLENDFUNCTION( 15 | byte op, byte flags, byte alpha, byte format) 16 | { 17 | BlendOp = op; 18 | BlendFlags = flags; 19 | SourceConstantAlpha = alpha; 20 | AlphaFormat = format; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/COMDLG_FILTERSPEC.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)] 10 | internal struct COMDLG_FILTERSPEC 11 | { 12 | [MarshalAs(UnmanagedType.LPWStr)] 13 | internal string pszName; 14 | [MarshalAs(UnmanagedType.LPWStr)] 15 | internal string pszSpec; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/COPYDATASTRUCT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct COPYDATASTRUCT 11 | { 12 | internal UIntPtr dwData; 13 | internal uint cbData; 14 | internal IntPtr lpData; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/CWPRETSTRUCT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct CWPRETSTRUCT 8 | { 9 | internal IntPtr lResult; 10 | internal IntPtr lParam; 11 | internal IntPtr wParam; 12 | internal int message; 13 | internal IntPtr hwnd; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/CWPSTRUCT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal sealed class CWPSTRUCT 8 | { 9 | internal IntPtr lParam; 10 | internal IntPtr wParam; 11 | internal int message; 12 | internal IntPtr hwnd; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/GPRECTF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | 8 | namespace DirectUI.Win32.Struct 9 | { 10 | [StructLayout(LayoutKind.Sequential)] 11 | internal struct GPRECTF 12 | { 13 | internal float X; 14 | internal float Y; 15 | internal float Width; 16 | internal float Height; 17 | 18 | internal GPRECTF(float x, float y, float width, float height) 19 | { 20 | X = x; 21 | Y = y; 22 | Width = width; 23 | Height = height; 24 | } 25 | 26 | internal GPRECTF(RectangleF rect) 27 | { 28 | X = rect.X; 29 | Y = rect.Y; 30 | Width = rect.Width; 31 | Height = rect.Height; 32 | } 33 | 34 | internal SizeF SizeF 35 | { 36 | get 37 | { 38 | return new SizeF(Width, Height); 39 | } 40 | } 41 | 42 | internal RectangleF ToRectangleF() 43 | { 44 | return new RectangleF(X, Y, Width, Height); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/INITCOMMONCONTROLSEX.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct INITCOMMONCONTROLSEX 8 | { 9 | internal INITCOMMONCONTROLSEX(int flags) 10 | { 11 | this.dwSize = Marshal.SizeOf(typeof(INITCOMMONCONTROLSEX)); 12 | this.dwICC = flags; 13 | } 14 | 15 | internal int dwSize; 16 | internal int dwICC; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/KEYBOARDHOOKSTRUCT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct KEYBOARDHOOKSTRUCT 11 | { 12 | internal int vkCode; //表示一个在1到254间的虚似键盘码 13 | internal int scanCode; //表示硬件扫描码 14 | internal int flags; 15 | internal int time; 16 | internal int dwExtraInfo; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/LOGBRUSH.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct LOGBRUSH 11 | { 12 | internal uint lbStyle; 13 | internal uint lbColor; 14 | internal int lbHatch; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/LOGFONT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 10 | internal class LOGFONT 11 | { 12 | internal int lfHeight = 0; 13 | internal int lfWidth = 0; 14 | internal int lfEscapement = 0; 15 | internal int lfOrientation = 0; 16 | internal int lfWeight = 0; 17 | internal byte lfItalic = 0; 18 | internal byte lfUnderline = 0; 19 | internal byte lfStrikeOut = 0; 20 | internal byte lfCharSet = 0; 21 | internal byte lfOutPrecision = 0; 22 | internal byte lfClipPrecision = 0; 23 | internal byte lfQuality = 0; 24 | internal byte lfPitchAndFamily = 0; 25 | 26 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] 27 | internal string lfFaceName = string.Empty; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/MEMORYSTATUSEX.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct MEMORYSTATUSEX 11 | { 12 | internal uint dwLength; 13 | internal uint dwMemoryLoad; 14 | internal ulong ullTotalPhys; 15 | internal ulong ullAvailPhys; 16 | internal ulong ullTotalPageFile; 17 | internal ulong ullAvailPageFile; 18 | internal ulong ullTotalVirtual; 19 | internal ulong ullAvailVirtual; 20 | internal ulong ullAvailExtendedVirtual; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/MEMORY_BASIC_INFORMATION.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal unsafe struct MEMORY_BASIC_INFORMATION 11 | { 12 | internal void* BaseAddress; 13 | internal void* AllocationBase; 14 | internal uint AllocationProtect; 15 | internal UIntPtr RegionSize; 16 | internal uint State; 17 | internal uint Protect; 18 | internal uint Type; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/MINMAXINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace DirectUI.Win32.Struct 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | internal struct MINMAXINFO 9 | { 10 | internal Point reserved; 11 | internal Size maxSize; 12 | internal Point maxPosition; 13 | internal Size minTrackSize; 14 | internal Size maxTrackSize; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/MOUSEHOOKSTRUCT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct MOUSEHOOKSTRUCT 8 | { 9 | internal POINT Pt; 10 | internal IntPtr hwnd; 11 | internal uint wHitTestCode; 12 | internal IntPtr dwExtraInfo; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/MOUSEHOOKSTRUCTEX.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal class MOUSEHOOKSTRUCTEX 8 | { 9 | internal MOUSEHOOKSTRUCT Mouse; 10 | internal int mouseData; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/NCCALCSIZE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct NCCALCSIZE_PARAMS 8 | { 9 | internal RECT rcNewWindow; //Proposed New Window Coordinates 10 | internal RECT rcOldWindow; //Original Window Coordinates (before resize/move) 11 | internal RECT rcClient; //Original Client Area (before resize/move) 12 | internal IntPtr lppos; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/NMCUSTOMDRAW.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct NMCUSTOMDRAW 8 | { 9 | internal NMHDR hdr; 10 | internal uint dwDrawStage; 11 | internal IntPtr hdc; 12 | internal RECT rc; 13 | internal IntPtr dwItemSpec; 14 | internal uint uItemState; 15 | internal IntPtr lItemlParam; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/NMHDR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct NMHDR 8 | { 9 | internal NMHDR(int flag) 10 | { 11 | this.hwndFrom = IntPtr.Zero; 12 | this.idFrom = 0; 13 | this.code = 0; 14 | } 15 | 16 | internal IntPtr hwndFrom; 17 | internal int idFrom; 18 | internal int code; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/NMTTCUSTOMDRAW.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct NMTTCUSTOMDRAW 8 | { 9 | internal NMCUSTOMDRAW nmcd; 10 | internal uint uDrawFlags; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/NMTTDISPINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct NMTTDISPINFO 8 | { 9 | internal NMTTDISPINFO(int flags) 10 | { 11 | this.hdr = new NMHDR(0); 12 | this.lpszText = IntPtr.Zero; 13 | this.szText = IntPtr.Zero; 14 | this.hinst = IntPtr.Zero; 15 | this.uFlags = 0; 16 | this.lParam = IntPtr.Zero; 17 | } 18 | 19 | internal NMHDR hdr; 20 | internal IntPtr lpszText; 21 | internal IntPtr szText; 22 | internal IntPtr hinst; 23 | internal int uFlags; 24 | internal IntPtr lParam; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/OFNOTIFY.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | 10 | [StructLayout(LayoutKind.Sequential)] 11 | internal struct OFNOTIFY 12 | { 13 | internal NMHDR hdr; 14 | internal IntPtr OpenFileName; 15 | internal IntPtr fileNameShareViolation; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/OSVERSIONINFOEX.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 10 | internal struct OSVERSIONINFOEX 11 | { 12 | internal static int SizeOf 13 | { 14 | get 15 | { 16 | return Marshal.SizeOf(typeof(OSVERSIONINFOEX)); 17 | } 18 | } 19 | 20 | internal uint dwOSVersionInfoSize; 21 | internal uint dwMajorVersion; 22 | internal uint dwMinorVersion; 23 | internal uint dwBuildNumber; 24 | internal uint dwPlatformId; 25 | 26 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] 27 | internal string szCSDVersion; 28 | 29 | internal ushort wServicePackMajor; 30 | 31 | internal ushort wServicePackMinor; 32 | internal ushort wSuiteMask; 33 | internal byte wProductType; 34 | internal byte wReserved; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/OVERLAPPED.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct OVERLAPPED 11 | { 12 | internal UIntPtr Internal; 13 | internal UIntPtr InternalHigh; 14 | internal uint Offset; 15 | internal uint OffsetHigh; 16 | internal IntPtr hEvent; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/PAINTSTRUCT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace DirectUI.Win32.Struct 7 | { 8 | [StructLayout(LayoutKind.Sequential)] 9 | internal struct PAINTSTRUCT 10 | { 11 | internal IntPtr hdc; 12 | internal bool fErase; 13 | // rcPaint was a by-value RECT structure 14 | internal int rcPaint_left; 15 | internal int rcPaint_top; 16 | internal int rcPaint_right; 17 | internal int rcPaint_bottom; 18 | internal bool fRestore; 19 | internal bool fIncUpdate; 20 | internal int reserved1; 21 | internal int reserved2; 22 | internal int reserved3; 23 | internal int reserved4; 24 | internal int reserved5; 25 | internal int reserved6; 26 | internal int reserved7; 27 | internal int reserved8; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/PCURSORINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | 5 | namespace DirectUI.Win32.Struct 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | internal class PCURSORINFO 9 | { 10 | internal int cbSize; 11 | internal int flag; 12 | internal IntPtr hCursor; 13 | internal POINT ptScreenPos; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/POINT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct POINT 8 | { 9 | internal int X; 10 | internal int Y; 11 | 12 | internal POINT(int x, int y) 13 | { 14 | X = x; 15 | Y = y; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/PROCESS_INFORMATION.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct PROCESS_INFORMATION 11 | { 12 | internal IntPtr hProcess; 13 | internal IntPtr hThread; 14 | internal uint dwProcessId; 15 | internal uint dwThreadId; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/PROPERTYKEY.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential, Pack = 4)] 10 | internal struct PROPERTYKEY 11 | { 12 | internal Guid fmtid; 13 | internal uint pid; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/RECT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Drawing; 4 | 5 | namespace DirectUI.Win32.Struct 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | internal struct RECT 9 | { 10 | internal int Left; 11 | internal int Top; 12 | internal int Right; 13 | internal int Bottom; 14 | 15 | internal RECT(int left, int top, int right, int bottom) 16 | { 17 | Left = left; 18 | Top = top; 19 | Right = right; 20 | Bottom = bottom; 21 | } 22 | 23 | internal RECT(Rectangle rect) 24 | { 25 | Left = rect.Left; 26 | Top = rect.Top; 27 | Right = rect.Right; 28 | Bottom = rect.Bottom; 29 | } 30 | 31 | internal Rectangle Rect 32 | { 33 | get 34 | { 35 | return new Rectangle( 36 | Left, 37 | Top, 38 | Right - Left, 39 | Bottom - Top); 40 | } 41 | } 42 | 43 | internal Size Size 44 | { 45 | get 46 | { 47 | return new Size(Right - Left, Bottom - Top); 48 | } 49 | } 50 | 51 | internal static RECT FromXYWH( 52 | int x, int y, int width, int height) 53 | { 54 | return new RECT(x, 55 | y, 56 | x + width, 57 | y + height); 58 | } 59 | 60 | internal static RECT FromRectangle(Rectangle rect) 61 | { 62 | return new RECT(rect.Left, 63 | rect.Top, 64 | rect.Right, 65 | rect.Bottom); 66 | } 67 | 68 | internal uint Width 69 | { 70 | get { return (uint)Math.Abs(Right - Left); } 71 | set { Right = Left + (int)value; } 72 | } 73 | 74 | internal uint Height 75 | { 76 | get { return (uint)Math.Abs(Bottom - Top); } 77 | set { Bottom = Top + (int)value; } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/RGBQUAD.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct RGBQUAD 11 | { 12 | internal byte rgbBlue; 13 | internal byte rgbGreen; 14 | internal byte rgbRed; 15 | internal byte rgbReserved; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/RGNDATA.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct RGNDATA 11 | { 12 | internal RGNDATAHEADER rdh; 13 | 14 | internal unsafe static RECT* GetRectsPointer(RGNDATA* me) 15 | { 16 | return (RECT*)((byte*)me + sizeof(RGNDATAHEADER)); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/RGNDATAHEADER.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct RGNDATAHEADER 11 | { 12 | internal uint dwSize; 13 | internal uint iType; 14 | internal uint nCount; 15 | internal uint nRgnSize; 16 | internal RECT rcBound; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/SCROLLBARINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct SCROLLBARINFO 8 | { 9 | internal int cbSize; 10 | internal RECT rcScrollBar; 11 | internal int dxyLineButton; 12 | internal int xyThumbTop; 13 | internal int xyThumbBottom; 14 | internal int reserved; 15 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] 16 | internal int[] rgstate; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/SCROLLINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct SCROLLINFO 8 | { 9 | internal uint cbSize; 10 | internal uint fMask; 11 | internal int nMin; 12 | internal int nMax; 13 | internal uint nPage; 14 | internal int nPos; 15 | internal int nTrackPos; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/SHELLEXECUTEINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct SHELLEXECUTEINFO 11 | { 12 | internal uint cbSize; 13 | internal uint fMask; 14 | internal IntPtr hwnd; 15 | [MarshalAs(UnmanagedType.LPTStr)] 16 | internal string lpVerb; 17 | [MarshalAs(UnmanagedType.LPTStr)] 18 | internal string lpFile; 19 | [MarshalAs(UnmanagedType.LPTStr)] 20 | internal string lpParameters; 21 | [MarshalAs(UnmanagedType.LPTStr)] 22 | internal string lpDirectory; 23 | internal int nShow; 24 | internal IntPtr hInstApp; 25 | internal IntPtr lpIDList; 26 | [MarshalAs(UnmanagedType.LPTStr)] 27 | internal string lpClass; 28 | internal IntPtr hkeyClass; 29 | internal uint dwHotKey; 30 | internal IntPtr hIcon_or_hMonitor; 31 | internal IntPtr hProcess; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/SIZE.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct SIZE 8 | { 9 | internal int Width; 10 | internal int Height; 11 | 12 | internal SIZE(int width, int height) 13 | { 14 | Width = width; 15 | Height = height; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/SP_DEVINFO_DATA.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct SP_DEVINFO_DATA 11 | { 12 | internal uint cbSize; 13 | internal Guid ClassGuid; 14 | internal uint DevInst; 15 | internal UIntPtr Reserved; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/STYLESTRUCT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct STYLESTRUCT 8 | { 9 | internal int styleOld; 10 | internal int styleNew; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/SYSTEM_INFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct SYSTEM_INFO 11 | { 12 | internal ushort wProcessorArchitecture; 13 | internal ushort wReserved; 14 | internal uint dwPageSize; 15 | internal IntPtr lpMinimumApplicationAddress; 16 | internal IntPtr lpMaximumApplicationAddress; 17 | internal UIntPtr dwActiveProcessorMask; 18 | internal uint dwNumberOfProcessors; 19 | internal uint dwProcessorType; 20 | internal uint dwAllocationGranularity; 21 | internal ushort wProcessorLevel; 22 | internal ushort wProcessorRevision; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/TCHITTESTINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Runtime.InteropServices; 4 | using DirectUI.Win32.Const; 5 | 6 | namespace DirectUI.Win32.Struct 7 | { 8 | [StructLayout(LayoutKind.Sequential)] 9 | internal struct TCHITTESTINFO 10 | { 11 | 12 | internal TCHITTESTINFO(Point location) 13 | { 14 | Point = location; 15 | Flags = TCHT.TCHT_ONITEM; 16 | } 17 | 18 | internal Point Point; 19 | internal int Flags; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/TOOLINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct TOOLINFO 8 | { 9 | internal TOOLINFO(int flags) 10 | { 11 | this.cbSize = Marshal.SizeOf(typeof(TOOLINFO)); 12 | this.uFlags = flags; 13 | this.hwnd = IntPtr.Zero; 14 | this.uId = IntPtr.Zero; 15 | this.rect = new RECT(0, 0, 0, 0); 16 | this.hinst = IntPtr.Zero; 17 | this.lpszText = IntPtr.Zero; 18 | this.lParam = IntPtr.Zero; 19 | } 20 | 21 | internal int cbSize; 22 | internal int uFlags; 23 | internal IntPtr hwnd; 24 | internal IntPtr uId; 25 | internal RECT rect; 26 | internal IntPtr hinst; 27 | internal IntPtr lpszText; 28 | internal IntPtr lParam; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/TRACKMOUSEEVENT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct TRACKMOUSEEVENT 8 | { 9 | internal uint cbSize; 10 | internal uint dwFlags; 11 | internal IntPtr hwndTrack; 12 | internal uint dwHoverTime; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/TT_HITTESTINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct TT_HITTESTINFO 8 | { 9 | internal IntPtr hwnd; 10 | internal POINT pt; 11 | internal TOOLINFO ti; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/UPDATELAYEREDWINDOWINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace DirectUI.Win32.Struct 8 | { 9 | [StructLayout(LayoutKind.Sequential)] 10 | internal struct UPDATELAYEREDWINDOWINFO 11 | { 12 | internal Int32 _cbSize; 13 | internal IntPtr _hdcDst; 14 | internal POINT _pptDst; 15 | internal SIZE _psize; 16 | internal IntPtr _hdcSrc; 17 | internal POINT _pptSrc; 18 | internal Int32 _crKey; 19 | internal BLENDFUNCTION _pblend; 20 | internal Int32 _dwFlags; 21 | internal RECT _prcDirty; 22 | internal UPDATELAYEREDWINDOWINFO(Int32 cbSize, IntPtr hdcDst, ref POINT pptDst, ref SIZE psize, IntPtr hdcSrc, ref POINT pptSrc, Int32 crKey, ref BLENDFUNCTION pblend, Int32 dwFlags, ref RECT prcDirty) 23 | { 24 | _cbSize = cbSize; 25 | _hdcDst = hdcDst; 26 | _pptDst = pptDst; 27 | _psize = psize; 28 | _hdcSrc = hdcSrc; 29 | _pptSrc = pptSrc; 30 | _crKey = crKey; 31 | _pblend = pblend; 32 | _dwFlags = dwFlags; 33 | _prcDirty = prcDirty; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/WINDOWINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct WINDOWINFO 8 | { 9 | internal UInt32 cbSize; 10 | internal RECT rcWindow; 11 | internal RECT rcClient; 12 | internal UInt32 dwStyle; 13 | internal UInt32 dwExStyle; 14 | internal UInt32 dwWindowStatus; 15 | internal UInt32 cxWindowBorders; 16 | internal UInt32 cyWindowBorders; 17 | internal IntPtr atomWindowType; 18 | internal UInt16 wCreatorVersion; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/WINDOWPLACEMENT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Drawing; 4 | 5 | namespace DirectUI.Win32.Struct 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | internal struct WINDOWPLACEMENT 9 | { 10 | internal int length; 11 | internal int flags; 12 | internal int showCmd; 13 | internal Point ptMinPosition; 14 | internal Point ptMaxPosition; 15 | internal RECT rcNormalPosition; 16 | internal static WINDOWPLACEMENT Default 17 | { 18 | get 19 | { 20 | WINDOWPLACEMENT structure = new WINDOWPLACEMENT(); 21 | structure.length = Marshal.SizeOf(structure); 22 | return structure; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUI/Win32/Struct/WINDOWPOS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace DirectUI.Win32.Struct 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct WINDOWPOS 8 | { 9 | internal IntPtr hWnd; 10 | internal IntPtr hWndInsertAfter; 11 | internal int x; 12 | internal int y; 13 | internal int cx; 14 | internal int cy; 15 | internal int flags; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DirectUI/Win32/WindowsType.cs: -------------------------------------------------------------------------------- 1 | namespace DirectUI.Win32 2 | { 3 | using System; 4 | 5 | internal enum WindowsType 6 | { 7 | None, 8 | Windows95, 9 | Windows98, 10 | WindowsME, 11 | WindowsNT4, 12 | Windows2K, 13 | WindowsXP, 14 | Windows2003, 15 | WindowsVista, 16 | Windows7 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /DirectUISample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29001.49 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DirectUI", "DirectUI\DirectUI.csproj", "{2D0DEEB3-1154-4BB9-BE82-6E57754DFA33}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DirectUISample", "DirectUISample\DirectUISample.csproj", "{4E029B75-5DA0-4AA6-937E-1D73B7BD8598}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {2D0DEEB3-1154-4BB9-BE82-6E57754DFA33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {2D0DEEB3-1154-4BB9-BE82-6E57754DFA33}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {2D0DEEB3-1154-4BB9-BE82-6E57754DFA33}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {2D0DEEB3-1154-4BB9-BE82-6E57754DFA33}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {4E029B75-5DA0-4AA6-937E-1D73B7BD8598}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {4E029B75-5DA0-4AA6-937E-1D73B7BD8598}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {4E029B75-5DA0-4AA6-937E-1D73B7BD8598}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {4E029B75-5DA0-4AA6-937E-1D73B7BD8598}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {899625ED-30DC-46AD-B26C-6CC4E1B6D766} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /DirectUISample/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /DirectUISample/FmCompositeSample_Cubes.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace DirectUISample 2 | { 3 | partial class FmCompositeSample_Cubes 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.duiNativeControl1 = new DirectUI.Core.DUINativeControl(); 32 | this.SuspendLayout(); 33 | // 34 | // duiNativeControl1 35 | // 36 | this.duiNativeControl1.Dock = System.Windows.Forms.DockStyle.Fill; 37 | this.duiNativeControl1.Location = new System.Drawing.Point(0, 0); 38 | this.duiNativeControl1.Name = "duiNativeControl1"; 39 | this.duiNativeControl1.Size = new System.Drawing.Size(800, 450); 40 | this.duiNativeControl1.TabIndex = 0; 41 | this.duiNativeControl1.Text = "duiNativeControl1"; 42 | // 43 | // FmCompositeSample 44 | // 45 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 46 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 47 | this.ClientSize = new System.Drawing.Size(800, 450); 48 | this.Controls.Add(this.duiNativeControl1); 49 | this.Name = "FmCompositeSample"; 50 | this.Text = "FmCompositeSample"; 51 | this.ResumeLayout(false); 52 | 53 | } 54 | 55 | #endregion 56 | 57 | private DirectUI.Core.DUINativeControl duiNativeControl1; 58 | } 59 | } -------------------------------------------------------------------------------- /DirectUISample/FmDUIControlDemo.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Common; 2 | using DirectUI.Core; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel; 6 | using System.Data; 7 | using System.Drawing; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | 13 | namespace DirectUISample 14 | { 15 | public partial class FmDUIControlDemo : Form 16 | { 17 | private DUIControl dUIControl = new DUIControl() { Width = 100, Height = 100, BackColor = Color.Blue }; 18 | public FmDUIControlDemo() 19 | { 20 | InitializeComponent(); 21 | this.duiNativeControl1.DUIControls.Add(dUIControl); 22 | dUIControl.Paint += (s, e) => 23 | { 24 | e.Graphics.DrawString("这里可以自己绘制\r\n也可以是背景图", dUIControl.Font, DUIBrushes.White, PointF.Empty); 25 | }; 26 | } 27 | 28 | private void nudX_ValueChanged(object sender, EventArgs e) 29 | { 30 | dUIControl.X = (float)nudX.Value; 31 | } 32 | 33 | private void nudY_ValueChanged(object sender, EventArgs e) 34 | { 35 | dUIControl.Y = (float)nudY.Value; 36 | } 37 | 38 | private void nudWidth_ValueChanged(object sender, EventArgs e) 39 | { 40 | dUIControl.Width = (float)nudWidth.Value; 41 | } 42 | 43 | private void nudHeight_ValueChanged(object sender, EventArgs e) 44 | { 45 | dUIControl.Height = (float)nudHeight.Value; 46 | } 47 | 48 | private void nudRotate_ValueChanged(object sender, EventArgs e) 49 | { 50 | dUIControl.Rotate = (float)nudRotate.Value; 51 | } 52 | 53 | private void nudSkewX_ValueChanged(object sender, EventArgs e) 54 | { 55 | dUIControl.SkewX = (float)nudSkewX.Value; 56 | } 57 | 58 | private void nudSkewY_ValueChanged(object sender, EventArgs e) 59 | { 60 | dUIControl.SkewY = (float)nudSkewY.Value; 61 | } 62 | 63 | private void nudScaleX_ValueChanged(object sender, EventArgs e) 64 | { 65 | dUIControl.ScaleX = (float)nudScaleX.Value; 66 | } 67 | 68 | private void nudScaleY_ValueChanged(object sender, EventArgs e) 69 | { 70 | dUIControl.ScaleY = (float)nudScaleY.Value; 71 | } 72 | 73 | private void nudBorder_ValueChanged(object sender, EventArgs e) 74 | { 75 | dUIControl.BorderWidth = (float)nudBorder.Value; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /DirectUISample/FmDUIScaleableControlDemo.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace DirectUISample 2 | { 3 | partial class FmDUIScaleableControlDemo 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.duiNativeControl1 = new DirectUI.Core.DUINativeControl(); 32 | this.SuspendLayout(); 33 | // 34 | // duiNativeControl1 35 | // 36 | this.duiNativeControl1.BackColor = System.Drawing.Color.CornflowerBlue; 37 | this.duiNativeControl1.Dock = System.Windows.Forms.DockStyle.Fill; 38 | this.duiNativeControl1.Location = new System.Drawing.Point(0, 0); 39 | this.duiNativeControl1.Name = "duiNativeControl1"; 40 | this.duiNativeControl1.Size = new System.Drawing.Size(800, 450); 41 | this.duiNativeControl1.TabIndex = 0; 42 | this.duiNativeControl1.Text = "duiNativeControl1"; 43 | // 44 | // FmDUIScaleableControlDemo 45 | // 46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 48 | this.ClientSize = new System.Drawing.Size(800, 450); 49 | this.Controls.Add(this.duiNativeControl1); 50 | this.Name = "FmDUIScaleableControlDemo"; 51 | this.Text = "FmDUIScaleableControlDemo"; 52 | this.ResumeLayout(false); 53 | 54 | } 55 | 56 | #endregion 57 | 58 | private DirectUI.Core.DUINativeControl duiNativeControl1; 59 | } 60 | } -------------------------------------------------------------------------------- /DirectUISample/FmDUIScaleableControlDemo.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Common; 2 | using DirectUI.Core; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel; 6 | using System.Data; 7 | using System.Drawing; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | 13 | namespace DirectUISample 14 | { 15 | public partial class FmDUIScaleableControlDemo : Form 16 | { 17 | public FmDUIScaleableControlDemo() 18 | { 19 | InitializeComponent(); 20 | DUIThreadSafeBitmapBrush backMeshBrush = new DUIThreadSafeBitmapBrush(new Size(20, 20), (g, s) => 21 | { 22 | using (DUISolidBrush brushMeshDark = new DUISolidBrush(Color.FromArgb(29, 29, 29))) 23 | using (DUISolidBrush brushMeshLight = new DUISolidBrush(Color.FromArgb(159, 159, 159))) 24 | { 25 | g.FillRectangle(brushMeshDark, new Rectangle(0, 0, 10, 10)); 26 | g.FillRectangle(brushMeshDark, new Rectangle(10, 10, 10, 10)); 27 | g.FillRectangle(brushMeshLight, new Rectangle(10, 0, 10, 10)); 28 | g.FillRectangle(brushMeshLight, new Rectangle(0, 10, 10, 10)); 29 | } 30 | }); 31 | DUIImage dUIImage = DUIImage.FromFile(@"Resources\1.jpg"); 32 | DUIScaleableControl dUIScaleableControl = new DUIScaleableControl() { Dock = DockStyle.Fill }; 33 | dUIScaleableControl.Paint += (s, e) => 34 | { 35 | backMeshBrush.Draw(e.Graphics, dUIScaleableControl.ScaleableBounds); 36 | e.Graphics.DrawImage(dUIImage, 0, 0); 37 | }; 38 | this.duiNativeControl1.DUIControls.Add(dUIScaleableControl); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /DirectUISample/FmDUIScrollableControlDemo.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace DirectUISample 2 | { 3 | partial class FmDUIScrollableControlDemo 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.duiNativeControl1 = new DirectUI.Core.DUINativeControl(); 32 | this.SuspendLayout(); 33 | // 34 | // duiNativeControl1 35 | // 36 | this.duiNativeControl1.BackColor = System.Drawing.Color.CornflowerBlue; 37 | this.duiNativeControl1.Dock = System.Windows.Forms.DockStyle.Fill; 38 | this.duiNativeControl1.Location = new System.Drawing.Point(0, 0); 39 | this.duiNativeControl1.Name = "duiNativeControl1"; 40 | this.duiNativeControl1.Size = new System.Drawing.Size(800, 450); 41 | this.duiNativeControl1.TabIndex = 0; 42 | this.duiNativeControl1.Text = "duiNativeControl1"; 43 | // 44 | // FmDUIScrollableControlDemo 45 | // 46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 48 | this.ClientSize = new System.Drawing.Size(800, 450); 49 | this.Controls.Add(this.duiNativeControl1); 50 | this.Name = "FmDUIScrollableControlDemo"; 51 | this.Text = "FmDUIScrollableControlDemo"; 52 | this.ResumeLayout(false); 53 | 54 | } 55 | 56 | #endregion 57 | 58 | private DirectUI.Core.DUINativeControl duiNativeControl1; 59 | } 60 | } -------------------------------------------------------------------------------- /DirectUISample/FmDUIScrollableControlDemo.cs: -------------------------------------------------------------------------------- 1 | using DirectUI.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace DirectUISample 13 | { 14 | public partial class FmDUIScrollableControlDemo : Form 15 | { 16 | public FmDUIScrollableControlDemo() 17 | { 18 | InitializeComponent(); 19 | DUIScrollableControl dUIScrollableControl = new DUIScrollableControl() { Dock = DockStyle.Fill, BackColor = Color.Violet }; 20 | this.duiNativeControl1.DUIControls.Add(dUIScrollableControl); 21 | for (int i = 0; i < 100; i++) 22 | { 23 | dUIScrollableControl.DUIControls.Add(new DUIControl() 24 | { 25 | X = i * 50, 26 | Y = i * 10, 27 | Width = 50, 28 | Height = 10, 29 | BackColor = Color.Yellow 30 | }); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /DirectUISample/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using DirectUI.Common; 11 | using DirectUI.Core; 12 | 13 | namespace DirectUISample 14 | { 15 | public partial class Form1 : Form 16 | { 17 | public Form1() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | new FmDUIControlDemo().ShowDialog(); 25 | } 26 | 27 | private void button2_Click(object sender, EventArgs e) 28 | { 29 | new FmDUIEditableControlDemo().ShowDialog(); 30 | } 31 | 32 | private void button3_Click(object sender, EventArgs e) 33 | { 34 | new FmDUIScaleableControlDemo().ShowDialog(); 35 | } 36 | 37 | private void button4_Click(object sender, EventArgs e) 38 | { 39 | new FmDUIScrollableControlDemo().ShowDialog(); 40 | } 41 | 42 | private void button5_Click(object sender, EventArgs e) 43 | { 44 | new FmCompositeSample_Cubes().ShowDialog(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /DirectUISample/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace DirectUISample 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// 应用程序的主入口点。 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DirectUISample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("DirectUISample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("DirectUISample")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("4e029b75-5da0-4aa6-937e-1d73b7bd8598")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DirectUISample/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DirectUISample.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DirectUISample/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DirectUISample/Resources/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/DirectUISample/Resources/1.jpg -------------------------------------------------------------------------------- /DirectUISample/Resources/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/DirectUISample/Resources/2.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #
DirectUI
2 | * DirectUI 是什么 3 | 百度百科:DirectUI意为直接在父窗口上绘图(Paint on parent dc directly)。即子窗口不以窗口句柄的形式创建(windowless),只是逻辑上的窗口,绘制在父窗口之上。微软的“DirectUI”技术广泛的应用于Windows XP,Vista,Windows 7,如浏览器左侧的TaskPanel,控制面板导航界面,Media Player播放器,即时通讯工具MSN Messager等。 4 | DirectUI好处在于可以很方便的构建高效,绚丽的,非常易于扩展的界面。国外如微软,国内如腾讯,百度等公司的客户端产品多采用这种方式来组织界面,从而很好的将界面和逻辑分离,同时易于实现各种超炫的界面效果如换色,换肤,透明等。 DirectUI 旨在满足客户端界面快速开发的需要,同时融入业界前沿的皮肤技术,为用户创建更加高效,专业的界面。 5 | * 我的DirectUI可以做什么? 6 | 当前的DirectUI库是基于directUI的基本思想,再组合上winform的原生控件构建方式然后封装Direct2D为GDI+的调用方式。只实现了基础控件DUIControl(控件类)、DUIEditableControl(可编辑组件)、DUIScaleableControl(可缩放组件)、DUIScrollableControl(可滚动组件)这四大类组件的封装。只要你有winform和GDI+的基础就可以轻易的驾驭这个库 7 | * 简单的构建代码如下: 8 | ```C# 9 | DUINativeControl dUINativeControl = new DUINativeControl() { Dock = DockStyle.Fill }; 10 | DUIControl dUIControl = new DUIControl(); 11 | public Form1() 12 | { 13 | InitializeComponent(); 14 | this.Controls.Add(dUINativeControl); 15 | dUINativeControl.DUIControls.Add(dUIControl); 16 | dUIControl.Paint += (s, e) => 17 | { 18 | e.Graphics.DrawString("随便写点", dUIControl.Font, DUIBrushes.Red, PointF.Empty); 19 | }; 20 | } 21 | 22 | ``` 23 | 简直和写Winform一毛一样有木有,就连调用Direct2d也像操作GDI+一样是不是? 24 | # 演示 25 | * DUIControl 26 | 27 | ![avatar](https://github.com/ft9788501/DirectUI/blob/master/SampleGif/DUIControl.gif?raw=true) 28 | 29 | * DUIEditableControl 30 | 31 | ![avatar](https://github.com/ft9788501/DirectUI/blob/master/SampleGif/DUIEditableControl.gif?raw=true) 32 | 33 | * DUIScaleableControl 34 | 35 | ![avatar](https://github.com/ft9788501/DirectUI/blob/master/SampleGif/DUIScaleableControl.gif?raw=true) 36 | 37 | * DUIScrollableControl 38 | 39 | ![avatar](https://github.com/ft9788501/DirectUI/blob/master/SampleGif/DUIScrollableControl.gif?raw=true) 40 | 41 | * Cubes 42 | 43 | ![avatar](https://github.com/ft9788501/DirectUI/blob/master/SampleGif/Cubes.gif?raw=true) 44 | 45 | -------------------------------------------------------------------------------- /SampleGif/Cubes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/SampleGif/Cubes.gif -------------------------------------------------------------------------------- /SampleGif/DUIControl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/SampleGif/DUIControl.gif -------------------------------------------------------------------------------- /SampleGif/DUIEditableControl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/SampleGif/DUIEditableControl.gif -------------------------------------------------------------------------------- /SampleGif/DUIScaleableControl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/SampleGif/DUIScaleableControl.gif -------------------------------------------------------------------------------- /SampleGif/DUIScrollableControl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-jiang-github/DirectUI/9f8dd2dc1015368eda203ed488b3ca7bf871ff28/SampleGif/DUIScrollableControl.gif --------------------------------------------------------------------------------