Click here to Skip to main content
15,910,661 members
Home / Discussions / C#
   

C#

 
Questionhow to restrict the ClickEvent of a Button Pin
pashitech24-Mar-07 22:50
pashitech24-Mar-07 22:50 
AnswerRe: how to restrict the ClickEvent of a Button Pin
The ANZAC24-Mar-07 23:24
The ANZAC24-Mar-07 23:24 
AnswerRe: how to restrict the ClickEvent of a Button Pin
CPallini24-Mar-07 23:55
mveCPallini24-Mar-07 23:55 
AnswerRe: how to restrict the ClickEvent of a Button Pin
Rocky#25-Mar-07 0:56
Rocky#25-Mar-07 0:56 
QuestionGet number of objects that have been serialized Pin
Saikek24-Mar-07 22:11
Saikek24-Mar-07 22:11 
QuestionDate picker Problem Pin
DipakBNET24-Mar-07 21:41
DipakBNET24-Mar-07 21:41 
AnswerRe: Date picker Problem Pin
Abolfazl Sheikhloo25-Mar-07 21:02
Abolfazl Sheikhloo25-Mar-07 21:02 
QuestionProblems changing selection in TextBox derived control Pin
Corey McKenzie24-Mar-07 21:28
Corey McKenzie24-Mar-07 21:28 
I'm working on a TextBox control that allows fields (like MS Office's mail merge feature). I want the editor to treat the field as though it was a single character. The user shouldn't be able to delete part of the field or select only part of the field.

For example, a line might look like: «Image» shot on «Date» at «Resolution»
where «Image» «Date» «Resolution» are all fields.
(above ? in a diamond are actually the same double angle brackets MS uses in Word).

My control inherits from TextBox. I've overloaded OnKeyDown & OnKeyPress so that if the user backspaces it deletes the whole field. If they move left or right, it skips past the entire field. I've also overloaded OnMouseUp so if they select part of the field with the mouse, it increases the selection to select all of the field. This all seems to work.

My problem is if the user holds shift and left, I can't get the field selected and put the cursor to the left of the selection. Similarly if they select by dragging the mouse right to left, the cursor is on the right side.

A snippet of the OnMouseUp code follows:
int SelectionEnd = SelectionLength + SelectionStart;
for (int i = SelectionStart; i >= 0; i--)
{
    if (Text[i] == FieldEnd)
        // Found an end tag. SelectionStart isn't in a field.
        break;
    if (Text[i] == FieldStart)
    {
        // Found the start tag. Modify selection.
        Select(i, SelectionEnd - i);

    }
}

I assume I can't do what I want with just Select(start,len) or SelectionStart and SelectionLength. Any help will be much appreciated!
AnswerRe: Problems changing selection in TextBox derived control Pin
Abisodun25-Mar-07 4:26
Abisodun25-Mar-07 4:26 
GeneralRe: Problems changing selection in TextBox derived control Pin
Corey McKenzie25-Mar-07 5:25
Corey McKenzie25-Mar-07 5:25 
GeneralRe: Problems changing selection in TextBox derived control Pin
Abisodun25-Mar-07 5:41
Abisodun25-Mar-07 5:41 
GeneralRe: Problems changing selection in TextBox derived control Pin
Abisodun25-Mar-07 6:08
Abisodun25-Mar-07 6:08 
QuestionHelp required for Videoocx Pin
Ghoditsttoawn24-Mar-07 21:22
Ghoditsttoawn24-Mar-07 21:22 
AnswerRe: Help required for Videoocx Pin
Christian Graus25-Mar-07 3:06
protectorChristian Graus25-Mar-07 3:06 
GeneralRe: Help required for Videoocx Pin
Ghoditsttoawn31-Mar-07 20:27
Ghoditsttoawn31-Mar-07 20:27 
Questionbyte array - how to remove one item Pin
yarns24-Mar-07 20:05
yarns24-Mar-07 20:05 
AnswerRe: byte array - how to remove one item Pin
Leslie Sanford24-Mar-07 21:17
Leslie Sanford24-Mar-07 21:17 
GeneralRe: byte array - how to remove one item Pin
yarns24-Mar-07 21:21
yarns24-Mar-07 21:21 
GeneralRe: byte array - how to remove one item Pin
Baxtiyor7-Nov-10 22:39
Baxtiyor7-Nov-10 22:39 
Questionimplementation with c# Pin
pariisa24-Mar-07 13:00
pariisa24-Mar-07 13:00 
AnswerRe: implementation with c# Pin
Christian Graus24-Mar-07 13:03
protectorChristian Graus24-Mar-07 13:03 
Questionhow to serialzie object to XML and send through Socket ??? Pin
zinc_z24-Mar-07 12:57
zinc_z24-Mar-07 12:57 
AnswerRe: how to serialzie object to XML and send through Socket ??? Pin
S. Senthil Kumar24-Mar-07 19:25
S. Senthil Kumar24-Mar-07 19:25 
AnswerRe: how to serialzie object to XML and send through Socket ??? Pin
johland26-Mar-07 3:48
johland26-Mar-07 3:48 
QuestionCsharp play wav and vox file Pin
Post524-Mar-07 12:35
Post524-Mar-07 12:35 

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.