Hi.
I've made so:
Imports System.Drawing
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim GR As Graphics = Me.CreateGraphics
GR.DrawRectangle(Pens.Red, 100, 30, 150, 190)
End Sub
End Class
But when the program was executed I saw only the form!!
Please Help Me
Bye
Cris 5 1706
"Cristian" <cr*********@libero.it> schrieb Hi. I've made so:
Imports System.Drawing Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim GR As Graphics = Me.CreateGraphics
GR.DrawRectangle(Pens.Red, 100, 30, 150, 190)
End Sub
End Class
But when the program was executed I saw only the form!!
In Form_Load, the form is not visible yet. Painting on an invisible Form
does not makes sense. On the other side, you don't paint if it is visible.
To do this, handle the Paint event.
Background and basics: http://msdn.microsoft.com/library/en...tdraw_8alz.asp http://msdn.microsoft.com/library/en...tdraw_4k6d.asp http://msdn.microsoft.com/library/en...tdraw_1xd1.asp
(The Paint event is raised whenever the Form receives a WM_PAINT Message).
Armin
Hi,
Never draw in the forms load event it will be erased when the form
paints itself. Use the paint event instead.
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = e.Graphics
g.DrawRectangle(Pens.Red, 100, 30, 150, 190)
End Sub
Ken
--------------------
"Cristian" <cr*********@libero.it> wrote in message
news:t6********************@twister1.libero.it... Hi. I've made so:
Imports System.Drawing Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim GR As Graphics = Me.CreateGraphics
GR.DrawRectangle(Pens.Red, 100, 30, 150, 190)
End Sub
End Class
But when the program was executed I saw only the form!! Please Help Me Bye Cris
"Cristian" <cr*********@libero.it> schrieb: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim GR As Graphics = Me.CreateGraphics
GR.DrawRectangle(Pens.Red, 100, 30, 150, 190)
End Sub
End Class
But when the program was executed I saw only the form!!
Add the code to your form's 'Paint' event handler:
\\\
e.Graphics.DrawRectangle(...)
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
NO!
OK! I've result.
It's WRONG that is not possible write on invisible form!!!
In ON_LOAD the form is already existent!!
Soo Thank.
Bye
"Cristian" <cr*********@libero.it> ha scritto nel messaggio
news:t6********************@twister1.libero.it... Hi. I've made so:
Imports System.Drawing Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim GR As Graphics = Me.CreateGraphics
GR.DrawRectangle(Pens.Red, 100, 30, 150, 190)
End Sub
End Class
But when the program was executed I saw only the form!! Please Help Me Bye Cris
"Cristian" <cr*********@libero.it> schrieb NO! OK! I've result. It's WRONG that is not possible write on invisible form!!!
No, it's TRUE that it is not possible.
In ON_LOAD the form is already existent!!
Yes, but it is not visible.
Armin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: padawan |
last post by:
I have a winforms control that draws a rectangle for a boarder and positions
some graphical elements around the control to create the boarder effect I
desired. In the control I have overriden the...
|
by: KVV |
last post by:
Hello, All!
SolidBrush brush = new SolidBrush(SystemColors.Control);
e.Graphics.FillRectangle(brush,Rect);
Why this code draw
and this
Pen pen = new Pen(brush,drawWidth);
pen.Alignment =...
|
by: Siri Krishna |
last post by:
Hi,
We have a custom control into which we add controls like labels and move
them at run time. The problem we have is that when a child control is
selected and moved, we draw a rectangle around it...
|
by: Peter Proost |
last post by:
Hi, I've got the following ownerdraw menu:
drag a mainmenu on a form and add some menuitems to it, set all the
menuitems to ownerdraw = true
and for every menuitem add this code (replace...
|
by: Dan |
last post by:
I want to use Graphics.DrawRectangle to draw a rectangle at a position on the
screen, and then a few seconds later, erase it. How do you erase a rectangle
that you just drew (without affecting the...
|
by: Jeff Waskiewicz |
last post by:
Hello All,
I'm trying to solve a nagging problem. The goal is to draw a rectangle over
the top of all the other controls on a form. Specifically, over a ChartFX
control. The user would draw...
|
by: Jon Slaughter |
last post by:
How does DrawRectangle position a rectangle w.r.t to the Rectangle passed?
Lets suppose I use a pen of width 5. Are the lines centered about the passed
Rectangle or is it enclosed or offset? Are...
|
by: wazzup |
last post by:
C++ is new to me and I'm trying solve this problem but get stuck. Please help me out. Below is the task and after that is what i got so far.
Create a program to print nested squares
Input:...
|
by: t f |
last post by:
Hi
FillRectangle allows me to use a rectanglef as a parameter, why doesnt
DrawRectangle? Even though I can use floats as parameters? Did M$ forget to
add it?
Thanks
t f
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |