no accessible 'DrawText' is most specific

  • Thread starter Thread starter DF
  • Start date Start date
D

DF

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
 
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
 
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,
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
 
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
one
 
DF,
I'll do some checking.

Short answer, you cannot use those overloads in VB.NET.

Your choices are:
- Use C#
- Use one of the other overloads that are not overloaded on ByVal & ByRef.

Hope this helps
Jay

DF said:
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
 
DF,
I'm still checking, I just wanted to add:

Long answer, you cannot use those overloads in VB.NET, as the CLS (Common
Language System) which VB.NET adhers to, does not allow overloading on ByVal
& ByRef, as its ambiguous in languages that do not require ByRef (ref in C#)
on the method calls themselves. VB.NET only allows ByRef on the method
declaration.

I'll do some more checking if there is an alternative within VB.NET that you
can use, or you will have to use C#.

Hope this helps
Jay


DF said:
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
 
Thanks Jay.

I ended up using the one with the x and y and no DrawTextFormat.

Thanks so much for taking the time.

D


Jay B. Harlow said:
DF,
I'll do some checking.

Short answer, you cannot use those overloads in VB.NET.

Your choices are:
- Use C#
- Use one of the other overloads that are not overloaded on ByVal & ByRef.

Hope this helps
Jay

DF said:
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
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

--------------------------------------------------------------------------
--
----



"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


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top