Click here to Skip to main content
15,900,724 members
Home / Discussions / C#
   

C#

 
AnswerRe: File comparison (byte, hash and meta) in C# Pin
Nathan Minier12-Aug-16 1:31
professionalNathan Minier12-Aug-16 1:31 
QuestionWindows Control Library Project in WinForms ... rant Pin
BillWoodruff11-Aug-16 1:13
professionalBillWoodruff11-Aug-16 1:13 
AnswerRe: Windows Control Library Project in WinForms ... rant Pin
Gerry Schmitz11-Aug-16 8:24
mveGerry Schmitz11-Aug-16 8:24 
Questionevent for partial view unload Pin
Raghavendra.Kodimala10-Aug-16 21:12
professionalRaghavendra.Kodimala10-Aug-16 21:12 
AnswerRe: event for partial view unload Pin
Pete O'Hanlon10-Aug-16 21:54
mvePete O'Hanlon10-Aug-16 21:54 
QuestionHaar-feature Object Detection in C# Pin
bird1235810-Aug-16 8:04
bird1235810-Aug-16 8:04 
AnswerRe: Haar-feature Object Detection in C# Pin
Richard Deeming10-Aug-16 8:06
mveRichard Deeming10-Aug-16 8:06 
AnswerRe: Haar-feature Object Detection in C# Pin
Afzaal Ahmad Zeeshan10-Aug-16 8:43
professionalAfzaal Ahmad Zeeshan10-Aug-16 8:43 
QuestionDll strange behavior C # Pin
equelna10-Aug-16 0:42
equelna10-Aug-16 0:42 
AnswerRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 1:59
mveRichard MacCutchan10-Aug-16 1:59 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 4:43
equelna10-Aug-16 4:43 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 4:50
mveRichard MacCutchan10-Aug-16 4:50 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 5:01
equelna10-Aug-16 5:01 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 5:03
mveRichard MacCutchan10-Aug-16 5:03 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 5:11
equelna10-Aug-16 5:11 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 5:13
mveRichard MacCutchan10-Aug-16 5:13 
GeneralRe: Dll strange behavior C # [SOLVED] Pin
equelna10-Aug-16 6:33
equelna10-Aug-16 6:33 
QuestionImplementing a Cue Banner to a textbox in windows xp with custom color Pin
srikrishnathanthri9-Aug-16 21:41
srikrishnathanthri9-Aug-16 21:41 
Hello,
I am planning to implement cue banner for Text boxes in .net. I want this cue text to work till user enters some text in the box, that is cue text should not disappear if user clicks on text box.

I got this example, but I have two problems with this.
C#
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Runtime.InteropServices;

public class Form1
{

	private void Form1_Load(System.Object sender, System.EventArgs e)
	{
		CueBannerText.SetCueText(TextBox1, "Enter Name here");
	}
	public Form1()
	{
		Load += Form1_Load;
	}
}



public static class CueBannerText
{
	[DllImport("user32.dll", CharSet = CharSet.Auto)]
	private static Int32 SendMessage(IntPtr hWnd, int msg, int wParam, 	[MarshalAs(UnmanagedType.LPWStr)]
string lParam)
	{
	}
	[DllImport("user32", EntryPoint = "FindWindowExA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
	private static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string lpsz1, string lpsz2);

	private const int EM_SETCUEBANNER = 0x1501;

	public static void SetCueText(Control cntrl, string text)
	{
		if (cntrl is ComboBox) {
			IntPtr Edit_hWnd = FindWindowEx(cntrl.Handle, IntPtr.Zero, "Edit", null);
			if (!(Edit_hWnd == IntPtr.Zero)) {
				SendMessage(Edit_hWnd, EM_SETCUEBANNER, 1, text);
			}
		} else if (cntrl is TextBox) {
			SendMessage(cntrl.Handle, EM_SETCUEBANNER, 1, text);
		}
	}
}

The above code is working good in Windows 7 and above. But in windows xp it is not working properly. In windows xp the cue text disappears when we click on text box.

Secondly I want to change the color of cuetext (currently it is in grey).

Is it possible to achieve my requirements using current code? Or Is there any other suitable methods for me?
AnswerRe: Implementing a Cue Banner to a textbox in windows xp with custom color Pin
Richard MacCutchan9-Aug-16 22:11
mveRichard MacCutchan9-Aug-16 22:11 
QuestionHTML Tag Pin
Member 126768148-Aug-16 22:23
Member 126768148-Aug-16 22:23 
GeneralRe: HTML Tag Pin
Richard MacCutchan8-Aug-16 23:18
mveRichard MacCutchan8-Aug-16 23:18 
AnswerRe: HTML Tag Pin
Bernhard Hiller9-Aug-16 21:12
Bernhard Hiller9-Aug-16 21:12 
SuggestionRe: HTML Tag Pin
Richard Deeming10-Aug-16 1:21
mveRichard Deeming10-Aug-16 1:21 
QuestionGet Value of Datasource When Selected Item in ComboBox Pin
Mostafa_Hosseini8-Aug-16 5:40
Mostafa_Hosseini8-Aug-16 5:40 
AnswerRe: Get Value of Datasource When Selected Item in ComboBox Pin
OriginalGriff8-Aug-16 6:05
mveOriginalGriff8-Aug-16 6:05 

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.