HI
I'm very new to C# and I've got a big project to do in C# for uni until july.
I've been trying do draw lines in C# (arrows to be precise). I can draw them allright but once I minimize the program and maximize it again, the arrows dissapear :S.
this also happens if I open another program on top of the program I'm creating.
Is their a way to correct this?
To draw the lines I've been using this piece of code. -
-
Graphics graph = panel1.CreateGraphics();
-
Pen pencurrent = new Pen(Color.Black);
-
graph.DrawLine(pencurrent, 220, ultimoponto, 220, ultimoponto+20);
-
graph.DrawLine(pencurrent, 215, ultimoponto + 15, 220, ultimoponto+20);
-
graph.DrawLine(pencurrent, 225, ultimoponto + 15, 220, ultimoponto+20);
-
thanks in advance.
4 9205
Is there any event is triggered by maximizing the program?
nope. no events.
The minimzing and maximizing was an example. this also happens if I move another window on top of the arrow. (I'm not sure if I'm making myself clear). When the arrow is hidden due to the program being minimized, or due to being hidden by another window, it simply dissapears.
vanc 211
Recognized Expert New Member
try to refresh your panel
cheers.
Put ur program at OnPaint event of the panel,
so every time its need to redraw it will do.
Try to find graphic/animation program in c#,
they always override OnPaint method on a class. -
using System;
-
using System.Collections.Generic;
-
using System.ComponentModel;
-
using System.Data;
-
using System.Drawing;
-
using System.Text;
-
using System.Windows.Forms;
-
-
namespace TryDraw
-
{
-
public partial class Form1 : Form
-
{
-
public Form1()
-
{
-
InitializeComponent();
-
}
-
-
private void panel1_Paint(object sender, PaintEventArgs e)
-
{
-
int ultimoponto = 100;
-
Pen pencurrent = new Pen(Color.Black);
-
e.Graphics.DrawLine(pencurrent, 220, ultimoponto, 220, ultimoponto+20);
-
e.Graphics.DrawLine(pencurrent, 215, ultimoponto + 15, 220, ultimoponto + 20);
-
e.Graphics.DrawLine(pencurrent, 225, ultimoponto + 15, 220, ultimoponto + 20);
-
}
-
}
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: taccea |
last post by:
I need to print a report, but I need to first draw lines and boxes for the
data.
I need to do it at print time using VBA.
How do I do this?
Any suggestions appreciated.
Taccea
|
by: JDeats |
last post by:
Is it possible to use GDI+ to draw: lines, points, shapes, etc...
inside a RichTextBox? It seems VS.NET does this with the code edit
window (left margin code collapse/expand boxes)?
Best,
Jeremy
|
by: prakash437 |
last post by:
Hello everyone ..
Can any of you please tell me how to draw lines joining two points in a
page using PHP. Not on an image but on the page itself?? And the lines
also need to be at an angle to the horizontal.
Thanks,
Vaddina Prakash Rao
|
by: zhaow |
last post by:
Hi, All
Greetings!
I want to develop as appllication that requires a line-drawing function
in the blank area between two forms. I have looked up the MSDN, it says that
a graphics object need a reference to a control or a form. I guess it means
that lines can't be draw on blank area between two forms. Can anybody
guarantee this for me? Is there any method can realize this function? I
mainly want to draw a line from a button in form1 to...
|
by: weberwhennner |
last post by:
Hi All,
Since two days Ive been trying to draw lines and polygons interactively (using mouse clicks), but all ive found is some libraries that draw shapes using predefined cooredinates.
Ive also been trying to search for books on amazon that would help me learn more about this, but looks like I'm not using the right search terms...
Any pointers, examples or related links would be greatly appreciated.
Thanks a lot!
| |
by: Nirosh |
last post by:
Hi All,
http://www.tourneylogic.com/Products/BracketControl/Demos/V2/PopularTourneys/NCAA.aspx
Can some one tell me how he has draw lines here.. is it a trick done using
DIV/ CSS or using the graphic lib..
I also have asked to develop some thing similar.. I have some idea about how
to go about here.. but performance wise and also cross browser compliancy
wise I have some concerns.. can some one shoot couple of hints for me to
|
by: Anuhas |
last post by:
Dear Experts,
I need to draw lines. But I have to make a class for this. I know how to draw lines in direct methods.
i.e.
Graphics g = this.CreateGraphics();
Pen mypen = new Pen(Color.Red, 2);
mypen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
g.DrawLine(mypen, 100, 100, 200, 300);
|
by: krantik |
last post by:
i need to draw lines like grid lines between images in a list control.i have used LVS_EX_GRIDLINES but its only working in report view .i need it in thumbnail view
|
by: aznimah |
last post by:
Hi,
i need help on draw lines from vertices (vertex points that i stored the values in arraylist.
i already done the vertex points of shape and now my problem is to draw line between those vertices
i need to draw geometry connected lines example:
-Diamond- i already have the vertex values (which 4 points in x, y position)
-i get the values from the arraylist (stored)
|
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: 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,...
| |
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: 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: 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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |