473,320 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

The below snippet does not work...anyone know how to reference a procedure?


The below snippet does not work...anyone know how to reference the
procedure 'DrawCross()'?

Private Sub MarkVORToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MarkVORToolStripMenuItem.Click
If ContextMenuStrip1.SourceControl.BackgroundImage Is
DrawCross() Then
msgbocx("test")
End If
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

Dec 13 '06 #1
6 1049
Marc wrote:
The below snippet does not work...anyone know how to reference the
procedure 'DrawCross()'?
Every time you call DrawCross(), you're generating a new instance of a
bitmap. That will never be the same instance you assigned to the
BackgroundImage.

The "is" operator is not a bitmap comparison operator. (Unless you were to
overload it.)

How about making your own extended MyContextMenuStrip inherits from
ContextMenuStrip and has a String property you can set to change the
BackgroundImage? (My nomenclature may be wrong.)

Andrew
Private Sub MarkVORToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MarkVORToolStripMenuItem.Click
If ContextMenuStrip1.SourceControl.BackgroundImage Is
DrawCross() Then
msgbocx("test")
End If
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

Dec 13 '06 #2
Hi Andrew,

Could you give me an example of how i would do that?

Im sorry but im really a transport manager pretending to be a
programmer so my knowledge is basic!!!
Andrew Morton wrote:
Marc wrote:
The below snippet does not work...anyone know how to reference the
procedure 'DrawCross()'?

Every time you call DrawCross(), you're generating a new instance of a
bitmap. That will never be the same instance you assigned to the
BackgroundImage.

The "is" operator is not a bitmap comparison operator. (Unless you were to
overload it.)

How about making your own extended MyContextMenuStrip inherits from
ContextMenuStrip and has a String property you can set to change the
BackgroundImage? (My nomenclature may be wrong.)

Andrew
Private Sub MarkVORToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MarkVORToolStripMenuItem.Click
If ContextMenuStrip1.SourceControl.BackgroundImage Is
DrawCross() Then
msgbocx("test")
End If
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
Dec 13 '06 #3
Marc wrote:
Andrew Morton wrote:
>Marc wrote:
>>The below snippet does not work...anyone know how to reference the
procedure 'DrawCross()'?

Every time you call DrawCross(), you're generating a new instance of
a bitmap. That will never be the same instance you assigned to the
BackgroundImage.

The "is" operator is not a bitmap comparison operator. (Unless you
were to overload it.)

How about making your own extended MyContextMenuStrip inherits from
ContextMenuStrip and has a String property you can set to change the
BackgroundImage? (My nomenclature may be wrong.)
Hi Andrew,

Could you give me an example of how i would do that?

Im sorry but im really a transport manager pretending to be a
programmer so my knowledge is basic!!!
[Please bottom-post in this newsgroup.]

You'll have to wait for someone who knows about ContextMenuStrip as it isn't
in the VS2003/.NET1.1 I have. And anyway, I have to admit to only knowing
the principle of this Inherits thing; I've never needed to use it, other
than what VS sticks in the code for me.

Andrew
Dec 13 '06 #4

why do you have to bottom post???
"Andrew Morton" <ak*@in-press.co.uk.invalidwrote in message
news:u5*************@TK2MSFTNGP02.phx.gbl...
Marc wrote:
>Andrew Morton wrote:
>>Marc wrote:
The below snippet does not work...anyone know how to reference the
procedure 'DrawCross()'?

Every time you call DrawCross(), you're generating a new instance of
a bitmap. That will never be the same instance you assigned to the
BackgroundImage.

The "is" operator is not a bitmap comparison operator. (Unless you
were to overload it.)

How about making your own extended MyContextMenuStrip inherits from
ContextMenuStrip and has a String property you can set to change the
BackgroundImage? (My nomenclature may be wrong.)
what about middle posting??? is this excepted or frowned upon?
>
>Hi Andrew,

Could you give me an example of how i would do that?

Im sorry but im really a transport manager pretending to be a
programmer so my knowledge is basic!!!

[Please bottom-post in this newsgroup.]

You'll have to wait for someone who knows about ContextMenuStrip as it
isn't in the VS2003/.NET1.1 I have. And anyway, I have to admit to only
knowing the principle of this Inherits thing; I've never needed to use it,
other than what VS sticks in the code for me.

Andrew
Does it make it easier for you or is it a generally excepted rule ...
Dec 13 '06 #5
X-No-Archive: Yes

conversation.
of
order
normal
the
in
as
questions
the
follow
answers
the
if
follow
to
easier
it
makes
it
but
to,
have
don't
You

http://www.caliburn.nl/topposting.html

Andrew

jeff wrote:
why do you have to bottom post???

Dec 14 '06 #6
Ahhhhhhhh ... It all becomes clear. Bottom-posting is for those who suffer
from dyslexia.
"Andrew Morton" <ak*@in-press.co.uk.invalidwrote in message
news:OP**************@TK2MSFTNGP02.phx.gbl...
X-No-Archive: Yes

conversation.
of
order
normal
the
in
as
questions
the
follow
answers
the
if
follow
to
easier
it
makes
it
but
to,
have
don't
You

http://www.caliburn.nl/topposting.html

Andrew

jeff wrote:
>why do you have to bottom post???


Dec 14 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Joe Seigh | last post by:
Is there a good write on this. The textbooks I have fluff over on this? Specifically, I trying to dereference with 2 levels of type conversion not 1, i.e. X<T> -> z => Y<T> -> z => T* ->...
2
by: esrkq | last post by:
Hi, I am looking at a way to return IP related information of a visitor loading a web page and found the following snippet of code: if(navigator.javaEnabled() && (navigator.appName !=...
4
by: Andy Gayton | last post by:
Hey all, It looks like dynamic changes to a html document are only redrawn when the current code snippet comes to an end. For example the following page changes the text in a span, waits for a...
3
by: eiselekd | last post by:
Does anyone know about a code snippet that can be used to output a backtrace just like gdb's "backtrace" command does. One that can be called on a segmentation fault. (without resolving symbol...
10
by: Goran Djuranovic | last post by:
Hi all, Does anyone know how to declare a variable in a class to be accessible ONLY from a classes instantiated within that class? For example: ************* CODE ***************** Public...
52
by: Julie | last post by:
I'm supporting an application at work. Below are some code segments that I can't understand how they work. First let me say, I would never code this standard. I'm just really creeped out that it...
1
by: Dennis | last post by:
I've noticed some old posts regarding this issue; but nothing recently and no resolutions in the old postings. Its almost hard for me to believe that this wouldn't be fixed by now. I am using...
3
by: DR | last post by:
I heard there is some trick to referencing statics in VB.NET CLR stored procedure without having to mark the assembly as unsafe. Does anyone know this? This is usefull as the case of needing a...
10
by: Pavel Shved | last post by:
Is there a program of wide use that automatically extracts template parameters requirements from source code of template functions? I mean the following: assume we have a template function that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.