Re: NotSupportException caused by DrawString

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Serg Kuryata [MS] (sergeyk_at_online.microsoft.com)
Date: 07/16/04


Date: Fri, 16 Jul 2004 22:10:20 GMT

Yes, Tim is correct. The Font property is not supported by the PictureBox
control.

Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM>
| References: <61F61207-A9CB-4E7B-B12C-C4E82F425B64@microsoft.com>
<OQjprJLZEHA.1152@TK2MSFTNGP09.phx.gbl>
<A93A3D55-2C57-4442-8B20-4B80251A26EF@microsoft.com>
| Subject: Re: NotSupportException caused by DrawString
| Date: Thu, 8 Jul 2004 08:25:37 -0400
| Lines: 83
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
| Message-ID: <#Yv9eaOZEHA.716@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host:
cpe00045af65bf7-cm014210012048.cpe.net.cable.rogers.com 24.103.185.244
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXS01.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:56916
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| The actual issue is with getting and setting the Font property. It looks
| like it's not supported for the PictureBox. If you create your own
property
| to store the font it should work. Add the code below to your PicBody
class.
|
| Private _Font As Font = New Font("Tahoma", 8, FontStyle.Regular)
|
| Public Overrides Property Font() As System.Drawing.Font
| Get
| Return _Font
| End Get
| Set(ByVal Value As System.Drawing.Font)
| _Font = Value
| End Set
| End Property
|
| --
| Tim Wilson
| .Net Compact Framework MVP
|
| "Kempton" <Kempton@discussions.microsoft.com> wrote in message
| news:A93A3D55-2C57-4442-8B20-4B80251A26EF@microsoft.com...
| > Public Class PicBody
| > Inherits System.Windows.Forms.PictureBox
| >
| > Private xArr() As Integer = {-1, -1, -1, -1, -1, -1} 'the
| x-coordinates of all nodes
| > Private yArr() As Integer = {-1, -1, -1, -1, -1, -1} 'the
| y-coordinates of all nodes
| >
| >
| > Protected Overrides Sub onPaint(ByVal e As
| System.Windows.Forms.PaintEventArgs)
| > e.Graphics.DrawImage(Me.Image, 0, 0) 'show the body
picture
| > Dim b As New SolidBrush(Color.Red)
| >
| > Dim i As Integer
| > For i = 0 To xArr.Length - 1
| > If xArr(i) >= 0 And yArr(i) >= 0 Then
| > e.Graphics.FillEllipse(b, xArr(i), yArr(i), 5, 5)
| > Dim s As String
| > If i = 0 Then
| > s = "Primary"
| > Else
| > s = "Node " & i.ToString
| > End If
| > 'e.Graphics.DrawString(s, Font, b, (xArr(i) + 10),
| yArr(i))
| > End If
| > Next
| >
| > b.Dispose()
| > End Sub
| >
| >
| > Public Sub setNode(ByVal nodeNum As Integer, ByVal x As Integer,
ByVal
| y As Integer)
| > If nodeNum < xArr.Length Then
| > xArr(nodeNum) = x
| > yArr(nodeNum) = y
| > End If
| > End Sub
| > End Class
| >
| > "Tim Wilson" wrote:
| >
| > > Can you post the complete code for your OnPaint method?
| > >
| > > --
| > > Tim Wilson
| > > ..Net Compact Framework MVP
| > >
| > > "Kempton" <Kempton@discussions.microsoft.com> wrote in message
| > > news:61F61207-A9CB-4E7B-B12C-C4E82F425B64@microsoft.com...
| > > > I create a custom control which inherits Picturebox. the
| > > e.Graphics.DrawString in the OnPaint method causes a
| NotSupportedException.
| > > >
| > > > Could anyone help?
| > >
| > >
| > >
|
|
|



Relevant Pages

  • Re: Height limitation of picturebox
    ... There is another picturebox called (picScroll). ... Now for every font I will create another picture box ... Private Sub Form_Load ...
    (microsoft.public.vb.general.discussion)
  • Re: NotSupportException caused by DrawString
    ... The actual issue is with getting and setting the Font property. ... Protected Overrides Sub onPaint(ByVal e As ... > "Tim Wilson" wrote: ... >>> I create a custom control which inherits Picturebox. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: New Python.org website ?
    ... Thanks Tim!! ... When I crank the font rather ... When I crank the font-size up larger, ... the body is larger than the basefont size of the menu. ...
    (comp.lang.python)
  • Re: Two Word behaviors Id like to change if possible
    ... >> Hi Tim - ... >>> one just launched opens. ... >>> change the font or bold or change font color for the selected text, ...
    (microsoft.public.word.newusers)
  • Re: Translation Please
    ... >>K' Tim, ... >>If it came out as Thai characters I'd be able to help you. ... >You may need to change the font to a Thai font if you see text with ... Usenet Zone Free Binaries Usenet Server ...
    (soc.culture.thai)