Re: Make rectangle with managed D3D

From: Jeremy Kimball (jkimball_at_rochester.rr.com)
Date: 03/14/04


Date: Sun, 14 Mar 2004 18:54:55 GMT

You shouldn't need to lock the rectangle. Just grab the Graphics and draw,
then release the Graphics object.

"Valentin" <vbillotte@programmationworld.com> wrote in message
news:49a2fd46.0403140331.b4b559b@posting.google.com...
> Hi Everyone,
>
> I would like to draw a green rectangle on my back surface such as
> selection units in warcraft 3. I m now using LockRectangle with no
> problems.
> But the GetGraphics method fail.
>
>
> Here is a code snippet:
>
>
> BackSurface = device.GetBackBuffer(0, 0, BackBufferType.Mono);
>
> Rectangle dock=new Rectangle(new Point(0,0), new Size((int)this.width,
> (int)this.height));
>
>
> BackSurface.LockRectangle(LockFlags.None);
>
> Graphics g = this.backSurface.GetGraphics(); // Exception thrown here.
>
> g.DrawRectangle(System.Drawing.Pens.Green, 20, 20, 100, 100);
>
> BackSurface.ReleaseGraphics();
>
> BackSurface.UnlockRectangle();
>
>
>
> Can i resolve my problem?
>
> Thanks for your help
>
>
> Valentin



Relevant Pages

  • RE: GDI+ Clip Region allows 0.0f width pen to draw through
    ... Just to make this more outrageous if you draw the vertical lines from the ... I took the previous code I posted and made the panel anchor to all four ... private void panel1_SizeChanged ... In other words create a rectangle that is a wider than the panel. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: My earlier post was Horizontal Line
    ... The code below is the exact of my Report module. ... It can draw the table ... starting point for the line or rectangle. ... QBColor function to specify the color. ...
    (microsoft.public.access.formscoding)
  • Zero Width Pen Draws through clipped region...
    ... Exclude the rectangle from the graphics clip region. ... Draw a line down the panel. ... IF you use a pen that is more than one pixel the clipping works correctly. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Calculate the interior of a rectangle
    ... I expected them to draw from the ... native VB method to draw a small blue rectangle and the equivalent API ... Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ...
    (microsoft.public.vb.general.discussion)
  • RE: TreeView multiple selections
    ... But with this behavior I can't draw a node to normal after selecting twice ... .Net2.0 has added the build-in support for custom-draw. ... rectangle based on your requirement. ... Dim focusPen As New Pen ...
    (microsoft.public.dotnet.general)