Click here to Skip to main content
15,880,469 members
Home / Discussions / C#
   

C#

 
AnswerRe: C sharp Picturebox linking error Pin
Richard MacCutchan8-Nov-21 23:39
mveRichard MacCutchan8-Nov-21 23:39 
GeneralRe: C sharp Picturebox linking error Pin
ÖmürTokman9-Nov-21 0:13
ÖmürTokman9-Nov-21 0:13 
AnswerRe: C sharp Picturebox linking error Pin
Eddy Vluggen10-Nov-21 3:06
professionalEddy Vluggen10-Nov-21 3:06 
Questionwriting content of csv files into oracle Pin
md arif 20214-Nov-21 23:27
md arif 20214-Nov-21 23:27 
AnswerRe: writing content of csv files into oracle Pin
Richard MacCutchan5-Nov-21 0:34
mveRichard MacCutchan5-Nov-21 0:34 
AnswerRe: writing content of csv files into oracle Pin
OriginalGriff5-Nov-21 1:30
mveOriginalGriff5-Nov-21 1:30 
GeneralRe: writing content of csv files into oracle Pin
Richard MacCutchan5-Nov-21 2:09
mveRichard MacCutchan5-Nov-21 2:09 
QuestionDerived Treeview override not being called at all. Pin
pr1mem0ver4-Nov-21 3:47
pr1mem0ver4-Nov-21 3: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 4:01
mveRichard Deeming4-Nov-21 4:01 
GeneralRe: Derived Treeview override not being called at all. Pin
primem0ver4-Nov-21 5:17
primem0ver4-Nov-21 5:17 
GeneralRe: Derived Treeview override not being called at all. Pin
Richard Deeming4-Nov-21 5:32
mveRichard Deeming4-Nov-21 5:32 
GeneralRe: Derived Treeview override not being called at all. Pin
primem0ver4-Nov-21 5:42
primem0ver4-Nov-21 5:42 
GeneralRe: Derived Treeview override not being called at all. Pin
BillWoodruff4-Nov-21 23:56
professionalBillWoodruff4-Nov-21 23:56 
AnswerRe: Derived Treeview override not being called at all. Pin
BillWoodruff4-Nov-21 23:55
professionalBillWoodruff4-Nov-21 23:55 
SuggestionCron mechanism Pin
johnpierwszy3-Nov-21 22:34
johnpierwszy3-Nov-21 22:34 
GeneralRe: Cron mechanism Pin
OriginalGriff3-Nov-21 22:54
mveOriginalGriff3-Nov-21 22:54 
GeneralRe: Cron mechanism Pin
johnpierwszy3-Nov-21 23:13
johnpierwszy3-Nov-21 23:13 
GeneralRe: Cron mechanism Pin
OriginalGriff3-Nov-21 23:18
mveOriginalGriff3-Nov-21 23:18 
GeneralRe: Cron mechanism Pin
johnpierwszy3-Nov-21 23:21
johnpierwszy3-Nov-21 23:21 
GeneralRe: Cron mechanism Pin
OriginalGriff3-Nov-21 23:34
mveOriginalGriff3-Nov-21 23:34 
GeneralRe: Cron mechanism Pin
johnpierwszy4-Nov-21 0:02
johnpierwszy4-Nov-21 0:02 
GeneralRe: Cron mechanism Pin
OriginalGriff4-Nov-21 0:54
mveOriginalGriff4-Nov-21 0:54 
GeneralRe: Cron mechanism Pin
johnpierwszy4-Nov-21 1:09
johnpierwszy4-Nov-21 1:09 
GeneralRe: Cron mechanism Pin
OriginalGriff4-Nov-21 1:59
mveOriginalGriff4-Nov-21 1:59 
GeneralRe: Cron mechanism Pin
johnpierwszy4-Nov-21 6:16
johnpierwszy4-Nov-21 6: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.