|
nickspacek wrote: I want to take what it would look like and draw it onto another control (like a panel).
I'm going to ask a silly question. Why not put a RichTextBox control on the panel instead? Seems like you want to do things the hard way?
|
|
|
|
|
Haha, well, it's a good question. I sorta had this idea that this is the best direction to go but I could be completely wrong. Basically I want to have this panel be a media container (stupid name) or something. I stumbled upon another class here that uses DirectShow to render a video given a handle and bounding rectangle. So the idea is to use just some generic control to draw everything on. I could probably have my app switching between different controls I guess...
There's probably a completely better way to do it all. If I want to use DirectShow for videos I suppose I should use DirectX to render the text and stuff too, but then I'd have to write some sort of class for describing rich text, etc. I may go that way in the future I suppose.
Nick
|
|
|
|
|
hi
i want to set opacity of picturebox (like Form), But how to do ??
thanks ..
|
|
|
|
|
Don't. Instead, draw your picture directly onto the form and set the opacity that way. ImageAttributes is the class you need to create and pass in to the DrawImage method of the Graphics class in your paint method.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi
thnaks for reply .
but i want to add picturebox and other controls in form and set opacity of picturebox.
but how to set opacity of picturebox ? do you know a way ??
thanks
|
|
|
|
|
hdv212 wrote: do you know a way ??
erm... what did I say ? Picture boxes are great for drawing a bitmap quickly, espcially if you prefer to drag and drop components, to writing code. But, they won't let you do what you want, you need to write actual code to do that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello! I'm trying to write a function that checks whether a given value is in a range defined by a minimum and a maximum. I tried this:
public static bool ValidateNumber<T>(T tNum, T? tMinimum, bool bMinInclusive,
T? tMaximum, bool bMaxInclusive)
where T : IComparable<T>
I think it's pretty obvious what I'm trying to do The minimum and the maximum should be optional, therefore nullables. Anyway, the declaration above gives me a compiler error CS0453 ("Type T must not allow NULL values, if it is used as T parameter in the generic type or in the generic method System.Nullable<T>").
How does the correct declaration look like in this case?
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
I think you need to specify INullable as well as IComparable.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
INullable seems to be deeply hidden in the SQL namespace... Also, this interface only adds a IsNull property (but I also need HasValue and Value of "normal" Nullable s). Are you sure I need this interface??
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Dominik Reichl wrote: I think it's pretty obvious what I'm trying to do
Not really - I think your compiler message is hiding another.
You have declared that T is a IComparibale<T>, which is a reference type which is already nullable (nullables are only useful for value types). But declaring that T is an IComparible<T> is a circular reference.
Unless I've missed something, T must therefore be an ICompariblae<IComparible<IComparible<Icomparible<....>>>>
|
|
|
|
|
Ok, so I modified it to non-generic comparable:
private static bool ValidateNumber<T>(T tNum, T? tMinimum, bool bMinInclusive,
T? tMaximum, bool bMaxInclusive)
where T : IComparable
Anyway, still exactly the same compiler error is thrown...
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
The point is that you can remove the ? in T?, because IComparable means you can only pass classes, which are all nullable by default.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Remember that nullable types can only take value types as the generic argument (as value types cannot be null). So in your declaration you just need to specify that T is a value type:
public static bool ValidateNumber<T>(T tNum, T? tMinimum, bool bMinInclusive, T? tMaximum, bool bMaxInclusive) where T : struct, IComparable<T>
Hope this helps.
|
|
|
|
|
i would like to filter my DataView rows with multiple conditions or criteria
eg
dtResults.DefaultView.RowFilter = "Status = 'APPROVED' AND DISTANCE ='YELLOW PAGES'";
is it possible ?
if it's possible what is the right way to do it?
any help will be appreciated
thanks
regards paula
|
|
|
|
|
Hi,
this should work like you wrote it (assuming column names and datatypes are corrrect).
See here[^] for more infos.
Robert
|
|
|
|
|
Holla,
I am currently for the first time requiring differently marked items in a treeView. Namely, I have a Text-Box in which a search-string is entered. If the search is sent, all items
containing the search-pattern should be marked (by making them display in bold font.
Since the NodeFont property of the nodes is not set (by default, I guess), I am using the treeView's Font as a reference:
<br />
public void markNodes (System.Windows.Forms.TreeNodeCollection nodes)<br />
{<br />
if (nodes.Count == 0) return;<br />
foreach( System.Windows.Forms.TreeNode currNode<br />
in nodes<br />
)<br />
{<br />
if (currNode.Text.ToLower().IndexOf(tbSearch.Text.ToLower()) >= 0)<br />
{<br />
currNode.NodeFont = new Font(tvMain.Font, FontStyle.Bold);<br />
}<br />
else <br />
{<br />
currNode.NodeFont = new Font(tvMain.Font, FontStyle.Regular);<br />
}<br />
markNodes(currNode.Nodes);<br />
}<br />
}
This recursive method is called first with tvMain.Nodes.
I do get bold fonts with this code, but the Items are truncated, it seems that some rendering-size property is set to the width of the item int its original font, since
parts of the next letter are occasionally visible.
Unfortunately, I cannot find this property. Refreshing the tree-view, however, does not change this behaviour.
Any tips?
Thanks in advance.
-- modified at 8:19 Wednesday 18th October, 2006
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Hi,
thats a flaw/bug of the TreeView. Set the Font property of the TreeView to have a bold style. Then it will calculate the width of each item with it and everything should look correctly.
Robert
|
|
|
|
|
Thanks
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Hi,
I made an arraylist and put there 10 txt files. And i got 10 checkboxes.
I want to bind the checkboxes (which are also in an array type of CheckBox)
with the corresponding index of the arraylist.
And after that i want to merge all the files into one file.
This is the code:
private CheckBox[] checkBox = new CheckBox[10];
public void Method()
{
ArrayList fileArray = new ArrayList();
string file1 = File.ReadAllText("file1.txt");
string file2 = File.ReadAllText("file2.txt");
string file3 = File.ReadAllText("file3.txt");
string file4 = File.ReadAllText("file4.txt");
string file5 = File.ReadAllText("file5.txt");
string file6 = File.ReadAllText("file6.txt");
string file7 = File.ReadAllText("file7.txt");
string file8 = File.ReadAllText("file8.txt");
string file9 = File.ReadAllText("file9.txt");
string file10 = File.ReadAllText("file10.txt");
fileArray.Add(file1);
fileArray.Add(file2);
fileArray.Add(file3);
fileArray.Add(file4);
fileArray.Add(file5);
fileArray.Add(file6);
fileArray.Add(file7);
fileArray.Add(file8);
fileArray.Add(file9);
fileArray.Add(file10);
foreach (Control chkBx in this.gbxLanguageLongSound.Controls)
{
if (chkBx is CheckBox)
{
for (int i = 0; i < 10; i++)
{
CheckBox currentCheckBox = (CheckBox)this.checkBox["checkbox" + (i+1)];
if (currentCheckBox.Checked == true)
{
File.WriteAllText("CombinedFiles.txt", filesOfCheckedBoxes);
}
}
}
}
I hope i made myself clear.
Thanks in advance!
|
|
|
|
|
You need to read each file individually, then write them all to the one file. But, you need to look for an override that allows you to specify that you want to append, not overwrite.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian,
Every checkbox represents a file. If the checkbox is checked, it should append that file into a new with, together with all the files of the checkboxes that have been checked.
My main problem at this moment is to see whether a checkbox is checked and selects the right file. I thought by declaring an arraylist and fill it with the name of the files and iterate through my checkboxes would do this trick.
[offtopic]
The files contain words. And when a checkbox is checked, it will load that file with specific kind of words.
Those words are going to be displayed for a few seconds and then disappear again. Its a test to improve the reading skills of the kids.
[/offtopic]
Do you know how this can be done Christian?
Thanks in advance!
|
|
|
|
|
How are you showing them ? If just a checkboxlist, then you should create a dictionary of filename to path, assuming you're not wshowing the path. Get the text of the checkbox that is checked and use that to work out the files you want.
Yustme wrote: The files contain words. And when a checkbox is checked, it will load that file with specific kind of words.
Yeah, I guessed that
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You could do the reading and merging along the lines of this:
private int nr_of_checkboxes = 10;
private List<CheckBox> checkboxes = new List<CheckBox>(nr_of_checkboxes);
private Dictionary<CheckBox, string> checkboxDictionary = new Dictionary<CheckBox, string>(nr_of_checkboxes);
private void InitializeControls()
{
for(int i = 0; i < nr_of_checkboxes; i++)
{
checkboxes.Add(new CheckBox());
checkboxDictionary.Add(checkboxes[i], File.ReadAllText("file" + i + ".txt"));
}
}
public void MergeAndWriteFiles()
{
string merged_strings= "";
foreach(CheckBock chkbox in checkboxes)
{
if(chkbox.Checked)
merged_strings += checkboxDictionary.TryGetValue(chkbox);
}
File.WriteAllText("CombinedFiles.txt", merged_strings);
}
Took it all outta my head here, so there might be spellingerrors or other syntaxerrors, but it should point you to a working solution.
Hope it will be of some help.
-Larantz-
for those about to code, we salute you
|
|
|
|
|
hi All
i wnat to insert a picture in MS ACCESS table (this table field data type is Ole Object). how can i do this with out using make image strming bytes.
Thanks
Pavan Pareta
|
|
|
|
|
I don't see how you can insert a bitmap without streaming it's bytes.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|