Click here to Skip to main content
15,166,066 members
Home / Discussions / C#
   

C#

 
AnswerRe: C sharp Picturebox linking error Pin
Richard MacCutchan9-Nov-21 0:39
mveRichard MacCutchan9-Nov-21 0:39 
GeneralRe: C sharp Picturebox linking error Pin
ÖmürTokman9-Nov-21 1:13
MemberÖmürTokman9-Nov-21 1:13 
AnswerRe: C sharp Picturebox linking error Pin
Eddy Vluggen10-Nov-21 4:06
professionalEddy Vluggen10-Nov-21 4:06 
Questionwriting content of csv files into oracle Pin
md arif 20215-Nov-21 0:27
Membermd arif 20215-Nov-21 0:27 
AnswerRe: writing content of csv files into oracle Pin
Richard MacCutchan5-Nov-21 1:34
mveRichard MacCutchan5-Nov-21 1:34 
AnswerRe: writing content of csv files into oracle Pin
OriginalGriff5-Nov-21 2:30
mveOriginalGriff5-Nov-21 2:30 
GeneralRe: writing content of csv files into oracle Pin
Richard MacCutchan5-Nov-21 3:09
mveRichard MacCutchan5-Nov-21 3:09 
QuestionDerived Treeview override not being called at all. Pin
pr1mem0ver4-Nov-21 4:47
Memberpr1mem0ver4-Nov-21 4:47 
I have the following treeview class whose purpose is to draw an overlay on the icons in a node. Notice it overrides "OnDrawNode":

C#
/// <summary>
/// A method that is supplied to the OverlayTreeView class to retrieve the overlay for a particular node
/// </summary>
/// <param name="node">The node being drawn</param>
/// <returns></returns>
public delegate Image GetTreeIconOverlayMethod(TreeNode node);
	
public class OverlayTreeView : TreeView
{
	bool drawOverlay;
	int iconHeight;
	int iconWidth;

	public GetTreeIconOverlayMethod GetIconOverlay { get; set; }
	
	public OverlayTreeView() { }
	protected override void OnHandleCreated(EventArgs e)
	{
		base.OnHandleCreated(e);
		if (ImageList != null)
		{
			drawOverlay = true;
			iconHeight = ImageList.ImageSize.Height;
			iconWidth = ImageList.ImageSize.Width;
		}
	}

	protected override void OnDrawNode(DrawTreeNodeEventArgs e)
	{
		base.OnDrawNode(e);

		Image overlay = null;
		if (drawOverlay)
			if (GetIconOverlay != null)
				if (!((e.Node.ImageIndex == -1) && (e.Node.ImageKey == null)))
					overlay = GetIconOverlay(e.Node);
		if (overlay != null)
		{
			int x = e.Node.Bounds.X + iconWidth - overlay.Width;
			int y = e.Node.Bounds.Y + iconHeight - overlay.Height;
			e.Graphics.DrawImage(overlay, x, y);
		}
	}
}


The overlay is not being drawn and it seems this is because the override is not being called at all. Any breakpoint put in this method does NOT gte triggered even though a breakpoint in OnHandleCreated is. It doesn't matter where I put the breakpoint within the method. (And yes... symbols are loaded).

I have no idea why this would occur...
AnswerRe: Derived Treeview override not being called at all. Pin
Richard Deeming4-Nov-21 5:01
mveRichard Deeming4-Nov-21 5:01 
GeneralRe: Derived Treeview override not being called at all. Pin
primem0ver4-Nov-21 6:17
Memberprimem0ver4-Nov-21 6:17 
GeneralRe: Derived Treeview override not being called at all. Pin
Richard Deeming4-Nov-21 6:32
mveRichard Deeming4-Nov-21 6:32 
GeneralRe: Derived Treeview override not being called at all. Pin
primem0ver4-Nov-21 6:42
Memberprimem0ver4-Nov-21 6:42 
GeneralRe: Derived Treeview override not being called at all. Pin
BillWoodruff5-Nov-21 0:56
mveBillWoodruff5-Nov-21 0:56 
AnswerRe: Derived Treeview override not being called at all. Pin
BillWoodruff5-Nov-21 0:55
mveBillWoodruff5-Nov-21 0:55 
SuggestionCron mechanism Pin
johnpierwszy3-Nov-21 23:34
Memberjohnpierwszy3-Nov-21 23:34 
GeneralRe: Cron mechanism Pin
OriginalGriff3-Nov-21 23:54
mveOriginalGriff3-Nov-21 23:54 
GeneralRe: Cron mechanism Pin
johnpierwszy4-Nov-21 0:13
Memberjohnpierwszy4-Nov-21 0:13 
GeneralRe: Cron mechanism Pin
OriginalGriff4-Nov-21 0:18
mveOriginalGriff4-Nov-21 0:18 
GeneralRe: Cron mechanism Pin
johnpierwszy4-Nov-21 0:21
Memberjohnpierwszy4-Nov-21 0:21 
GeneralRe: Cron mechanism Pin
OriginalGriff4-Nov-21 0:34
mveOriginalGriff4-Nov-21 0:34 
GeneralRe: Cron mechanism Pin
johnpierwszy4-Nov-21 1:02
Memberjohnpierwszy4-Nov-21 1:02 
GeneralRe: Cron mechanism Pin
OriginalGriff4-Nov-21 1:54
mveOriginalGriff4-Nov-21 1:54 
GeneralRe: Cron mechanism Pin
johnpierwszy4-Nov-21 2:09
Memberjohnpierwszy4-Nov-21 2:09 
GeneralRe: Cron mechanism Pin
OriginalGriff4-Nov-21 2:59
mveOriginalGriff4-Nov-21 2:59 
GeneralRe: Cron mechanism Pin
johnpierwszy4-Nov-21 7:16
Memberjohnpierwszy4-Nov-21 7:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.