I know there is a way to do this, but I don't know how. Via a custom
event? I have some code that I only want to run during a paint event.
I could build a form instance that has the code and inherit it in all
my other forms, but a simple event link? if that is the right term
would be easier?
Thx. 7 1688
You should be able to overload the render event with your own event. The
base class render event will still fire but will include your extra
functionality
Jody
MCSD.NET
"Schorschi" <Sc*******@DSLE xtreme.COM> wrote in message
news:21******** *************** ***@posting.goo gle.com... I know there is a way to do this, but I don't know how. Via a custom event? I have some code that I only want to run during a paint event. I could build a form instance that has the code and inherit it in all my other forms, but a simple event link? if that is the right term would be easier?
Thx.
"Schorschi" <Sc*******@DSLE xtreme.COM> schrieb I know there is a way to do this, but I don't know how. Via a custom event? I have some code that I only want to run during a paint event. I could build a form instance that has the code and inherit it in all my other forms, but a simple event link? if that is the right term would be easier?
Maybe I'm the only one who doesn't understand your question, but could you
please explain it once more?
--
Armin
Hi Schorschi,
I don't know what it does, but it is standard and fires when the form paint
I think
Private Sub Form1_Paint(ByV al sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles MyBase.Paint
End Sub
I don't know if it helps you?
Cor
Hi Schorschi,
Sounds to me like you need global MessageHandler, and need to capture the
WM_PAINT message.
If you create a class that implements the IMessageHandler interface, then
use the Application object to add a message handler, look for m.Msg = &HF
(or Public Const WM_PAINT As Integer = &HF)
When m.Msg = WM_PAINT, a paint event is occurring on 'some' object, in your
application.
--
HTH,
-- Tom Spink, Über Geek
Please respond to the newsgroup,
so all can benefit
" System.Reflecti on Master "
==== Converting to 2002 ====
Remove inline declarations
"Schorschi" <Sc*******@DSLE xtreme.COM> wrote in message
news:21******** *************** ***@posting.goo gle.com... I know there is a way to do this, but I don't know how. Via a custom event? I have some code that I only want to run during a paint event. I could build a form instance that has the code and inherit it in all my other forms, but a simple event link? if that is the right term would be easier?
Thx.
Tom,
I think you are right, a global message handler would work fine, but
is not a very .NET way of doing it. If I was using C or C++ I would
go the message routine route, but overloading the the paint handler is
acceptable as well to an extent.
What I was also thinking was a chained sequence of paint routines, for
example, if I add a custom handler that draws a custom panel on a
given form, then a custom icon, then a geometric pattern, etc. but
these draw routines if you will, are a list of drawing elements, or a
collection that I can add or remove from.
Overloading the existing paint handler would allow for the same thing,
I just write an overloaded paint routine on top of another, one key
issue, what if I want to drop out a specific paint element? If it was
a linked list of drawing elements I could do this.
For example, the list might be...
1) Draw square
2) Draw circle
3) Draw Triangle
4) Draw Rectangle
Then I could drop the Draw circle code
1) Draw square
3) Draw Triangle
4) Draw Rectangle
This was the idea. So do I implement handler for each routine and
only call the ones that should be active, i.e. disable others, or
build a collection list and fire all on a paint event? Lots of
options, just need to pick one I guess.
> I think you are right, a global message handler would work fine, but is not a very .NET way of doing it.
Why not.... .NET provides a solid implementation of a global message
handler.
--
HTH,
-- Tom Spink, Über Geek
Please respond to the newsgroup,
so all can benefit
" System.Reflecti on Master "
==== Converting to 2002 ====
Remove inline declarations
"Schorschi" <Sc*******@DSLE xtreme.COM> wrote in message
news:21******** *************** ***@posting.goo gle.com... Tom,
I think you are right, a global message handler would work fine, but is not a very .NET way of doing it. If I was using C or C++ I would go the message routine route, but overloading the the paint handler is acceptable as well to an extent.
What I was also thinking was a chained sequence of paint routines, for example, if I add a custom handler that draws a custom panel on a given form, then a custom icon, then a geometric pattern, etc. but these draw routines if you will, are a list of drawing elements, or a collection that I can add or remove from.
Overloading the existing paint handler would allow for the same thing, I just write an overloaded paint routine on top of another, one key issue, what if I want to drop out a specific paint element? If it was a linked list of drawing elements I could do this.
For example, the list might be...
1) Draw square 2) Draw circle 3) Draw Triangle 4) Draw Rectangle
Then I could drop the Draw circle code
1) Draw square 3) Draw Triangle 4) Draw Rectangle
This was the idea. So do I implement handler for each routine and only call the ones that should be active, i.e. disable others, or build a collection list and fire all on a paint event? Lots of options, just need to pick one I guess.
Hi Schorschi,
You can override a Control's WndProc quite legitimately in .NET. However
that's a side issue.
It sounds as if you are wanting the flexibility of a dynamic chain of
actions. That makes the word Delegate leap into my mind. Delegates are the
..NET version of C's function pointers, but being objects in their own right,
are much more sophisticated. For instance, they can work synchronously or
async.
You have two choices using Delegates. You can have one Delegate
(multicast) handle a list of drawing elements, or you can have an array
handling one drawing element each.
Another way to go, by the sound of it, would be to define the drawing
elements as independant objects which know how to draw themselves in a given
graphics context. And have a chain of these attached to your actual GUI
elements.
Like you say, including those you already have, lots of options. ;-)
Regards,
Fergus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joe |
last post by:
Hello All,
I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton
(SearchButton) server controls. The user can type search text in
SearchTextBox and click SearchButton and the web server performs a database
query and displays the results. All of this works fine.
I want the user to be able to press the Enter key while the cursor is still
in SearchTextBox and have the SearchButton.Click event fire (thus performing...
|
by: Colin McGuire |
last post by:
I apologize for posting yet another scrollbar question. Here is my
code. All I want is for a diagonal line to appear from coordinates
(0,0) to (width,height) in a usercontrol regardless of whether the
user autoscrolls the usercontrol (other things that are on the
usercontrol I want to scroll, but haven't included any here).
Here are the steps to reproduce my problem.
1. Launch Visual Studio and create a new Windows
application with...
|
by: LDD |
last post by:
After upgrading sucessfully to VB.Net... WooHoo!!! It was a slow process,
but in the end it seemed to have worked out well.
I've noticed the the form_active (VB6) is no longer available. There is the
Form_Activated available.
I have built a work around, but everytime the main form for the app is
clicked, the form_activated event fires.
Is there the equivalent to the form_active in VB6. Where the code only
|
by: Greg |
last post by:
My problem is that values in the bool column of a datagrid are only
being updated to the database once the focus of the bool cell is lost.
This is completely counter-intuitative. When a user clicks on a bool
type cell in a datagrid and sees a check mark put in / removed, then
he/she would expect this to be reflected in the databsae immediately.
I've even overriden the paint, commit and edit methods of the bool
column class (which...
|
by: Joseph Geretz |
last post by:
I'm porting a C# Outlook Addin originally engineered as a COM Addin over to
use VSTO. I've gotten this to the point where my VSTO Addin installs its
Menu items and Toolbar buttons when Outlook launches. I've wired up my event
handler to each Menu item and toolbar button. (I use the same Event handler
and I use the Tag property which is different for every Menu Item and
Toolbar buton to determine which menu or button is being clicked and to...
| |
by: Techsatish |
last post by:
how to make a mouseup event called only once during a double click
event?
here double click is made on a tree node in a tree control.
I have the code inside mouseup event....in runtime the mouseup is
called twice for the mouse double click over the selected tree node.
I want mouseup event to be called onece
Any ideas?
|
by: Kürþat |
last post by:
Hi all,
I do some drawing in a form's paint event handler and I have a button on
that form. Whenever the mouse enters or leaves the button Form's paint event
occurs. Isn't that a strange behavior? Is it possible to prevent that?
Thanks.
|
by: Andy Wynn |
last post by:
I have a custom control that has a rectangle drawn at the bottom of the
control. Nothing fancy, just a rectangle with a color fill. The
control has the ability to be resized ( Collapsed - Expanded). Each
time the control is resized, the rectangle needs to be redrawn in its
proper location. The probem is that the resize event fires and
finishes before the Paint event can redraw the rectangle, giving me a
very nasty flicker.
I have...
|
by: Rotsey |
last post by:
Hi,
I have a interface that I use for a form so I can pass the form
to another object.
How do I add the Paint event to the interface and subsequently
handle the paint event in my other object.?
I am not sure of the syntax required to do this?
|
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: 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,...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |