basicloader | LoRa Basics Loader
kandi X-RAY | basicloader Summary
kandi X-RAY | basicloader Summary
LoRa Basics Loader
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of basicloader
basicloader Key Features
basicloader Examples and Code Snippets
Community Discussions
Trending Discussions on basicloader
QUESTION
TLDR: I'm seeking the correct method for timing the rendering of a juxtaposed graphic for a particular control on a design surface so that the graphic always is painted ahead of the adornment glyphs when that control is selected.
This question concerns control designers for Winforms: When the user places a control on the design surface, I want to display a graphic above the client area of the control. I have succeeded to some extent doing that for a TableLayoutPanel (TLP) control by overriding its OnPaint event handler then using the e.Graphics object available to paint a peach-colored rectangle. Below is an image showing the results: a painted graphic that spans the width of the control and is 35 pixels high--remember, this is a designer instance of a control placed on a design surface (created with a BasicLoader):
However, within the designer, if I resize the control, the graphic always ends up below the resize glyph (the glyph that has the North/South and West/East arrows on it):
I've tried creating and maintaining various Boolean flags to suppress the OnPaint message under certain circumstances. For instance, I set a flag to indicate that the control was just resized (to see how I did that, see my recent question: BeginResize/EndResize Event for Control on WinForms Design Surface) in order to suppress the painting of the graphic, but that didn't work because an OnPaint event is inevitably raised after I've cleared a flag. I don't want saddle this question with details of all the flags and places I tried to use/set them but suffice it to say that I painstakingly spent hours experimenting--to no avail. I've concluded that there must be a better way.
How can I ensure that the glyphs remain on top when I paint my graphics?
Thank you!
...ANSWER
Answered 2020-Feb-01 at 20:46I can think of a few solutions, including the followings:
- Using Padding of the
TableLayoutPanel
- Using Adorner and Glyph
- Creating a custom panel, having header and editable content
I think the first solution will suit you well, however the other solutions also some points.
I can also think of a solution based on NativeWindow
like what has been implemented in ErrorProvider
, but It makes the post toooooo lengthy while the existing options are good enough. So I leave it to you if you like to pursue the idea.
This solution is for both design-time and run-time
TableLayoutPanel
has a Padding
property and its layout engine respects to the padding well. You can use the padding area to render whatever you want:
QUESTION
TLDR: I would like to know how I can create a hook into a begin-resize and an end-resize event for a design-time control instance on the designer surface.
Detail: Specifically, I am working with a design surface produced by a BasicLoader in the System.Design and System.Component.Design .NET namespaces. Specifically, I'm working a design-time instance of the TableLayoutPanel. That control exposes a SizeChanged event and a Resize event--alas, both fire during the resize operation--that is, while the control is being resized--as well as when the resize operation is complete. I therefore have no way of know when the resize operation began and when it officially ended.
One way to tackle this would be to detect a mouse-down event along with a resize event--but it's unclear to me how I can detect a mouse-down event on any of the grab handles of a control being resized.
For the records, I revisited the BehaviorService and saw that it exposes BeginDrag, EndDrag, and Synchronize--I see nothing in that service that would help me with BeginResize/EndResize events.
So, ideally, I would like to subscribe to BeginResize/EndResize events for any designer instance of a Winform control, but I would be happy if the provided answer covered only my need to have these events attached to a designer instance of the TableLayoutPanel control...
Any thoughts?
...ANSWER
Answered 2020-Jan-28 at 15:00When a resize starts, a designer transaction with a specific description starts and when the design ends, the transaction will be closed.
You can rely on TransactionOpened
event of the IDesignerHost
and check the TransactionDescription
to see if it starts with "Resize"
, set a flag resizing
to true
. Then in TransactionClosed
you can check if the flag is true
, it means it's a resize end has happened.
Example
Here is a PoC to show how it works. Add the following control into a Windows Forms project and after building the project, drop an instance of MyControl
on the form. Then if you try to resize the form, you will see the Resize started.
and Resize ended.
text on title-bar of the form:
Here is the code:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install basicloader
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page