Hello, I am struggling at trying to get custom fonts working in my application. I have added the font file to the project's resources via the 'Add Existing File...' option, and setup the following code... > FontFamily standard; Font wt; > [DllImport("gdi32.dll", ExactSpelling = true)] private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts); private Font getWetDreamsFont() { byte[] theFont = Properties.Resources.Wet_Dreamz_Medium; int length = Properties.Resources.Wet_Dreamz_Medium.Length; IntPtr ptrData = Marshal.AllocCoTaskMem(length); Marshal.Copy(theFont, 0, ptrData, length); uint cFonts = 0; AddFontMemResourceEx(ptrData, (uint)theFont.Length, IntPtr.Zero, ref cFonts); PrivateFontCollection pfc = new PrivateFontCollection(); pfc.AddMemoryFont(ptrData, length); Marshal.FreeCoTaskMem(ptrData); standard = pfc.Families[0]; wt …

Member Avatar
Member Avatar
+0 forum 1

How to shrink the client area of a multiline textbox (Windows.Forms.Textbox) from the non-client area? That is I need to draw a focus line in-between verticalscrollbar and the text area of textbox (i.e line to be drawn inside textbox). So I need a space between the client area (typable area) and the scrollbar to draw the line. Any idea how to achieve this?

Member Avatar
Member Avatar
+0 forum 1

In my project, I have created around 12 custom controls(checkbox,radiobutton,editbox,progressbar,scrollbar,button etc...). Custom painting is done in all controls for the extended look and feel using Pen,Brushes,Graphics, GraphicPath,Images,Region and Bitmaps ect. After the use of these objects, I have disposed the objects using the Dispose() method. I am using these controls in a System.Windows Form. When I am contiously showing and closing the Form causes an increase in the GDI objecs each time. I have checked the GDI object count using Task Manager and confirmed the GDI leak in the form. My question is, how can I manage this GDI leak? …

Member Avatar
Member Avatar
+0 forum 3

The End.