public static extern int UpdateLayeredWindow(IntPtr hWnd, IntPtr hdcDst, ref POINT pptDst, ref SIZE psize, IntPtr hdcSrc, ref POINT pptSrc, uint crKey, ref BLENDFUNCTION pblend, uint dwFlags);
// Measure how wide and high the string is standing on its own /// <summary> /// This is the way to measure a string. /// </summary> /// <param name="aString"></param> /// <returns></returns> public System.Drawing.Size MeasureString(string aString) { // Create a screen context to do the measuring GDIContext dc = GDIContext.CreateForDefaultDisplay(); dc.SelectObject(this); SIZE aSize = new SIZE(); GDI32.GetTextExtentPoint32(dc, aString, aString.Length, out aSize); // Unselect the font from the DC // Destroy the DC // Return the size return new System.Drawing.Size(aSize.cx, aSize.cy); }
public static extern bool SetWindowExtEx([In] SafeHandle hdc, int nXExtent, int nYExtent, ref SIZE lpSize);
public static extern bool GetViewportExtEx([In] SafeHandle hdc, out SIZE lpSize);
public static extern bool GetWindowExtEx([In] SafeHandle hdc, out SIZE lpSize);
// get the combined world to device coordinate space mapping public bool GetDPtoLP(GDIContext hDC) { if (!GDI32.GetWorldTransform(hDC, out fMatrix)) return false; POINT origin = new POINT(); GDI32.GetWindowOrgEx(hDC, out origin); Translate(-(float)origin.X, -(float)origin.Y); SIZE sizew = new SIZE(); SIZE sizev = new SIZE(); GDI32.GetWindowExtEx(hDC, out sizew); GDI32.GetViewportExtEx(hDC, out sizev); Scale((float)sizew.Width / sizev.Height, (float)sizew.Height / sizev.Height); GDI32.GetViewportOrgEx(hDC, out origin); Translate((float)origin.X, (float)origin.Y); return true; }
public static extern bool GetTextExtentPoint32([In] SafeHandle hDC, [In] string lpString, int cbString, out SIZE lpSize);