wie kann man den pen ändern?



  • hi. ich arbeite mit c und winapi, bin aber verdammt schlecht was so grafikgeschichten angeht. deshalb hoffe ich, jemand von euch kann mir verraten, wie man den pen verändert. also die farbe setzen und auch einen unsichtbaren pen erzeugen (wenn das überhaupt geht).

    danke



  • MSDN schrieb:

    CreatePenIndirect
    The CreatePenIndirect function creates a logical cosmetic pen that has the style, width, and color specified in a structure.

    HPEN CreatePenIndirect(
    CONST LOGPEN *lplgpn // pointer to LOGPEN structure
    );

    Parameters
    lplgpn
    Pointer to the LOGPEN structure that specifies the pen's style, width, and color.
    Return Values
    If the function succeeds, the return value is a handle that identifies a logical cosmetic pen.

    If the function fails, the return value is NULL.

    Windows NT: To get extended error information, callGetLastError.

    Remarks
    After an application creates a logical pen, it can select that pen into a device context by calling the SelectObject function. After a pen is selected into a device context, it can be used to draw lines and curves.

    When you no longer need the pen, call the DeleteObject function to delete it.

    Windows CE: Windows CE only supports wide lines for solid pens. Windows CE does not support dotted or inside frame pens, nor does it support any user-specified endcap styles (for example, PS_ENDCAP_ROUND).

    QuickInfo
    Windows NT: Requires version 3.1 or later.
    Windows: Requires Windows 95 or later.
    Windows CE: Requires version 1.0 or later.
    Header: Declared in wingdi.h.
    Import Library: Use gdi32.lib.

    See Also
    Pens Overview, Pen Functions, CreatePen, DeleteObject, ExtCreatePen, GetObject, LOGPEN, RGB, SelectObject

    und

    MSDN schrieb:

    LOGPEN
    The LOGPEN structure defines the style, width, and color of a pen. The CreatePenIndirect function uses the LOGPEN structure.

    typedef struct tagLOGPEN {
    UINT lopnStyle;
    POINT lopnWidth;
    COLORREF lopnColor;
    } LOGPEN;

    Members
    lopnStyle
    Specifies the pen style, which can be one of the following values: Value Meaning
    PS_SOLID Pen is solid.
    PS_DASH Pen is dashed.
    PS_DOT Pen is dotted.
    PS_DASHDOT Pen has alternating dashes and dots.
    PS_DASHDOTDOT Pen has dashes and double dots.
    PS_NULL Pen is invisible.
    PS_INSIDEFRAME Pen is solid. When this pen is used in any graphics device interface (GDI) drawing function that takes a bounding rectangle, the dimensions of the figure are shrunk so that it fits entirely in the bounding rectangle, taking into account the width of the pen. This applies only to geometric pens.

    lopnWidth
    Specifies the POINT structure that contains the pen width, in logical units. If the pointer member is NULL, the pen is one pixel wide on raster devices. The y member in the POINT structure for lopnWidth is not used.
    lopnColor
    Specifies the pen color.
    Remarks
    If the width of the pen is greater than 1 and the pen style is PS_INSIDEFRAME, the line is drawn inside the frame of all GDI objects except polygons and polylines. If the pen color does not match an available red, green, blue (RGB) value, the pen is drawn with a logical (dithered) color. If the pen width is less than or equal to 1, the PS_INSIDEFRAME style is identical to the PS_SOLID style.

    QuickInfo
    Windows NT: Requires version 3.1 or later.
    Windows: Requires Windows 95 or later.
    Windows CE: Requires version 1.0 or later.
    Header: Declared in wingdi.h.

    See Also
    Pens Overview, Pen Structures, CreatePenIndirect, POINT, RGB



  • stimmt, eigentlich schaut man ins msdn. entschuldige, da hätt ich eigentlich selbst draufkommen müssen.

    dennoch danke fürs raussuchen. ich denke damit komme ich weiter 🙂



  • jule37 schrieb:

    stimmt, eigentlich schaut man ins msdn. entschuldige, da hätt ich eigentlich selbst draufkommen müssen.

    dennoch danke fürs raussuchen. ich denke damit komme ich weiter 🙂

    Einsicht ist immer ein großer Schritt 😃

    Kein Problem. 🙂


Anmelden zum Antworten