Home All Groups Group Topic Archive Search About

how can I reference this bitmap?????????

Author
13 Dec 2006 6:28 PM
Marc
Guys the below code is not working ( i know i am trying to reference a
function!) .

Im a beginner so does anyone know how i could reference the bitmap?



Private Sub MarkVORToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MarkVORToolStripMenuItem.Click
        If ContextMenuStrip1.SourceControl.BackgroundImage Is
DrawCross() Then
       msgbox("test")
    End Sub

    Friend Function DrawCross() As Bitmap
        Dim sampleBitmap As New Bitmap(32, 32)
        Dim g As Graphics = Graphics.FromImage(sampleBitmap)
        Dim p As New Pen(ProfessionalColors.ButtonPressedBorder)
        p.Color = Color.Red
        Try
            p.Width = 2
            g.DrawLine(p, -35, 65, 80, -45)
            g.DrawLine(p, 200, 200, 0, 0)
        Finally
            p.Dispose()
        End Try
        Return sampleBitmap
    End Function

Author
13 Dec 2006 9:08 PM
Herfried K. Wagner [MVP]
"Marc" <marc_cro***@hotmail.com> schrieb:
> Guys the below code is not working ( i know i am trying to reference a
> function!) .
>
> Im a beginner so does anyone know how i could reference the bitmap?

\\\
Private m_Cross As Bitmap

Public Sub New()
    m_Cross = DrawCross()
End Sub

> Private Sub MarkVORToolStripMenuItem_Click(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles
> MarkVORToolStripMenuItem.Click
>        If ContextMenuStrip1.SourceControl.BackgroundImage Is
> DrawCross() Then

Replace the line above with this:

\\\
If ContextMenuStrip1.SourceControl.BackgroundImage Is m_Cross Then
    ...
End If
///

Show quoteHide quote
>    End Sub
>
>    Friend Function DrawCross() As Bitmap
>        Dim sampleBitmap As New Bitmap(32, 32)
> [...]

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
14 Dec 2006 8:39 AM
Marc
Thanks Herfried....

your a star!


Herfried K. Wagner [MVP] wrote:
Show quoteHide quote
> "Marc" <marc_cro***@hotmail.com> schrieb:
> > Guys the below code is not working ( i know i am trying to reference a
> > function!) .
> >
> > Im a beginner so does anyone know how i could reference the bitmap?
>
> \\\
> Private m_Cross As Bitmap
>
> Public Sub New()
>     m_Cross = DrawCross()
> End Sub
>
> > Private Sub MarkVORToolStripMenuItem_Click(ByVal sender As
> > System.Object, ByVal e As System.EventArgs) Handles
> > MarkVORToolStripMenuItem.Click
> >        If ContextMenuStrip1.SourceControl.BackgroundImage Is
> > DrawCross() Then
>
> Replace the line above with this:
>
> \\\
> If ContextMenuStrip1.SourceControl.BackgroundImage Is m_Cross Then
>     ...
> End If
> ///
>
> >    End Sub
> >
> >    Friend Function DrawCross() As Bitmap
> >        Dim sampleBitmap As New Bitmap(32, 32)
> > [...]
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
15 Dec 2006 12:06 AM
Herfried K. Wagner [MVP]
"Marc" <marc_cro***@hotmail.com> schrieb:
> Thanks Herfried....
>
> your a star!

You are welcome!

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>