|
Does anyone know a way to integrate a custom set of permissions into active directory using C#?
|
|
|
|
|
How can I add C++ Class to a C#/VC++6 Projects?
|
|
|
|
|
Fahmawi wrote: C#/VC++6 Projects
There's no such thing, a VC6 project cannot know about C#.
Also, a VC6 project cannot work with .NET, unless it does so via COM.
Your options are to build a dll using managed C++, or using COM.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i want to do this effect where i draw a string in a control using the gdi drawstring thing and behind certain words i want to draw a small filled rectangle the length and size of the word/words i want to highlight.
one of my attempts was to use the SetMeasurableCharacterRanges process to locate the position of each character in a string and then knowing the index of the letters to highlight, and the position of where to draw...i could achieve what i wanted... but then theirs the 32 CharacterRange limit that leads to an overflow exception if i try to calcuate the position of more then 32 characters in a string...
see it even says it in the description about the limit
<br />
public void SetMeasurableCharacterRanges(CharacterRange[] ranges);<br />
so i need to know...is it possible to draw text this way at all? i'd settle for a workaround for the SetMeasurableCharacterRanges problem.
|
|
|
|
|
The graphics class has a MeasureString method which returns a size. Then draw a rectangle of that size.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I tried something with measurestring but i found it to not work appearence-wise. Has to do with letter kerning. Also i dont mean highlight the whole string...just certain words in a string. like draw a yellow rectangle behind the word "fox" in the string "The quick orange fox".
|
|
|
|
|
i made a solution to measuring more then 32 characters
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Runtime.InteropServices;<br />
<br />
namespace DrawStringOneCharAtATime<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private Color RandomColor()<br />
{<br />
Random random = new Random();<br />
<br />
return Color.FromArgb(random.Next(256), random.Next(256), random.Next(256));<br />
}<br />
<br />
private Color InvertColor(Color color)<br />
{<br />
byte bRed = (byte)~(color.R);<br />
byte bGreen = (byte)~(color.G);<br />
byte bBlue = (byte)~(color.B);<br />
<br />
return Color.FromArgb(bRed, bGreen, bBlue);<br />
<br />
}<br />
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
base.OnPaint(e);<br />
<br />
if (this.DesignMode)<br />
return;<br />
<br />
using (SolidBrush foreColorSolidBrush = new SolidBrush(this.ForeColor))<br />
using (SolidBrush backColorSolidBrush = new SolidBrush(Color.Yellow))<br />
{<br />
string text = "Never send a human to do a wolf's job cause it would be really really really be funny to watch. :p";<br />
<br />
RectangleF displayRectangle = new RectangleF(0, 40, 200, 200);<br />
<br />
<br />
<br />
StringFormat strFormat = StringFormat.GenericTypographic;<br />
strFormat.FormatFlags =<br />
StringFormatFlags.FitBlackBox | <br />
StringFormatFlags.NoClip |
StringFormatFlags.MeasureTrailingSpaces;
<br />
CharacterRange[] ranges;<br />
Region[] charRegions;<br />
<br />
Color foreColor;<br />
Color backColor;<br />
<br />
for (int index = 0, i; index < text.Length; index += 32)<br />
{<br />
if (text.Length - index < 1)
break;<br />
<br />
else if (text.Length - index > 32)
ranges = new CharacterRange[32];<br />
<br />
else
ranges = new CharacterRange[text.Length - index];<br />
<br />
for (i = 0; i < ranges.Length; i++)<br />
ranges[i] = new CharacterRange(index + i, 1);<br />
<br />
strFormat.SetMeasurableCharacterRanges(ranges);<br />
<br />
charRegions = e.Graphics.MeasureCharacterRanges(text, this.Font, displayRectangle, strFormat);<br />
<br />
for (i = 0; i < charRegions.Length; i++)<br />
{<br />
foreColor = RandomColor();<br />
backColor = InvertColor(foreColor);<br />
<br />
foreColorSolidBrush.Color = foreColor;<br />
backColorSolidBrush.Color = backColor;<br />
<br />
e.Graphics.FillRegion(backColorSolidBrush, charRegions[i]);<br />
<br />
RectangleF bounds = charRegions[i].GetBounds(e.Graphics);<br />
<br />
e.Graphics.DrawString(text[index + i].ToString(), this.Font, foreColorSolidBrush, bounds, strFormat);<br />
}<br />
}<br />
}<br />
}<br />
}<br />
}<br />
|
|
|
|
|
|
aeliminate wrote: on a variety of windows and non-windows based devices, such as Windows XP, Windows Mobile 5.0, Microsoft Pocket PC, Windows Media Centre Edition, etc.
I don't see a non-windows platform listed.
aeliminate wrote: The student
This is the point at which this is clearly homework. So, do your homework, and if you get stuck, ask *specific* questions.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
dear madhav! this is your professor at the university. for shame on you since you posted my homework on the cpian. i at first have a doubt about you, hoping and praying to swami you would not failsexed me. but now you cheated! for shame on you.!!11 now you get blackened grade for school. you make me cry.
Sincelery yours, Computer Information conSciences Professor and grader, Sharada Ulhas
|
|
|
|
|
Professor Sharada Ulhas wrote: you cheated! for shame on you
You tell 'em, professor
That's no moon, it's a space station. - Obi-wan Kenobi
|
|
|
|
|
Stick it to him, doc!
|
|
|
|
|
aeliminate wrote: please help me.
With what?
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: aeliminate wrote:
please help me.
With what?
aeliminate probably wants somebody to do his homework for him.
That's no moon, it's a space station. - Obi-wan KenobiLast modified: Tuesday, August 15, 2006 7:06:04 PM --
|
|
|
|
|
Perhaps. It's impossible to tell from the question. Perhaps he doesn't understand the assignment at all, and only need some input. Who knows.
That's why I asked.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: It's impossible to tell from the question. Perhaps he doesn't understand the assignment at all, and only need some input.
Yeah, I am not exactly sure what he's looking for as a response. Hopefully is just looking for some input to help the thought process
too much daily WTF for someone... - Anton Afanasyev
|
|
|
|
|
I have a windows service, which when its OnStop method is called, needs to do some work that may take a while. It seems like the SCM only waits a default time(20-30 seconds) before it terminates the service, whether or not it has finished its work.
I know that in the .NET Framework 2.0, there is something called RequestAdditionalTime() that can be called to change this default time, so that the SCM will wait the request period before terminating the service.
But is there something similar I can do in the .NET Framework 1.1?
Thanks in advance.
|
|
|
|
|
Hi Everybody,
I just need to know how I can make the mouse invisibile with DirectInput in C#.
Thanks,
0rigin
|
|
|
|
|
I am trying to pull data from a DB and have it prefill a form when the form is pulled up. Here is a little snippet of code that I am using. I am getting a handling error (in subject line)
public static string[] FormArgs;
public static DESClient.DESClientConnection conn;
private DESClient.DESApplicant applicant;
private string primedln = String.Empty;
int x = 0;
foreach(string arg in FormArgs)
{switch( x )
{case 4:
primedln = arg;
break;}
x += 1;
}
applicant = new DESClient.DESApplicant(conn);
applicant.setAppID(Convert.ToInt32 (primedln) );
lbName.Text = applicant.getLname()+", "+ applicant.getFname()+" "+ applicant.getMname()+".";
lbDLN.Text = applicant.getAppId() +"/"+ address.getState().ToUpper();
static void Main(string[] args)
{
Form1.FormArgs = args;
Application.Run(new Form1());
}
|
|
|
|
|
|
lbDLN.Text = applicant.getAppId() +"/"+ address.getState().ToUpper();
|
|
|
|
|
TWatson47 wrote: foreach(string arg in FormArgs)
{switch( x )
{case 4:
primedln = arg;
break;}
x += 1;
}
Why not just grab the fifth item by index ?
You need to step into this code, and work out which line is causing the error.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi guys,
I am trying to parse a date from a txt file using the following code.
while ( (sWhole = trd.ReadLine().Trim()) !=null )
{
if (sWhole =="" )
continue;
if(sWhole.EndsWith("=END="))
break;
String sDate;
Regex rDate=new Regex(".*\\d{2}/\\d{2}/\\d{4}\\s.*");
Match m5=rDate.Match(sWhole);
if (m5.Success)
{
sDate=m5.ToString();
scolDate.Add(sDate);
}
where scolDate=string collection.
When I run the file to parse the date, I keep getting an error saying "Index was out of range. Must be non negative and less than the size of the collection.
Please help!!!!
sasa
|
|
|
|
|
|
On second thought, if you don't know where in the text file the date is located, DateTime.TryParse may not work for you.
Have you looked at RegExLib.com[^]? The site is filled with hundreds of common regular expressions. Search that site for "date" and you'll get several hits.
Also, another tool that may aide you in regular expression building is the free RegExBuilder[^] tool. I highly recommend it.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: And in this corner, the Party of Allah
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|