import microsoft.directx as dx
import microsoft.directx.direct3d as dx3d
dim viewFont as DX.Font
viewFont = new DX.Font (device, Arial, 12 point) <-- can't remember exact
syntax
-------------------------------
from MSDN (the 5th and 6th ones are the problem)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_m/
directx/ref/ns/microsoft.directx.direct3d/c/font/m/drawtext.asp
---------------------------------
Note: This documentation is preliminary and is subject to change.
Draws formatted text.
Overload List
public int DrawText(Sprite, string, int, int, Color);
public int DrawText(Sprite, string, int, int, int);
public int DrawText(Sprite, string, Point, Color);
public int DrawText(Sprite, string, Point, int);
public int DrawText(Sprite, string, ref Rectangle, DrawTextFormat,
Color);
public int DrawText(Sprite, string, Rectangle, DrawTextFormat,
Color);
public int DrawText(Sprite, string, ref Rectangle, DrawTextFormat,
int);
public int DrawText(Sprite, string, Rectangle, DrawTextFormat, int);
Remarks
This method must be called from inside of a Device.BeginScene ...
Device.EndScene block.
Unless the NoClip format is used, this method clips the text so that it
does not appear outside of the specified rectangle. All formatting is
assumed to have multiple lines unless the SingleLine format is specified.
If the selected font is too large for the rectangle, this method does not
attempt to substitute a smaller font.
This method supports only fonts whose escapement and orientation are both
zero.
--------------------------------------------------------------------------
--
----
"Jay B. Harlow [MVP - Outlo
ok] said:
DF,
What type of object is viewFont (its Dim statement)?
As I stated, VB.NET does not allow you to define them, nor use them (if C#,
C++ or other language happens to define them!).
The reason VB.NET does not support them is they are not CLS compliant (as
you are finding out).
Hope this helps
Jay
DF said:
Hi Jay,
This is the code:
batchSprite.Begin(DX3D.SpriteFlags.AlphaBlend Or _
DX3D.SpriteFlags.SortTexture)
Dim rect As New System.Drawing.Rectangle(5, 5, 0, 0)
viewFont.DrawText(batchSprite, _
Convert.ToString(Val), _
rect, _
DX3D.DrawTextFormat.NoClip, _
System.Drawing.Color.Yellow)
batchSprite.End()
I'm using Visual Studio 2003. The viewFont.DrawText code above has the blue
squiggly lines underneath. When I mouseover it, I get a yellow box that
basically says "overload resolution failed. No accessible
'DrawText' is most specific." message. There are two options in the
box.
One
contains a ByRef rect and the other ByVal rect. Since I can't figure
out
how
to tell VB which one to use, I can't compile the code.
Any advice?
Thanks for you time,
DF
DF,
You cannot override a method based on ByRef & ByVal, you will get a
compile
error on one of the methods themselves. Primarily because VB.NET
does
not
have a construct to specify which one to use.
Where & How is DrawText defined that you managed to get both ByRef & ByVal
overloads?
Hope this helps
Jay
DrawText is overloaded - one of which accepts a ByVal rect and the other
accepts a ByRef rect. I get a "no accessible 'DrawText' is most specific"
error. How can I resolve this problem by forcing VB to recognize the
one
I
want?
Any help would be greatly appreciated.
DF