473,671 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PictureBox in C# doesn't paint

Hello,
I've the following problem:

There is a form having a picture box on it.
The box's paint event is implementet as follow:

<within the paint event>
Size drawArea = pictureBox1.Siz e;

Graphics mydraw = pictureBox1.Cre ateGraphics();

mydraw.DrawLine ( Pens.Red,
new Point(5, 5),
new Point(5, drawArea.Height - 10));

mydraw.DrawLine (Pens.Red,
new Point(5, drawArea.Height - 10),
new Point(drawArea. Width - 10, drawArea.Height -
10));
Actually, the could should draw two axis into the box. However, if I
start the application the picturebox is emtpy. I do not understand
why, because (for my understanding) the paint event is called when I
start the program.
The only way that I can see the axis is to move another window over my
application to force a new call of the paint event handler.
I hope somebody can help me.

Thanks for the answers.

Regards
Christian Lipps
Nov 16 '05 #1
0 1899

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

Similar topics

12
57277
by: yaya via DotNetMonster.com | last post by:
Hi, I have a picture box with circles and rectangles, and I wana save all the images into a jpg file, i tried pictureBox1.Image.Save(@"c:\1.jpg"); but I got and error "System.NullReferenceException: Object reference not set to an instance of an object." Can anyone help? Thanks... --
2
3205
by: Crirus | last post by:
hello I have apicturebox painted in it's paint event. I need a way to save the image created. Image obj of my picturebox is Nothing. How to output to a jpg my image? Crirus
2
2163
by: active | last post by:
Problem: The PictureBox display appears to have the image cut off. I.e., the image bottom does not display although the PictureBox has room for it. It occurred to me that what was displayed was the same size as the PictureBox was before it was resized. So I figured the bitmap was too small and tried to increase it's size as shown below. Two things: First it didn't fix the problem. Secondly, I'm not sure I've done it correctly and...
8
10777
by: nobody | last post by:
How do I save a PictureBox bitmap with changes drawn on the bitmap? This doesn't do it: PictureBox1.Image.Save("key30.bmp")
2
10332
by: kalp suth via DotNetMonster.com | last post by:
I want to create arrows using lines on a picture in the picture box. On clicking the button "btnShowAll", the image is loaded and the lines drawn. "RGSShowAll()" calls "DrawObjs()" which does the actual drawing work. But after displaying all the arrows in a flick, the arrows disappers. I have debugged and came to know that the "Paint" event of the picturebox is refreshing the image, so the work done on the CreateGraphics created object is...
4
10231
by: Yash | last post by:
Have used DrawLine() method to draw some lines in the picturebox (sort of a barcode) in the picturebox paint event. This diagram has to be saved as an image in bmp or tiff format. But the problem is that these lines are not recognized as the image of the picturebox. It shows picturebox.image = nothing. How do we convert these lines drawn as the image of the picturebox so that it can be saved.
1
1419
by: The Confessor | last post by:
(ellipses in place of code sections which do not deviate from defaults) Private Sub Form_Main_Load(...) Handles MyBase.Load For A = 0 To 16 For B = 0 To 14 PictureBox_MapEditor_Map.CreateGraphics.DrawImage (System.Drawing.Image.FromFile("C:\The RPG Project\Test 2.bmp"), A * 40, B * 40) Next Next
1
2564
by: The Confessor | last post by:
I'm trying to develop a graphically-simple, gameplay-complex RPG, and I decided to create a graphical Proof of Concept just to confirm that graphics would be... well, simple. Predictably, they've proven otherwise. This is my PictureBoxMap_Paint() Sub, which a tiles a PictureBox with 19* 17 40*40-pixel images, two rows and two columns of which are painted beyond the current bounds of the picturebox to facilitate scrolling. The If/Else...
0
3162
by: =?Utf-8?B?RG9jdG9y?= | last post by:
I am making an application that streams video from a web camera onto the client area of a PictureBox on a Windows CLR Form in MS Visual Studio 2005 (using C++). The streaming video works fine, and now I am trying to create an image overlay. I am assuming that the best way for me to do this is to create a second PictureBox that lays over the streaming video. I would then need to draw directly into the bitmap shown in the overlaying...
0
8390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8911
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
8819
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
8597
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
8667
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
7428
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...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2808
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1806
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.