Click here to Skip to main content
15,921,606 members
Home / Discussions / C#
   

C#

 
QuestionModal Popup (TCartwright's) Pin
stormcandi11-Jun-07 9:22
stormcandi11-Jun-07 9:22 
AnswerRe: Modal Popup (TCartwright's) Pin
Not Active11-Jun-07 9:28
mentorNot Active11-Jun-07 9:28 
GeneralRe: Modal Popup (TCartwright's) Pin
stormcandi11-Jun-07 9:31
stormcandi11-Jun-07 9:31 
QuestionGraphic - Exact string sizes Pin
skuggbo11-Jun-07 9:13
skuggbo11-Jun-07 9:13 
AnswerRe: Graphic - Exact string sizes Pin
Not Active11-Jun-07 9:31
mentorNot Active11-Jun-07 9:31 
GeneralRe: Graphic - Exact string sizes Pin
skuggbo11-Jun-07 10:14
skuggbo11-Jun-07 10:14 
GeneralRe: Graphic - Exact string sizes Pin
Luc Pattyn11-Jun-07 10:39
sitebuilderLuc Pattyn11-Jun-07 10:39 
AnswerRe: Graphic - Exact string sizes Pin
J. Dunlap11-Jun-07 13:13
J. Dunlap11-Jun-07 13:13 
There's MeasureCharacterRanges but it's a pain, buggy, and slow. I wrote a textbox control from scratch, and used the GetCharacterPlacement[^] GDI API. For your convenience:
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern int GetCharacterPlacementW(IntPtr dev, string text, int count, 
                           int max, [In, Out] ref GCP_RESULTS results, GcpFlags flags);

[Flags]
internal enum GcpFlags // Win32: GCP_xxx flags, WinGDI.h
{
    DBCS = 0x00000001,
    ReOrder = 0x00000002,
    UseKerning = 0x00000008,
    GlyphShape = 0x00000010,
    Ligate = 0x00000020,
    Diacritic = 0x00000100,
    Kashida = 0x00000400,
    Error = 0x00008000,
    Justify = 0x00010000,
    FliGlyphs = 0x00040000,
    ClassIn = 0x00080000,
    MaxExtent = 0x00100000,
    JustifyIn = 0x00200000,
    DisplayZWG = 0x00400000,
    SymSwapOff = 0x00800000,
    NumericOverride = 0x01000000,
    NeutralOverride = 0x02000000,
    NumericsLatin = 0x04000000,
    NumericsLocal = 0x08000000,

    FliMask = 0x0000103B
}

[StructLayout(LayoutKind.Sequential)]
internal struct GCP_RESULTS
{
    internal int lStructSize;
    [MarshalAs(UnmanagedType.LPTStr)]
    internal string lpOutString;
    internal IntPtr lpOrder;
    internal IntPtr lpDx;
    internal IntPtr lpCaretPos;
    internal IntPtr lpClass;
    internal IntPtr lpGlyphs;
    internal int nGlyphs;
    internal int nMaxFit;
}


[EDIT: Oh, duh - I forgot: I used a hack that allowed me to use DrawDriverString() GDI+ function to draw the text in the resulting character positions, even though it is not made available in System.Drawing. This is sounding more like material for a whole article, not a single post... hmm. More on this when I get a chance...]


v>
QuestionEvent Firing Pin
tobriain11-Jun-07 8:13
tobriain11-Jun-07 8:13 
AnswerRe: Event Firing Pin
Luc Pattyn11-Jun-07 9:15
sitebuilderLuc Pattyn11-Jun-07 9:15 
GeneralRe: Event Firing Pin
tobriain11-Jun-07 10:11
tobriain11-Jun-07 10:11 
GeneralRe: Event Firing Pin
Luc Pattyn11-Jun-07 10:36
sitebuilderLuc Pattyn11-Jun-07 10:36 
GeneralRe: Event Firing Pin
Leslie Sanford11-Jun-07 10:53
Leslie Sanford11-Jun-07 10:53 
GeneralRe: Event Firing Pin
tobriain11-Jun-07 11:21
tobriain11-Jun-07 11:21 
GeneralRe: Event Firing Pin
Leslie Sanford11-Jun-07 12:03
Leslie Sanford11-Jun-07 12:03 
QuestionActive Directory - logonhours Pin
Runtorious11-Jun-07 8:06
Runtorious11-Jun-07 8:06 
QuestionDatagrid rows Pin
md_refay11-Jun-07 7:58
md_refay11-Jun-07 7:58 
QuestionCPU load for spesific proccess Pin
crash89311-Jun-07 7:58
crash89311-Jun-07 7:58 
AnswerRe: CPU load for spesific proccess Pin
Luc Pattyn11-Jun-07 8:07
sitebuilderLuc Pattyn11-Jun-07 8:07 
GeneralRe: CPU load for spesific proccess Pin
crash89311-Jun-07 15:31
crash89311-Jun-07 15:31 
Question.NET documentor Pin
HexaDeveloper11-Jun-07 5:35
HexaDeveloper11-Jun-07 5:35 
AnswerRe: .NET documentor Pin
Joseph Guadagno11-Jun-07 16:32
Joseph Guadagno11-Jun-07 16:32 
Questiontransparent background Pin
bDreea11-Jun-07 4:22
bDreea11-Jun-07 4:22 
AnswerRe: transparent background Pin
Hesham Yassin11-Jun-07 6:35
Hesham Yassin11-Jun-07 6:35 
QuestionHow add multiple icons Pin
Mark F.11-Jun-07 4:03
Mark F.11-Jun-07 4:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.