|
Hi !
I'm currently making a custom TreeView inheriting "ScrollableControl" and all parts are painted with GDI. Now, I'm going to implement the checkBox and I would like painting them too.
Is it reasonable for the performances of the application to paint controls instead of adding real controls ?
I have the same question for all parts like the "arrows / plus-minus" icon.
I want adding possibility to format the node text. Adding colors for some words or underline ...etc...
Actually, this text is painted too with GDI "DrawString". What is the best solution for you to format this text easily for the control user ?
Asking to user to enter RTF formating or Html formating and parse it before paint ?
|
|
|
|
|
Hi,
maybe not directly an answer to your question, however: have you read the documentation on ControlPaint class?
|
|
|
|
|
norrisMiou wrote: Is it reasonable for the performances of the application to paint controls instead of adding real controls ?
yes.
a control is a very expensive ressource, and a filled treeview may have up to thousands of Nodes.
I never tried, but i don't think, an application with thousands of Controls will run propperly.
|
|
|
|
|
Really thanks for yours answers
I did not know at all "ControlPaint" Class, but Just before looking at this, I have founded for example "CheckBoxRenderer.DrawCheckBox" ... and make the relation with "ControlPaint".
Very very cool !
It seems to be perfect for me I think. If I have understood, that must make it possible to have the faithful chart of controls without having their weight ! Right ?
edit:
After trying both solutions, it seems "ControlPaint.DrawCheckBox" paint a checkBox without theme, compared to "CheckBoxRenderer.DrawCheckBox" who paint it with theme.(I'm under XP)
modified on Saturday, April 10, 2010 5:04 PM
|
|
|
|
|
Im doing an online chat which allows users to interact, keywords will be stored within a database.
When the user wants to submit a message (they have written in a text box)the content within the textbox is examined so that it doesn't contain any of the words that are in the database, if it does then the words will be highlighted and the message won't be sent. Can anyone help me on how I can do this? I really need help Im using visual studio 2008
|
|
|
|
|
I found a link here.
This should give you an idea on what you need to do.
|
|
|
|
|
You have to use Ajax for implementing this functionality. You get help from following links,
Link1
Link2
|
|
|
|
|
sandympatil wrote: You have to use Ajax for implementing this functionality
WHAT?! Uhhh....no.
|
|
|
|
|
I can provide you with the general explanation.
What you need to do is, Firstly fetch the words you dont want to publish on your chat. Store it in an array. A generic list would be great if you are aware of that.
Then when any user sends the data, create a for loop where you will have to search for the specific word on the sentence. For every matched word, you will have to change the font color of that particular word, and reattach the word back..
There are many versions available, but this is the simplest one, when you wish to filter bad words, (which are upto 20-30 only)...
I hope this helped you..
|
|
|
|
|
LINQ is also a very good concept which can be used to solve your issue..
jaypatel512
|
|
|
|
|
I have created setup of .net window application. If I am installing on windows 7 machine one alert window mentioning
"Unkown Publisher". So how do I set publisher name while creating setup of .net window application.
|
|
|
|
|
You might want to have a look here.
Try including a publisher name in your setup file and see if it stops this popup from appearing.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
hi
please I need the code for sending bytes from one pc to another connected via ethernet cable using vbwinsock & udp protocol in vb.net
thank you
|
|
|
|
|
1) This is the wrong forum.
2) Did you do a search on the internet before posting your question here?
Here is the first result I got.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
winsock control is in VB6. if you are developing application with .Net Frame work (VB/C#) go through
the namespace System.Net.Sockets
search in GOOGLE you will find no of examples.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
|
I am using the datareader to read through a foxpro table and when there are multiple records in the table it will only read the first one and then drop out of the loop. Any ideas on why it is doing this?
If DR.HasRows Then
While DR.Read()
random code here...
uploadDate = sql statement...
uplDate = New OleDb.OleDbCommand(uploadDate, objConnection)
DR = uplDate.ExecuteReader
DR.Read()
End While
End If
modified on Monday, April 12, 2010 3:10 PM
|
|
|
|
|
You're reusing the same reader to do something different which executes on the same connection. That's why it's dropping out of the loop. Change this to execute the second reader on a different connection if it's doing something with the data from the first query.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
It seems that you need to use two different Data Reader. DR is fine for the external while loop.
But inside the while loop you are re-updating its value which is leading to the problem..
Try using another instance of the datareader, and it would work completely fine.
|
|
|
|
|
Hi audience!
on several places ther is demanded in a very unconditional manner: "when starting a thread with aDelegate.BeginInvoke() always call the corresponding aDelegate.EndInvoke(IAsyncResult ar) .
For example see MSDN itself [ ^ ] .
But now i look in Reflector, how the Backgroundworker -class works, and i find:
public void RunWorkerAsync(object argument)
{
if (this.isRunning)
{
throw new InvalidOperationException(SR.GetString("BackgroundWorker_WorkerAlreadyRunning"));
}
this.isRunning = true;
this.cancellationPending = false;
this.asyncOperation = AsyncOperationManager.CreateOperation(null);
this.threadStart.BeginInvoke(argument, null, null);
}
And this.threadStart is simply a private class-variable of type WorkerThreadStartDelegate , which is defined as:
private delegate void WorkerThreadStartDelegate(object argument);
Since
this.threadStart.BeginInvoke(argument, null, null);
does not save the returned IAsyncResult , nor passes an AsyncCallback to the BeginInvoke() -call, i see no option for the backgroundworker, to call this.threadStart.EndInvoke(IAsyncResult ar) propperly.
So i think to myself: if the parallel processed method is void , actually there is no need to call aDelegate.EndInvoke(IAsyncResult ar) ?
I would be pleased of that, because that could simplyfy some of my codes.
So can anyone confirm my conclusion?
|
|
|
|
|
I think you've been reading MSDN far too closely and I should state at the outset that I don't have an answer to the question. The confusion around this issue must arise out of inconsistencies in the Microsoft documentation. For example, there is a disparity between your reference and the information in Event Based Asynchronous Pattern[^]. The first gives the impression that the world will end if the EndInvoke call is omitted, yet the second does just that and does not explain why we're still here.
I haven't found an example that demonstrates a problem caused by not calling EndInvoke or been able to come up with one of my own. My own best idea to make something go wrong was this:
internal void InvokeTest(Int32 count) {
IAsyncResult ar;
for (Int32 i = 0; i < count; i++) {
TaskDelegate t = Task;
ar = t.BeginInvoke(null, null);
ar.AsyncWaitHandle.WaitOne();
}
}
private void Task() {
throw new Exception('a', 64 * 1024);
}
I thought that the ignored exceptions on the invoked thread might be retained by the CLR until EndInvoke was called but find that there is no gradual upwards drift in memory useage (Process Explorer). If the Exception objects were not being collected it should be very obvious given the size of the associated exception message.
To err on the side of caution one should include EndInvoke but I can't find any compelling evidence one way or the other.
So no help from me then, but I thought your post was looking lonely!
Alan.
|
|
|
|
|
Thank you very much! Especially
Alan N wrote: ...but I thought your post was looking lonely! ...
shows a noble character, and i'm happy to see, such magnanimity still exists in the real world .
Finally i found an answer, and a reasonable reason to call Action<whatever>.EndInvoke() :
Exceptions of the sideThread are saved to the calling thread (May be you knew that already, to me it's new).
In Designmode there is no difference - the Debugger stops where the exception is thrown.
But in Release-mode it's important, and very dangerous, because a lost exception leaves the program running in an instable State!
using System.Windows.Forms;
using System;
using System.Threading;
namespace AsyncWorkerCs {
public partial class frmMain : Form {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.Run(new frmMain());
}
public frmMain() {
InitializeComponent();
btCreateError.Click += btCreateError_Click;
}
void btCreateError_Click(object sender, EventArgs e) {
var createError = new Action(CreateError);
createError.BeginInvoke(null, null);
}
void CreateError() {
Thread.Sleep(500);
throw new Exception("CreateError()!");
}
}
}
Hmm, now i've found a reason to call Action.EndInvoke, it's one more reason to deprecate the Backgroundworker-class, isn't it?
a very strong reason to deprecate it, since the dangerous behavior does not occur in Debug-mode.
So it causes its surprises really late.
regards
|
|
|
|
|
Here is my code, I trying to pass the full Name to floating div, when I click on the cell.
asp:DataGrid ID="gvResults" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" BackColor="transparent" BorderColor="White" BorderStyle="None"
CellPadding="0" Font-Size="X-Small" PageSize="10" Visible="True" Width="500px"
CssClass="width-full cell-padding cell-top-align" ShowHeader="true" ShowFooter="false"
PagerStyle-Mode="NextPrev"
PagerStyle-Position="Top"
PagerStyle-HorizontalAlign="Left"
PagerStyle-CssClass="pageLinks"
PagerStyle-VerticalAlign="Bottom"
AlternatingItemStyle-BackColor="#F5F5F5" OnPageIndexChanged="PageIndexChanged_Click" OnSelectedIndexChanged="dgSchedule_SelectedIndexChanged" >
<Columns>
<asp:TemplateColumn HeaderText="" >
<HeaderTemplate>
<asp:LinkButton id="lblFullName" Width="130px" runat="Server" Text='↓ Full Name' />
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox BackColor="transparent" Font-Size="10px" BorderStyle="none" runat="server" ReadOnly="true" runat="server" onclick="showhide('CombinePat','none')" ID="txtFullName" ToolTip="Combine Patient" value= '<%# DataBinder.Eval(Container, "DataItem.Full_Name") %>' ></asp:TextBox>
<%--<asp:TextBox BackColor="transparent" ReadOnly="true" ID="txtFullName" BorderStyle="none" runat="server" Width="150px" Font-Size="10px" value= '<%# DataBinder.Eval(Container, "DataItem.Full_Name") %>' />--%>
</ItemTemplate>
<ItemStyle CssClass="grid-item" />
</asp:TemplateColumn>
THis is my floating div
<div id="CombinePat" class="modal display-none" >
<a href="javascript:;" class="close" onclick="showhide('none','CombinePat')">Close</a>
<h5>Combine Duplicate Patients</h5>
<ul class="form input label-xl margin-none border-none">
<li><label class="desc">Name</label><asp:TextBox ID="txtFullName2" runat="server"></asp:TextBox><%--<input type="text" size="45" />--%></li>
|
|
|
|
|
Hi, I'm trying to make a program (using .NET) in which its GUI is based around Microsoft's Windows Explorer. I want it so that I can edit "stuff" where the main file exploring bit is... I can do BandObjects which is the style of integration I think I'll need but I want it for the main body of explorer. For a better idea what I'm talking about, someone made a Registry Editor integrated into Windows Explorer and Mircosoft themselves do something similar with their Global Assembly Cache.
Could anyone give me an idea on how to go about such a thing?
Thank you.
|
|
|
|
|
You're going to need this[^]. THe sample you linked to uses this very library to heklp with this work.
Even though that library exists, it's not wise to write shell extensions (or in your case, a namespace extension) in .NET. If using .NET 1.x through .NET 3.5, you can only load a single version of the .NET Framework into a process (Explorer) at any one time. If the user has a different extension (or whatever else) using a different version of the .NET CLR than your extension is using, bad and unpredictable things will happen. Stuff like this is best left up to doing in C++, at least until .NET 4.0 comes out.
After that, you're on your own. What you're doing isn't normally done in .NET because of the massive amount of work required. Though, the library above does take care of a lot of that for you, the likelyhood of someone else here using it is extremely low. You're best source of information is going to be the people who wrote that library.
|
|
|
|