Hi again,
This problem is a little more complicated, and once again is in C#. I've create a form, with a groupbox, and in it, a picturebox. In the picturebox's paint event, I've drawn a black line through the middle of the picturebox, but the line is behind the picturebox and groupbox.
How do I get the line to be drawn in front of everything? In Visual BASIC, doing the same thing works fine, but in C#, anything that is drawn, is behind all objects and controls...
Sincerely,
Str!ker
5 1272
Moving this to the.NET forum.
What code are you using to draw the line?
- private void pictureBox2_Paint(object sender, PaintEventArgs e)
-
{
-
int idlePoint;
-
idlePoint = this.trackBar1.Value;
-
-
Point point1 = new Point(229, 210 - idlePoint);
-
Point point2 = new Point(229, 210 - idlePoint);
-
-
Graphics graphics;
-
graphics = this.CreateGraphics();
-
Pen pen = new Pen(Color.FromArgb(255, 0, 0, 0));
-
graphics.DrawLine(pen, point1, point2);
-
}
That's the code. I've done similar things in BASIC, and that works, but in C# it doesn't...
anybody? this is really annoying for me.
The problem is that you used this.CreateGrap hics() to obtain a graphics object. This gives you a graphics object at the level of the Form, so your line is appearing on the form.
You want your line to appear on the picturebox, so you shouldn't use this.CreateGrap hics(). Instead just use the graphics object that the event args provides you: e.Graphics;
Its always best when in a paint event or OnPaint override to use the provided Graphics object rather than creating your own.
Hope this helps,
Kevin
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Remon Huijts |
last post by:
Hi there,
For a very specific service, I have created a PHP script that uses the GD
library functions to create a PNG image from a few lines of XML data
describing a simple diagram/drawing. It's cool and works, writing the XML
data in a text editor is straightforward for me because I designed the
format. I have no idea however how I can make a simple online drawing
program that creates this XML code. The code is realy simple, just...
|
by: Skip Hollowell |
last post by:
I have what is now a table with a header row and then obviously rows of data
beneath. If the data is more than 50 or 6 rows (100px) then the rows will
scroll using overflow:auto. This all works great, but I have alignment
issues with the columns. I can get things to line up in either case (with
scrolling or without scrolling) but not in both. Currently, I am using
Tables to align everything and giving each row a % width. I would love...
|
by: fplisa |
last post by:
Hi-
I have code that dynamically adds 1 to 10 textboxes to a form. The
user is asked how many boxes he/she needs.
Problem is, I can't get to the events of each box that is added EXCEPT
for the last one.
I need to do a running total of the text boxes as the user enters a
value and moves onto the next textbox
|
by: Jason Hickey |
last post by:
Has there been a change in the way the UI designer handles winform
inheritance in the 2003 version of visual studio.
Consider the following (try it if you are using 2003 Everything seems to
work under 2002)
Create a form and add two buttons (bottom right) and a panel (fill the top
of the form)
Anchor the buttons to the bottom right and anchor the panel to top bottom
left and right.
set all three controls access level to protected
|
by: Rob Mayo |
last post by:
I am working in an environment with 4 developers. 2 groups of 2 people
working on the same server on the same web project with no version control
management on the web server.
Programmers A & B servername/project1
Programmers C & D servername/project2
All programmers have solutions that have their respective web projects,
accessed over file share. Programmers A & B so far are fine. Programmers C &
D have a problem.
| |
by: TB |
last post by:
Hi all:
If you think that the following comments are absolute amateurish, then
please bear with me, or simply skip this thread.
A couple of months back I made the decision to initiate a gradual upgrade of
my web programming skills from Classic ASP / VBS to ASP.NET / VB.NET.
While the study of the language differences and all the new features in .NET
has so far not been a traumatic experience, I am a bit shell-schocked after
|
by: Will Chamberlain |
last post by:
I came across a rather interesting article this morning and thought I'd
share. We all know that Visual Studio is a great IDE, but I think we can
all agree that it is adds a dramatic change to how we write code.
I'm not posting to talk trash or start a flamewar, just wanting feedback
in regards to the following article. I happen to use Visual Studio on a
daily basis and am not a John Rivers alter-ego.
...
|
by: Charles |
last post by:
Hello Everyone,
I have been gettting great feedback from microsoft.public.vc.language
group but after doing more searching I think my post should be directed
to this group.
I am trying to make a simple gif animation using VC++ and 13 different
gif files and a timer.
I am new to VC++ but played around with C++ for a few years. I am
using Microsoft Visual Studio 2005 (VC++).
|
by: NoBSWebDesign |
last post by:
This is a really interesting problem here. Somehow my Database window got stuck beneath the Access menu bar (the menu bar for the Database window is completely hidden). I cannot move it because I cannot click on the menu bar of the Database window. I've tried everything. Even undocking the menubar just causes the Database window to move up behind the Windows title bar for Access. Does anyone have any idea how to fix this?
Here is a screenshot...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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();...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |