473,609 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

paint question

i am using this code to try to paint a line on my form and it wont work i
get an object not set to a reference error

Dim myPen As New System.Drawing. Pen(System.Draw ing.Color.Red)

Dim formGraphics As System.Drawing. Graphics

formGraphics = Me.CreateGraphi cs()

formGraphics.Dr awLine(myPen, 0, 0, 200, 200)

myPen.Dispose()

formGraphics.Di spose()

what is wrong

thanks for the help

WStoreyII
Nov 20 '05 #1
0 1568

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

Similar topics

4
6214
by: Franck | last post by:
Hello, Sorry if that question has already been raised... I'm looking for the exact equivalent of Java paint(Graphics g) method in c# in order to paint a specific component and all its children on a particular graphics object. Can anyone help me ? Thanks,
5
7049
by: Tamir Khason | last post by:
How I can paint something onClick event? I need PaintEventArgs event in order to paint and raise Graphics, but onClick I have only EventArgs Event... Thanx
5
2252
by: vooose | last post by:
Consider a UserControl TopCont that contains two other UserControls, CompA and CompB. Somewhere in the constructor of TopCont we have CompA.Paint += new PaintEventHandler(compA_Paint); CompB.Paint += new PaintEventHandler(compB_Paint); I am calling Invalidate() on both of the child components and this results in their respective paint methods executing. However at some
0
1904
by: vooose | last post by:
Consider a UserControl to which you do userControl.Paint += new PaintEventHandler(paint_method) If you don't like that way, and prefer to override onPaint( ) then the problem stated below still exists (I tried both ways). Imagine you have a Console.WriteLine( ) in the paint method so you know when its getting called. Also there is no place in the code that userControl.Paint is -+ so the event is *never* removed.
3
1969
by: Mike Cooper | last post by:
I have been staring at the above error for over a week now! I have a an inherited data class looking like thus: Public Class DataGridBoolColumnInherit Inherits System.Windows.Forms.DataGridBoolColumn Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal As CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean)
8
336
by: WStoreyII | last post by:
i am using this code to try to paint a line on my form and it wont work i get an object not set to a reference error Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red) Dim formGraphics As System.Drawing.Graphics formGraphics = Me.CreateGraphics() formGraphics.DrawLine(myPen, 0, 0, 200, 200)
6
3138
by: jcrouse | last post by:
I am rotating some text is some label controls. In the one place I use it it works fine. In the other place I use it I can't figure out the syntax. I don't really understand the event. Where it works fine, it seems to fire when the form changes visibility. Here is the code. Private Sub lblP1JoyUp_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles lblP1JoyUp.Paint If lblP1JoyUp.Visible = True Then Dim...
7
1820
by: hamil | last post by:
The following code will display a tif file on a form. When another form is moved over the tif image, the tif image is erased where the form was moved. A paint event occurs when this happens. My question is..how would I save the tif images as soon as it is initially painted, and then restore the image in a paint event. It seems to me that there should be some sort of a SaveImage method and a RestoreImage method that would be fast. Note:...
4
2533
by: Sam | last post by:
Hai, I use a paintbox paint event to draw some images in a paintbox. I call the paint event by refreshing the paintbox using paintboxname.refresh() or paintboxname.update(). Problem with this kind of paint event is that the event is not raised when the application is run in a minimized state. So, my question is: How can you make sure that the paint event is called even when the application is running in the minimized state.
5
2084
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, On a usercontrol I've put a set of radiobuttons within a groupbox. These radiobuttons have visual style enables, i.e. they turn orange when hovering over them and green when pushed. Normally I put my updation of data shown in the controls on the usercontrol in the Paint event handler of the usercontrol. When it comes to the radiobuttons, a paint event for the usercontrol is fired whenever hovering over the radiobuttons, making...
0
8145
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8556
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8410
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5526
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4037
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.