|
hello every body.
I wanna to create windows service with c # that ,it able tack snapshot and send to server.
but my problem is when using "Screen.PrimaryScreen.Bounds" .visual studio cant know this.
I was so much search bout this problem but I cant get result.
thank you for help me.
|
|
|
|
|
You can't.
Services can't access the screen, keyboard, mouse, or any other element of the user interface at all. They can't start an app that can access the UI either!
Why not? Becauses services are designed to run when there is no user, and hence no user interface.
I don't know what you are trying to achieve, but you will not get this to work at all.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm having an issue with a nested button flyout that I can't figure out.
( Screenshot of the problem --> Uwp Flyout Issue[^] )
Basically, a hamburger button's flyout contains a Splitview, where the pane is a Listview menu. When a menu item is chosen, the SplitView's content frame navigates to an associated page. Simple enough.
On a menu page, if I have a button with a flyout that contains a ColorPicker, there seems to be some sort of dismiss area overlap problem. I've tried various combination of LightDismissOverlayMode settings on the SplitView and the button flyouts, to no avail.
Here's the hamburgar button within the StackPanel of the main page:
<StackPanel>
<Button x:Name="BtnMainMenu"
Content=""
ToolTipService.ToolTip="Main Menu"
Margin="10,10,0,0"
FontFamily="Segoe MDL2 Assets"
Style="{StaticResource StandardButton}">
<Button.Flyout>
<Flyout x:Name="MainMenuFlyout"
Placement="TopEdgeAlignedLeft"
FlyoutPresenterStyle="{StaticResource MainMenuFlyoutStyle}"
Closed="MainMenuFlyout_Closed">
<SplitView x:Name="MainSplitView"
IsPaneOpen="True"
DisplayMode="Inline"
OpenPaneLength="180">
<SplitView.Pane>
<ListView
x:Name="MainMenuListView"
ItemsSource="{x:Bind MenuLinks}"
ItemTemplate="{StaticResource MainMenuItemTemplate}"
SelectionMode="Single"
Background="#FF808080"
IsItemClickEnabled="True"
ItemClick="MainMenuListView_ItemClick"/>
</SplitView.Pane>
<SplitView.Content>
<Frame x:Name="MainMenuContentFrame"/>
</SplitView.Content>
</SplitView>
</Flyout>
</Button.Flyout>
</Button>
</StackPanel>
... and the main layout StackPanel of the selected menu page that contains the ColorPicker in a button's flyout:
<StackPanel Background="{StaticResource MenuPageBg}" Width="230" Height="300">
<Border Style="{StaticResource MenuPageHeaderStyle}">
<TextBlock Text="Menu 4" Style="{StaticResource MenuPageTitleStyle}"/>
</Border>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="10"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ToggleSwitch Name ="Enabled" OnContent="Enabled" OffContent="Disabled"
Grid.Row="1" Grid.Column="1"
FontSize="18"/>
<ToggleSwitch Name="Floating" OnContent="Goodbye World" OffContent="Hello World"
Grid.Row="2" Grid.Column="1"
FontSize="18"/>
<Button x:Name="BtnColor" Grid.Row="3" Grid.Column="1"
Width="49" Height="48" Background="Gray" BorderBrush="{StaticResource WAVGray}" BorderThickness="1">
<Rectangle Width="30" Height="27">
<Rectangle.Fill>
<SolidColorBrush Color="{x:Bind TheColorPicker.Color, Mode=OneWay}"/>
</Rectangle.Fill>
</Rectangle>
<Button.Flyout>
<Flyout Placement="TopEdgeAlignedLeft">
<ColorPicker x:Name="TheColorPicker"
ColorSpectrumShape="Ring"
IsMoreButtonVisible="False"
IsColorSliderVisible="True"
IsColorChannelTextInputVisible="False"
IsHexInputVisible="False"
IsAlphaEnabled="True"
IsAlphaSliderVisible="True"
IsAlphaTextInputVisible="False" />
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</StackPanel>
</Page>
Regards,
R. Wey
|
|
|
|
|
You're varying different backgrounds; it looks like you're creating a partial transparency (which might be inherited).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
That's a good theory, and it led me to the solution.
If you refer back to the picture linked in the OP, the problem smells of two transparencies overlapping each other, but even when removing all transparent colors from my code, the problem persisted.
So, for a final test I went into my Windows Settings/Personalization/Colors and noticed "Transparency Effects" was enabled. Disabling it solved the problem, and I guess it makes sense since my app inherits its theme from the Windows settings on my PC. Nevertheless, this seems like an odd behavior from the base Windows theme for it to show up only when related to flyouts.
I'm guessing there's a way to override the base theme on a child flyout, but for now I'm just going to leave Transparency Effects disabled.
Thanks for nudging me in the right direction!
Regards,
R. Wey
|
|
|
|
|
this is bullshit, the first VAO without std::vector get drawn but not the second with vector :
Vector3f Vertices[4];
Vertices[0] = Vector3f(-1.0f, -1.0f, 0.5773f);
Vertices[1] = Vector3f(0.0f, -1.0f, -1.15475f);
Vertices[2] = Vector3f(1.0f, -1.0f, 0.5773f);
Vertices[3] = Vector3f(0.0f, 1.0f, 0.0f);
unsigned int Indices[] = { 0, 3, 1,
1, 3, 2,
2, 3, 0,
0, 1, 2 };
GLuint VBO[2];
GLuint IBO[2];
unsigned int id[2];
glGenVertexArrays(2, id);
glGenBuffers(2, VBO);
glGenBuffers(2, IBO);
glBindVertexArray(id[0]);
glBindBuffer(GL_ARRAY_BUFFER, VBO[0]);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[0]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW);
struct Vertex
{
Vector3f position;
//Vector2f texCoord;
//Vector3f normal;
//int Boneindices[4];
//float Weights[4];
};
vector<vertex*> Vertices2;
Vertex* v=new Vertex();
v->position = Vector3f(-1.0f, -0.0f, 0);
Vertices2.push_back(v);
v->position = Vector3f(1.0f, -0.0f, -1);
Vertices2.push_back(v);
v->position = Vector3f(1.0f, -0.0f, 0);
Vertices2.push_back(v);
v->position = Vector3f(0.0f, 1.0f, 0.0f);
Vertices2.push_back(v);
struct Triangle
{
int indices[3];
};
Triangle* t = new Triangle();
t->indices[0]=0;
t->indices[1]=3;
t->indices[2]=1;
vector<triangle*> Indices2;
Indices2.push_back(t);
t->indices[0] = 1;
t->indices[1] = 3;
t->indices[2] = 2;
Indices2.push_back(t);
t->indices[0] = 2;
t->indices[1] = 3;
t->indices[2] = 0;
Indices2.push_back(t);
t->indices[0] = 0;
t->indices[1] = 1;
t->indices[2] = 2;
Indices2.push_back(t);
glBindVertexArray(id[1]);
glBindBuffer(GL_ARRAY_BUFFER, VBO[1]);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)* Vertices2.size(), &Vertices2[0], GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[1]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Triangle)* Indices2.size(), &Indices2[0], GL_STATIC_DRAW);
for (size_t i = 0; i < 2; i++)
{
glBindVertexArray(id[i]);
glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
}
|
|
|
|
|
Your vector contains pointers to vertex , not the actual vertices. In fact it contains the same pointer four times, so even if OpenGL can handle pointers to vertex data you only have the same vertex repeated. The index buffer suffers from the same problem.
|
|
|
|
|
Isawyouoo wrote: this is bullshit Well you wrote it.
Look at the following line:
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)* Vertices2.size(), &Vertices2[0], GL_STATIC_DRAW);
The third parameter is supposed to be a pointer to the data you wish to copy, but you are passing a pointer to a pointer. The vector contains a list of pointers to vertex elements, so &Vertices2[0] is the address of the first pointer item in the vector. It should be:
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)* Vertices2.size(), Vertices2[0], GL_STATIC_DRAW);
Without the & on parameter three.
|
|
|
|
|
So I'm aware of MonoGame, SharpDx, etc, but these are all significant overkill for what I need, and what's more, none of them work over the remote desktop protocol.
I'm just wanting to do some very simple 2D graphics, and it doesn't even have to run at a particularly high frame rate (even 20FPS is fine). But most importantly, it has to work over the RDP, which means it has to be software rendering.
I have played with a WritableBitmap with some degree of success, but was wondering if anyone had any other ideas?
Obviously, this isn't for any sort of "real" game or anything. Just basically an exercise to keep me from forgetting how to use C#.
|
|
|
|
|
I'm somewhat new to DirectX programming and need a bit of guidance. My requirement is currently limited to video and 2D drawing and so far I've managed to get SharpDX to play a video from a file without problems, and also have been able to do my 2D drawing. This was simple enough and the performance is good.
Ultimately, my video source will need to be video input devices ( i.e. web cams, video capture cards, etc. ).
My question is: Does SharpDX.MediaFoundation include DirectShow wrappers such that I can access and play video from local video input devices? If so, can someone point me in the right direction and link some examples of using SharpDX for this purpose?
Many thanks.
|
|
|
|
|
Quote: NOTE: As of 29 Mar 2019, SharpDX is no longer being under development or maintenance Are you sure you still want to go down SharpDX path?
Sadly, the only .NET wrapper for DirectX anything that I know of, that is still in development, DirectN[^].
|
|
|
|
|
I understand it's no longer supported, but it's battle tested and I don't think the risk at present is any greater than investing in the "latest and greatest" GUI framework only to have it killed off before it gets off the ground.
Besides, I feel if I use SharpDX to get a better handle on the underlying concepts, porting to something new(er) when required would be easier.
As to my original question, I know there's other NuGet packages that make easy work of displaying camera input ( i.e. AForge, Accord ), but I'm not convinced they're taking full advantage of the GPU, which is what I'm looking for. Specifically, I need to route the capture byte stream directly to the mediaengine's render surface as I'll be dealing with larger sizes and framerates.
Regards,
R. Wey
|
|
|
|
|
|
I'm using WinForms (yeah, I know ... old school), tho I don't think that makes much difference as in the end its simply the window/control Handle that has to be specified as the swapchain.OuputHandle. I'm doing that already for playing a video file as a test and performance is very good.
When looking through SharpDX.MediaFoundation with Reflector, I get the strong feeling it provides the means for capture input, but I can't find any complete examples in that specific area.
Regards,
R. Wey
|
|
|
|
|
And herein lies the problem with using a library that's been dead in the water for two years, lack of support.
I can't help you as I've never used the thing.
|
|
|
|
|
No problem. Given that it saw over 2.5 million downloads, I figured there might be somebody that used it for this purpose and I don't think DirectX11 is going anywhere any time soon.
As for newer platforms, I unfortunately don't have a lot of experience with them so I'm concerned about the stumbling block that would present and not knowing their limitations. I could struggle my way thru UWP, but using what accelerated graphics API? Win2D? WinUI3? DirectN ?
It's hard to know which platform to choose that will still be around by the time I learn it.
Regards,
R. Wey
|
|
|
|
|
|
I am creating a game with pygame and an image won't show up until the window is loading to be closed. This is my code so far:
import pygame
pygame.init()
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption("ALix")
icon = pygame.image.load("nater.jpg")
pygame.display.set_icon(icon)
playerImg = pygame.image.load('nater.jpg')
playerX = 400
playerY = 300
def player():
screen.blit(playerImg, (playerX, playerY))
running = True
while running:
screen.fill((255, 255, 255))
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
player()
pygame.display.update()
modified 13-Jul-20 3:22am.
|
|
|
|
|
I do not know pygame but I notice that you do not call pygame.display.update() until the end of the program. In most GUI applications you need to call update during normal running in order to keep it current.
|
|
|
|
|
I have run into a dead end in another OpenGL forum.
I have a basic understanding how (OpenGL) stencilling works.
My stencil is in 2D , no depths.
I am extracting a (circular) part of OpenGL objects, no problem.
I am trying to further manipulate the stencil result.
The task is to enlarge the result and move it to the center of the screen.
I used glTranslatef but it moves the original stencil, not the result. I want to move the result only.
I think my issue is that the stencil was build in "top of the modleview matrix" ( no push /pop) and the objects to be stencilled are in various matrix "stack" - used push / pop.
I understand the "result" is in color buffer, but it sure looks as I am manipulating the stencil buffer, which has been already disabled.
Am I correct in all this?
Do I have to rebuild all on SAME matrixview stack level ?
I am sorry if I am not using correct OpenGL terminology.
Cheers
|
|
|
|
|
First - to avoid "confusion" - I am using term "object" to describe what is created in OpenGL in-between "new " and "end" loop code.
I have a "text (object)" rendered (in OpenGL window) , I need to delete such text and replace it with another one.
I do no want to translate , rotate etc. ... just delete and replace.
What I have tried so far ALWAYS writes OVER the existing text and makes a mess.
Is that possible in OpenGL?
I think I'll try (a hack ) - moving / translating current(text) matrix off the screen....
Open to other ideas.
Cheers
|
|
|
|
|
This is just a wild guess because I can't see your code - are you missing a call to glClear in your render loop?
|
|
|
|
|
As a general "rule" NOT to invite uncalled for criticism on my under construction code I am therefore very reluctant to post code.
However, every rule has an exception so here is the latest implementation of "write text message" to OpenGL window.
It writes the message, but in wrong position - irrelevant for now.
(The disabled #ifdef / #endif code was added and that is why the message is written in wrong raster position.The raster position code must be in wrong place. )
It is my understanding that OpenGL keeps the data - bitmap in this case - in video card hardware. So to override / update the data I have to access that particular hardware .
Or in another words - OpenGL "variable / object" cannot be just overwritten like C code.
So I believe I need to keep track of "matrix" where the initial bitmap is written and then
glLoadIdentity(); should clear the entire matrix.
Correct me if I am wrong, but glClear would not work SELECTIVELY , it would clear entire buffer.( I did neglected to add "selectively" to the post title )
<pre>void OpenGL_text(char *message, float x, float y, float z) {
printf("\nOPENGL TRACE OpenGL @function %s @line %i \n", __FUNCTION__,
__LINE__);
printf("\nOPENGL TRACE STOP passed message %s @line %i\n", message,
__LINE__);
char menu[80];
strcpy(menu, message); int len;
len = strlen(menu);
glColor3f(1, 1, 1);
{ glMatrixMode( GL_PROJECTION); glPushMatrix(); glLoadIdentity();
gluOrtho2D(0, 500, 0, 500); { glMatrixMode( GL_MODELVIEW);
glPushMatrix();
glLoadIdentity(); glRasterPos3f(x, y, z);
for (int i = 0; i < len; ++i) {
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, menu[i]);
}
glPopMatrix(); } glMatrixMode( GL_PROJECTION);
glPopMatrix();
} glMatrixMode( GL_MODELVIEW);
}
|
|
|
|
|
Yes, glClear does clear the whole viewport - you would then redraw all of the content for the next frame. Matrices only affect what you are going to render in the future, not what you have already sent to be rendered.
|
|
|
|
|
Since I just discover that push / pop matrix is "deprecated " clearing all maybe the only decent option anyway. Really not that hard since I keep system state...
Bottom line OpenGL was not the best choise for my application. O well...
Thanks
|
|
|
|
|