Doing Grafix-API-Calls on a UserForm in Excel

Hidiho,
long time no see.

Anyway, my Problem is:
I have to use Excel as a Frontend for a Database-App with an Access-DB as the Backbone.

I'm ignoring the Worksheets and stuff, since i'm "abusing" Excel as a VB-Client (Don't ask why i'm not using just VB --> Company-Thing).

So i have a UserForm, where i want to draw some Grafics (Lines, Circles and stuff). Since "UserForm" doesn't support any Graphic-Methods i have to resort to painting the "Windows"-Way, speak: Using API-Calls.

To paint the "Windows"-Way i must have a Device-Context, so with "FindWindow" i get the Window-Handle, and with GetDC(hWnd) i get a DC-Handle.

Now, with MoveToEx (for the Starting-Point) and some LineTo-Calls (All without Error-Message -> i checked the Return-Values) i've been doing some Graphics, i even put a "Me.Repaint"-Call in my Sub.

Problem: No Lines on my Form.

Did i miss something? I remember vaguely some things like Brush, Pen and such stuff.

Backcolor of "UserForm" is the Standard Windows-Grey, ForeColor is Black

DrawBuffer is set to 32000

Any Ideas?

Any Help is appreciated
------------------------------------------
Only stupidity of mankind and the universe
are infinite, but i'm not sure concerning
the universe. A. Einstein

Comments

  • Solved it. Blasted "ReleaseDC" was missing.

    : Hidiho,
    : long time no see.
    :
    : Anyway, my Problem is:
    : I have to use Excel as a Frontend for a Database-App with an
    : Access-DB as the Backbone.
    :
    : I'm ignoring the Worksheets and stuff, since i'm "abusing" Excel as
    : a VB-Client (Don't ask why i'm not using just VB --> Company-Thing).
    :
    : So i have a UserForm, where i want to draw some Grafics (Lines,
    : Circles and stuff). Since "UserForm" doesn't support any
    : Graphic-Methods i have to resort to painting the "Windows"-Way,
    : speak: Using API-Calls.
    :
    : To paint the "Windows"-Way i must have a Device-Context, so with
    : "FindWindow" i get the Window-Handle, and with GetDC(hWnd) i get a
    : DC-Handle.
    :
    : Now, with MoveToEx (for the Starting-Point) and some LineTo-Calls
    : (All without Error-Message -> i checked the Return-Values) i've been
    : doing some Graphics, i even put a "Me.Repaint"-Call in my Sub.
    :
    : Problem: No Lines on my Form.
    :
    : Did i miss something? I remember vaguely some things like Brush, Pen
    : and such stuff.
    :
    : Backcolor of "UserForm" is the Standard Windows-Grey, ForeColor is
    : Black
    :
    : DrawBuffer is set to 32000
    :
    : Any Ideas?
    :
    : Any Help is appreciated
    : ------------------------------------------
    : Only stupidity of mankind and the universe
    : are infinite, but i'm not sure concerning
    : the universe. A. Einstein

    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion