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

M

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
 
H

Herfried K. Wagner [MVP]

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

Marc

Thanks Herfried....

your a star!

Marc said:
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)
[...]
 

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

Top