Exemplo n.º 1
0
 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);
Exemplo n.º 2
0
        // 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);
        }
Exemplo n.º 3
0
 public static extern bool SetWindowExtEx([In] SafeHandle hdc, int nXExtent, int nYExtent,
    ref SIZE lpSize);
Exemplo n.º 4
0
 public static extern bool GetViewportExtEx([In] SafeHandle hdc, out SIZE lpSize);
Exemplo n.º 5
0
 public static extern bool GetWindowExtEx([In] SafeHandle hdc, out SIZE lpSize);
Exemplo n.º 6
0
        // 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;
        }
Exemplo n.º 7
0
 public static extern bool GetTextExtentPoint32([In] SafeHandle hDC, 
     [In] string lpString,
     int cbString, out SIZE lpSize);